/* Generated by Cython 0.22.1 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "extra_compile_args": [
            "-Wno-unused-function"
        ]
    }
}
END: Cython Metadata */

#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 0
#else
#include "pyconfig.h"
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 1
#else
#define CYTHON_USE_PYLONG_INTERNALS 0
#endif
#endif
#endif
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_22_1"
#include <stddef.h>
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
#define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
  #define __Pyx_PyFrozenSet_Size(s)         PyObject_Size(s)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  #define __Pyx_PyFrozenSet_Size(s)         PySet_Size(s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
   a quiet NaN. */
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
#ifdef __cplusplus
template<typename T>
void __Pyx_call_destructor(T* x) {
    x->~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(T& ref) : ptr(&ref) { }
    T *operator->() { return ptr; }
    operator T&() { return *ptr; }
  private:
    T *ptr;
};
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__cassandra__cluster
#define __PYX_HAVE_API__cassandra__cluster
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (    \
    (sizeof(type) < sizeof(Py_ssize_t))  ||             \
    (sizeof(type) > sizeof(Py_ssize_t) &&               \
          likely(v < (type)PY_SSIZE_T_MAX ||            \
                 v == (type)PY_SSIZE_T_MAX)  &&         \
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||       \
                                v == (type)PY_SSIZE_T_MIN)))  ||  \
    (sizeof(type) == sizeof(Py_ssize_t) &&              \
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||        \
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */

static PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "cassandra/cluster.py",
};

/*--- Type declarations ---*/
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches;
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr;
struct __pyx_defaults;
typedef struct __pyx_defaults __pyx_defaults;
struct __pyx_defaults1;
typedef struct __pyx_defaults1 __pyx_defaults1;
struct __pyx_defaults2;
typedef struct __pyx_defaults2 __pyx_defaults2;
struct __pyx_defaults3;
typedef struct __pyx_defaults3 __pyx_defaults3;
struct __pyx_defaults {
  PyObject *__pyx_arg_contact_points;
};
struct __pyx_defaults1 {
  PyObject *__pyx_arg_timeout;
};
struct __pyx_defaults2 {
  PyObject *__pyx_arg_timeout;
};
struct __pyx_defaults3 {
  PyObject *__pyx_arg_timeout;
};

/* "cassandra/cluster.py":149
 * 
 * 
 * def run_in_executor(f):             # <<<<<<<<<<<<<<
 *     """
 *     A decorator to run the given method in the ThreadPoolExecutor.
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor {
  PyObject_HEAD
  PyObject *__pyx_v_f;
};


/* "cassandra/cluster.py":1065
 *         self._start_reconnector(host, is_host_addition)
 * 
 *     def on_add(self, host, refresh_nodes=True):             # <<<<<<<<<<<<<<
 *         if self.is_shutdown:
 *             return
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add {
  PyObject_HEAD
  PyObject *__pyx_v_futures;
  PyObject *__pyx_v_futures_lock;
  PyObject *__pyx_v_futures_results;
  PyObject *__pyx_v_host;
  PyObject *__pyx_v_self;
};


/* "cassandra/cluster.py":1205
 *                 pool.ensure_core_connections()
 * 
 *     def _validate_refresh_schema(self, keyspace, table, usertype, function, aggregate):             # <<<<<<<<<<<<<<
 *         if any((table, usertype, function, aggregate)):
 *             if not keyspace:
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema {
  PyObject_HEAD
  PyObject *__pyx_v_function;
  PyObject *__pyx_v_table;
  PyObject *__pyx_v_usertype;
};


/* "cassandra/cluster.py":1209
 *             if not keyspace:
 *                 raise ValueError("keyspace is required to refresh specific sub-entity {table, usertype, function, aggregate}")
 *             if sum(1 for e in (table, usertype, function) if e) > 1:             # <<<<<<<<<<<<<<
 *                 raise ValueError("{table, usertype, function, aggregate} are mutually exclusive")
 * 
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr {
  PyObject_HEAD
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema *__pyx_outer_scope;
  PyObject *__pyx_v_e;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
};


/* "cassandra/cluster.py":1823
 *             pool.shutdown()
 * 
 *     def add_or_renew_pool(self, host, is_host_addition):             # <<<<<<<<<<<<<<
 *         """
 *         For internal use only.
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool {
  PyObject_HEAD
  PyObject *__pyx_v_distance;
  PyObject *__pyx_v_host;
  PyObject *__pyx_v_is_host_addition;
  PyObject *__pyx_v_self;
};


/* "cassandra/cluster.py":1894
 *                     pool.host_distance = distance
 * 
 *     def on_down(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the parent Cluster instance when a node is marked down.
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down {
  PyObject_HEAD
  PyObject *__pyx_v_self;
};


/* "cassandra/cluster.py":1914
 *         self.execute('USE %s' % (protect_name(keyspace),))
 * 
 *     def _set_keyspace_for_all_pools(self, keyspace, callback):             # <<<<<<<<<<<<<<
 *         """
 *         Asynchronously sets the keyspace on all pools.  When all
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools {
  PyObject_HEAD
  PyObject *__pyx_v_callback;
  PyObject *__pyx_v_errors;
  PyObject *__pyx_v_remaining_callbacks;
};


/* "cassandra/cluster.py":1941
 *             pool._set_keyspace_for_all_conns(keyspace, pool_finished_setting_keyspace)
 * 
 *     def user_type_registered(self, keyspace, user_type, klass):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the parent Cluster instance when the user registers a new
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered {
  PyObject_HEAD
  PyObject *__pyx_v_self;
  PyObject *__pyx_v_type_meta;
};


/* "cassandra/cluster.py":1959
 *                 'User type %s does not exist in keyspace %s' % (user_type, keyspace))
 * 
 *         def encode(val):             # <<<<<<<<<<<<<<
 *             return '{ %s }' % ' , '.join('%s : %s' % (
 *                 field_name,
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode {
  PyObject_HEAD
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered *__pyx_outer_scope;
  PyObject *__pyx_v_val;
};


/* "cassandra/cluster.py":1960
 * 
 *         def encode(val):
 *             return '{ %s }' % ' , '.join('%s : %s' % (             # <<<<<<<<<<<<<<
 *                 field_name,
 *                 self.encoder.cql_encode_all_types(getattr(val, field_name, None))
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr {
  PyObject_HEAD
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode *__pyx_outer_scope;
  PyObject *__pyx_v_field_name;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "cassandra/cluster.py":1972
 *             return self.cluster.executor.submit(fn, *args, **kwargs)
 * 
 *     def get_pool_state(self):             # <<<<<<<<<<<<<<
 *         return dict((host, pool.get_state()) for host, pool in self._pools.items())
 * 
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state {
  PyObject_HEAD
  PyObject *__pyx_v_self;
};


/* "cassandra/cluster.py":1973
 * 
 *     def get_pool_state(self):
 *         return dict((host, pool.get_state()) for host, pool in self._pools.items())             # <<<<<<<<<<<<<<
 * 
 *     def get_pools(self):
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr {
  PyObject_HEAD
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state *__pyx_outer_scope;
  PyObject *__pyx_v_host;
  PyObject *__pyx_v_pool;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "cassandra/cluster.py":2256
 *         return False
 * 
 *     def _refresh_schema(self, connection, keyspace=None, table=None, usertype=None, function=None,             # <<<<<<<<<<<<<<
 *                         aggregate=None, preloaded_results=None, schema_agreement_wait=None):
 *         if self._cluster.is_shutdown:
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema {
  PyObject_HEAD
  PyObject *__pyx_v_aggregate;
  PyObject *__pyx_v_function;
  PyObject *__pyx_v_table;
  PyObject *__pyx_v_usertype;
};


/* "cassandra/cluster.py":2261
 *             return False
 * 
 *         assert sum(1 for arg in (table, usertype, function, aggregate) if arg) <= 1             # <<<<<<<<<<<<<<
 * 
 *         agreed = self.wait_for_schema_agreement(connection,
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr {
  PyObject_HEAD
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *__pyx_outer_scope;
  PyObject *__pyx_v_arg;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
};


/* "cassandra/cluster.py":2308
 *             # user defined function within this keyspace changed
 *             where_clause = " WHERE keyspace_name = '%s' AND function_name = '%s' AND signature = [%s]" \
 *                            % (keyspace, function.name, ','.join("'%s'" % t for t in function.type_signature))             # <<<<<<<<<<<<<<
 *             functions_query = QueryMessage(query=self._SELECT_FUNCTIONS + where_clause, consistency_level=cl)
 *             functions_result = connection.wait_for_response(functions_query)
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr {
  PyObject_HEAD
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *__pyx_outer_scope;
  PyObject *__pyx_v_t;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "cassandra/cluster.py":2317
 *             # user defined aggregate within this keyspace changed
 *             where_clause = " WHERE keyspace_name = '%s' AND aggregate_name = '%s' AND signature = [%s]" \
 *                            % (keyspace, aggregate.name, ','.join("'%s'" % t for t in aggregate.type_signature))             # <<<<<<<<<<<<<<
 *             aggregates_query = QueryMessage(query=self._SELECT_AGGREGATES + where_clause, consistency_level=cl)
 *             aggregates_result = connection.wait_for_response(aggregates_query)
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr {
  PyObject_HEAD
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *__pyx_outer_scope;
  PyObject *__pyx_v_t;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "cassandra/cluster.py":2640
 *             return False
 * 
 *     def _get_schema_mismatches(self, peers_result, local_result, local_address):             # <<<<<<<<<<<<<<
 *         peers_result = dict_factory(*peers_result.results)
 * 
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches {
  PyObject_HEAD
  PyObject *__pyx_v_versions;
};


/* "cassandra/cluster.py":2666
 *             return None
 * 
 *         return dict((version, list(nodes)) for version, nodes in six.iteritems(versions))             # <<<<<<<<<<<<<<
 * 
 *     def _signal_error(self):
 */
struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr {
  PyObject_HEAD
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches *__pyx_outer_scope;
  PyObject *__pyx_v_nodes;
  PyObject *__pyx_v_version;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* --- Runtime support code (head) --- */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          if (acquire_gil) { \
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
              PyGILState_Release(__pyx_gilstate_save); \
          } else { \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext() \
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {                            \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_XDECREF(tmp);                              \
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {                             \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_DECREF(tmp);                               \
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name);

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
    const char* function_name);

#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb);
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);

static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

#define __Pyx_CyFunction_USED 1
#include <structmember.h>
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f) \
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f) \
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f) \
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code) \
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __Pyx_CyFunction_init(void);

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#define __Pyx_PyCallable_Check(obj)   ((obj)->ob_type->tp_call != NULL)
#else
#define __Pyx_PyCallable_Check(obj)   PyCallable_Check(obj)
#endif

static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
    PyObject *res;
    PyTypeObject *tp = Py_TYPE(obj);
#if PY_MAJOR_VERSION < 3
    if (unlikely(PyInstance_Check(obj)))
        return __Pyx_PyObject_GetAttrStr(obj, attr_name);
#endif
    res = _PyType_Lookup(tp, attr_name);
    if (likely(res)) {
        descrgetfunc f = Py_TYPE(res)->tp_descr_get;
        if (!f) {
            Py_INCREF(res);
        } else {
            res = f(res, obj, (PyObject *)tp);
        }
    } else {
        PyErr_SetObject(PyExc_AttributeError, attr_name);
    }
    return res;
}
#else
#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
#endif

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE int __Pyx_IterFinish(void);

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject* none = _PyList_Extend((PyListObject*)L, v);
    if (unlikely(!none))
        return -1;
    Py_DECREF(none);
    return 0;
#else
    return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
#endif
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);

static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);

#if PY_MAJOR_VERSION < 3
#define __Pyx_PyString_Join __Pyx_PyBytes_Join
#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
#else
#define __Pyx_PyString_Join PyUnicode_Join
#define __Pyx_PyBaseString_Join PyUnicode_Join
#endif
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION < 3
    #define __Pyx_PyBytes_Join _PyString_Join
    #else
    #define __Pyx_PyBytes_Join _PyBytes_Join
    #endif
#else
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
#endif

#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

#include <string.h>

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);

static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

typedef struct {
    int code_line;
    PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

#define __Pyx_Generator_USED
#include <structmember.h>
#include <frameobject.h>
typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *);
typedef struct {
    PyObject_HEAD
    __pyx_generator_body_t body;
    PyObject *closure;
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    int resume_label;
    char is_running;
} __pyx_GeneratorObject;
static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
                                                  PyObject *closure, PyObject *name, PyObject *qualname);
static int __pyx_Generator_init(void);
static int __Pyx_Generator_clear(PyObject* self);
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue)
#endif

static int __Pyx_check_binary_version(void);

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);


/* Module declarations from 'cassandra.cluster' */
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct__run_in_executor = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_1_on_add = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_3_genexpr = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_5_on_down = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_8_encode = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_9_genexpr = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_11_genexpr = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_13_genexpr = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_14_genexpr = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_15_genexpr = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches = 0;
static PyTypeObject *__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_17_genexpr = 0;
#define __Pyx_MODULE_NAME "cassandra.cluster"
int __pyx_module_is_main_cassandra__cluster = 0;

/* Implementation of 'cassandra.cluster' */
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_property;
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_all;
static PyObject *__pyx_builtin_any;
static PyObject *__pyx_builtin_sum;
static PyObject *__pyx_builtin_DeprecationWarning;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_ReferenceError;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_pf_9cassandra_7cluster__is_eventlet_monkey_patched(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_2_is_gevent_monkey_patched(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_15NoHostAvailable___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_errors); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_4_future_completed(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_future); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_15run_in_executor_new_f(PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_6run_in_executor(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_8_shutdown_cluster(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cluster); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_10default_lbp_factory(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_12default_lbp_factory(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_auth_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_2auth_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_96__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_4__init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_contact_points, PyObject *__pyx_v_port, PyObject *__pyx_v_compression, PyObject *__pyx_v_auth_provider, PyObject *__pyx_v_load_balancing_policy, PyObject *__pyx_v_reconnection_policy, PyObject *__pyx_v_default_retry_policy, PyObject *__pyx_v_conviction_policy_factory, PyObject *__pyx_v_metrics_enabled, PyObject *__pyx_v_connection_class, PyObject *__pyx_v_ssl_options, PyObject *__pyx_v_sockopts, PyObject *__pyx_v_cql_version, PyObject *__pyx_v_protocol_version, PyObject *__pyx_v_executor_threads, PyObject *__pyx_v_max_schema_agreement_wait, PyObject *__pyx_v_control_connection_timeout, PyObject *__pyx_v_idle_heartbeat_interval, PyObject *__pyx_v_schema_event_refresh_window, PyObject *__pyx_v_topology_event_refresh_window, PyObject *__pyx_v_connect_timeout); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_6register_user_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_user_type, PyObject *__pyx_v_klass); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_8get_min_requests_per_connection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_10set_min_requests_per_connection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance, PyObject *__pyx_v_min_requests); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_12get_max_requests_per_connection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_14set_max_requests_per_connection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance, PyObject *__pyx_v_max_requests); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_16get_core_connections_per_host(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_18set_core_connections_per_host(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance, PyObject *__pyx_v_core_connections); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_20get_max_connections_per_host(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_22set_max_connections_per_host(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance, PyObject *__pyx_v_max_connections); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_24connection_factory(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_address, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_26_make_connection_factory(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_28_make_connection_kwargs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_address, PyObject *__pyx_v_kwargs_dict); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_30protocol_downgrade(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_addr, PyObject *__pyx_v_previous_version); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_32connect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_34get_connection_holders(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_36shutdown(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_38_new_session(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_40_cleanup_failed_on_up_handling(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_42_on_up_future_completed(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_futures, PyObject *__pyx_v_results, PyObject *__pyx_v_lock, PyObject *__pyx_v_finished_future); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_44on_up(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_46_start_reconnector(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_is_host_addition); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_48on_down(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_is_host_addition, PyObject *__pyx_v_expect_host_to_be_down); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_6on_add_future_completed(PyObject *__pyx_self, PyObject *__pyx_v_future); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_50on_add(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_refresh_nodes); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_52_finalize_add(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_54on_remove(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_56signal_connection_failure(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_connection_exc, PyObject *__pyx_v_is_host_addition, PyObject *__pyx_v_expect_host_to_be_down); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_58add_host(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_address, PyObject *__pyx_v_datacenter, PyObject *__pyx_v_rack, PyObject *__pyx_v_signal, PyObject *__pyx_v_refresh_nodes); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_60remove_host(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_62register_listener(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_listener); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_64unregister_listener(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_listener); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_66listeners(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_68_ensure_core_connections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_24_validate_refresh_schema_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_70_validate_refresh_schema(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_table, PyObject *__pyx_v_usertype, PyObject *__pyx_v_function, PyObject *__pyx_v_aggregate); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_72refresh_schema(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_table, PyObject *__pyx_v_usertype, PyObject *__pyx_v_function, PyObject *__pyx_v_aggregate, PyObject *__pyx_v_max_schema_agreement_wait); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_74submit_schema_refresh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_table, PyObject *__pyx_v_usertype, PyObject *__pyx_v_function, PyObject *__pyx_v_aggregate); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_76refresh_schema_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_max_schema_agreement_wait); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_78refresh_keyspace_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_max_schema_agreement_wait); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_80refresh_table_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_table, PyObject *__pyx_v_max_schema_agreement_wait); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_82refresh_user_type_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_user_type, PyObject *__pyx_v_max_schema_agreement_wait); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_84refresh_user_function_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_function, PyObject *__pyx_v_max_schema_agreement_wait); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_86refresh_user_aggregate_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_aggregate, PyObject *__pyx_v_max_schema_agreement_wait); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_88refresh_nodes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_90set_meta_refresh_enabled(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_enabled); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_92_prepare_all_queries(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_94prepare_on_all_sessions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query_id, PyObject *__pyx_v_prepared_statement, PyObject *__pyx_v_excluded_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cluster, PyObject *__pyx_v_hosts); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_36__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_2execute(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query, PyObject *__pyx_v_parameters, PyObject *__pyx_v_timeout, PyObject *__pyx_v_trace, PyObject *__pyx_v_custom_payload); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_38__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_4execute_async(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query, PyObject *__pyx_v_parameters, PyObject *__pyx_v_trace, PyObject *__pyx_v_custom_payload, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_6_create_response_future(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query, PyObject *__pyx_v_parameters, PyObject *__pyx_v_trace, PyObject *__pyx_v_custom_payload, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_8prepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query, CYTHON_UNUSED PyObject *__pyx_v_custom_payload); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_10prepare_on_all_hosts(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query, PyObject *__pyx_v_excluded_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_12shutdown(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_17add_or_renew_pool_run_add_or_renew_pool(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_14add_or_renew_pool(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_is_host_addition); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_16remove_pool(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_18update_created_pools(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_20on_down(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_22on_remove(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_24set_keyspace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_27_set_keyspace_for_all_pools_pool_finished_setting_keyspace(PyObject *__pyx_self, PyObject *__pyx_v_pool, PyObject *__pyx_v_host_errors); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_26_set_keyspace_for_all_pools(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_callback); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_20user_type_registered_6encode_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_20user_type_registered_encode(PyObject *__pyx_self, PyObject *__pyx_v_val); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_28user_type_registered(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_user_type, PyObject *__pyx_v_klass); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_30submit(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fn, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_14get_pool_state_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_32get_pool_state(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_7Session_34get_pools(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_27_ControlReconnectionHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_control_connection, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_27_ControlReconnectionHandler_2try_reconnect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_27_ControlReconnectionHandler_4on_reconnection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_connection); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_27_ControlReconnectionHandler_6on_exception(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_exc, CYTHON_UNUSED PyObject *__pyx_v_next_delay); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14_watch_callback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj_weakref, PyObject *__pyx_v_method_name, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_16_clear_watcher(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_conn, CYTHON_UNUSED PyObject *__pyx_v_expiring_weakref); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cluster, PyObject *__pyx_v_timeout, PyObject *__pyx_v_schema_event_refresh_window, PyObject *__pyx_v_topology_event_refresh_window); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_2connect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_4_set_new_connection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_conn); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_6_reconnect_internal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_8_try_connect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_10reconnect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_12_reconnect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_14_get_and_set_reconnection_handler(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_new_handler); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_16_submit(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_18shutdown(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_20refresh_schema(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_table, PyObject *__pyx_v_usertype, PyObject *__pyx_v_function, PyObject *__pyx_v_aggregate, PyObject *__pyx_v_schema_agreement_wait); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema__handle_results(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_success, PyObject *__pyx_v_result); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema_2genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema_5genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema_8genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_22_refresh_schema(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_connection, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_table, PyObject *__pyx_v_usertype, PyObject *__pyx_v_function, PyObject *__pyx_v_aggregate, PyObject *__pyx_v_preloaded_results, PyObject *__pyx_v_schema_agreement_wait); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_24refresh_node_list_and_token_map(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_force_token_rebuild); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_26_refresh_node_list_and_token_map(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_connection, PyObject *__pyx_v_preloaded_results, PyObject *__pyx_v_force_token_rebuild); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_28_update_location_info(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_datacenter, PyObject *__pyx_v_rack); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_30_delay_for_event_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_event_type, PyObject *__pyx_v_delay_window); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_32_handle_topology_change(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_event); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_34_handle_status_change(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_event); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_36_handle_schema_change(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_event); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_38wait_for_schema_agreement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_connection, PyObject *__pyx_v_preloaded_results, PyObject *__pyx_v_wait_time); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_22_get_schema_mismatches_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_40_get_schema_mismatches(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_peers_result, PyObject *__pyx_v_local_result, PyObject *__pyx_v_local_address); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_42_signal_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_44on_up(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_46on_down(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_48on_add(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_host, PyObject *__pyx_v_refresh_nodes); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_50on_remove(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_host); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_52get_connections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_54return_connection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_connection); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_56set_meta_refresh_enabled(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_enabled); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_18_stop_scheduler(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_scheduler, PyObject *__pyx_v_thread); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_10_Scheduler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_executor); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_10_Scheduler_2shutdown(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_10_Scheduler_4schedule(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_delay, PyObject *__pyx_v_fn, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_10_Scheduler_6schedule_unique(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_delay, PyObject *__pyx_v_fn, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_10_Scheduler_8_insert_task(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_delay, PyObject *__pyx_v_task); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_10_Scheduler_10run(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_10_Scheduler_12_log_if_failed(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_future); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_20refresh_schema_and_set_result(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_table, PyObject *__pyx_v_usertype, PyObject *__pyx_v_function, PyObject *__pyx_v_aggregate, PyObject *__pyx_v_control_conn, PyObject *__pyx_v_response_future); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_session, PyObject *__pyx_v_message, PyObject *__pyx_v_query, PyObject *__pyx_v_timeout, PyObject *__pyx_v_metrics, PyObject *__pyx_v_prepared_statement); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_2_start_timer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_4_cancel_timer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_6_on_timeout(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_8_make_query_plan(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_10send_request(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_12_query(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_message, PyObject *__pyx_v_cb); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_14has_more_pages(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_16warnings(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_18custom_payload(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_20start_fetching_next_page(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_22_reprepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prepare_message); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_24_set_result(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_response); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_26_set_keyspace_completed(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_errors); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_28_execute_after_prepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_response); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_30_set_final_result(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_response); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_32_set_final_exception(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_response); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_34_retry(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_reuse_connection, PyObject *__pyx_v_consistency_level); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_36_retry_task(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_reuse_connection); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_52__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_38result(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_40get_query_trace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_max_wait); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_42add_callback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fn, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_44add_errback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fn, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_46add_callbacks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_errback, PyObject *__pyx_v_callback_args, PyObject *__pyx_v_callback_kwargs, PyObject *__pyx_v_errback_args, PyObject *__pyx_v_errback_kwargs); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_48clear_callbacks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_50__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_11PagedResult___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_response_future, PyObject *__pyx_v_initial_response); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_11PagedResult_2__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_9cassandra_7cluster_11PagedResult_4next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct__run_in_executor(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_1_on_add(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_5_on_down(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_8_encode(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_9_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_11_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_13_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_14_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_15_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_17_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_c[] = "c";
static char __pyx_k_e[] = "e";
static char __pyx_k_f[] = "f";
static char __pyx_k_i[] = "i";
static char __pyx_k_s[] = "{ %s }";
static char __pyx_k_t[] = "t";
static char __pyx_k_UP[] = "UP";
static char __pyx_k_cb[] = "cb";
static char __pyx_k_cl[] = "cl";
static char __pyx_k_fn[] = "fn";
static char __pyx_k_ONE[] = "ONE";
static char __pyx_k_PY2[] = "PY2";
static char __pyx_k__67[] = " , ";
static char __pyx_k__85[] = ",";
static char __pyx_k_add[] = "add";
static char __pyx_k_all[] = "all";
static char __pyx_k_any[] = "any";
static char __pyx_k_doc[] = "__doc__";
static char __pyx_k_exc[] = "exc";
static char __pyx_k_get[] = "get";
static char __pyx_k_hex[] = "hex";
static char __pyx_k_log[] = "log";
static char __pyx_k_msg[] = "msg";
static char __pyx_k_new[] = "new";
static char __pyx_k_now[] = "now";
static char __pyx_k_obj[] = "obj";
static char __pyx_k_old[] = "old";
static char __pyx_k_pop[] = "pop";
static char __pyx_k_ref[] = "ref";
static char __pyx_k_row[] = "row";
static char __pyx_k_run[] = "run";
static char __pyx_k_s_2[] = "'%s'";
static char __pyx_k_s_3[] = "s";
static char __pyx_k_s_s[] = "%s : %s";
static char __pyx_k_set[] = "set";
static char __pyx_k_six[] = "six";
static char __pyx_k_str[] = "__str__";
static char __pyx_k_sum[] = "sum";
static char __pyx_k_sys[] = "sys";
static char __pyx_k_val[] = "val";
static char __pyx_k_DOWN[] = "DOWN";
static char __pyx_k_Host[] = "Host";
static char __pyx_k_Lock[] = "Lock";
static char __pyx_k__101[] = "::";
static char __pyx_k__159[] = "";
static char __pyx_k__359[] = "_";
static char __pyx_k_addr[] = "addr";
static char __pyx_k_args[] = "args";
static char __pyx_k_bind[] = "bind";
static char __pyx_k_conn[] = "conn";
static char __pyx_k_copy[] = "copy";
static char __pyx_k_exit[] = "__exit__";
static char __pyx_k_host[] = "host";
static char __pyx_k_info[] = "info";
static char __pyx_k_init[] = "__init__";
static char __pyx_k_iter[] = "__iter__";
static char __pyx_k_join[] = "join";
static char __pyx_k_keys[] = "keys";
static char __pyx_k_kind[] = "kind";
static char __pyx_k_lock[] = "_lock";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_name[] = "name";
static char __pyx_k_next[] = "next";
static char __pyx_k_peer[] = "peer";
static char __pyx_k_pool[] = "pool";
static char __pyx_k_port[] = "port";
static char __pyx_k_rack[] = "rack";
static char __pyx_k_repr[] = "__repr__";
static char __pyx_k_self[] = "self";
static char __pyx_k_send[] = "send";
static char __pyx_k_stop[] = "stop";
static char __pyx_k_task[] = "task";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_time[] = "time";
static char __pyx_k_type[] = "type";
static char __pyx_k_utf8[] = "utf8";
static char __pyx_k_wait[] = "wait";
static char __pyx_k_warn[] = "warn";
static char __pyx_k_Empty[] = "Empty";
static char __pyx_k_Event[] = "Event";
static char __pyx_k_LOCAL[] = "LOCAL";
static char __pyx_k_Queue[] = "Queue";
static char __pyx_k_RETRY[] = "RETRY";
static char __pyx_k_RLock[] = "RLock";
static char __pyx_k_USE_s[] = "USE %s";
static char __pyx_k_block[] = "block";
static char __pyx_k_clear[] = "clear";
static char __pyx_k_close[] = "close";
static char __pyx_k_debug[] = "debug";
static char __pyx_k_delay[] = "delay";
static char __pyx_k_enter[] = "__enter__";
static char __pyx_k_error[] = "error";
static char __pyx_k_event[] = "event";
static char __pyx_k_hosts[] = "hosts";
static char __pyx_k_is_up[] = "is_up";
static char __pyx_k_items[] = "items";
static char __pyx_k_klass[] = "klass";
static char __pyx_k_new_f[] = "new_f";
static char __pyx_k_on_up[] = "on_up";
static char __pyx_k_pools[] = "_pools";
static char __pyx_k_proxy[] = "proxy";
static char __pyx_k_query[] = "query";
static char __pyx_k_queue[] = "_queue";
static char __pyx_k_range[] = "range";
static char __pyx_k_retry[] = "_retry";
static char __pyx_k_sleep[] = "sleep";
static char __pyx_k_start[] = "start";
static char __pyx_k_table[] = "table";
static char __pyx_k_throw[] = "throw";
static char __pyx_k_timer[] = "_timer";
static char __pyx_k_trace[] = "trace";
static char __pyx_k_utf_8[] = "utf-8";
static char __pyx_k_value[] = "value";
static char __pyx_k_wraps[] = "wraps";
static char __pyx_k_REMOTE[] = "REMOTE";
static char __pyx_k_Thread[] = "Thread";
static char __pyx_k_agreed[] = "agreed";
static char __pyx_k_append[] = "append";
static char __pyx_k_atexit[] = "atexit";
static char __pyx_k_cancel[] = "cancel";
static char __pyx_k_chunks[] = "chunks";
static char __pyx_k_daemon[] = "daemon";
static char __pyx_k_encode[] = "encode";
static char __pyx_k_errors[] = "errors";
static char __pyx_k_future[] = "future";
static char __pyx_k_gevent[] = "gevent";
static char __pyx_k_import[] = "__import__";
static char __pyx_k_is_set[] = "is_set";
static char __pyx_k_kwargs[] = "kwargs";
static char __pyx_k_lock_2[] = "lock";
static char __pyx_k_module[] = "__module__";
static char __pyx_k_name_2[] = "__name__";
static char __pyx_k_next_2[] = "__next__";
static char __pyx_k_object[] = "object";
static char __pyx_k_on_add[] = "on_add";
static char __pyx_k_random[] = "random";
static char __pyx_k_remove[] = "remove";
static char __pyx_k_req_id[] = "_req_id";
static char __pyx_k_result[] = "result";
static char __pyx_k_run_at[] = "run_at";
static char __pyx_k_set_up[] = "set_up";
static char __pyx_k_setter[] = "setter";
static char __pyx_k_signal[] = "signal";
static char __pyx_k_socket[] = "socket";
static char __pyx_k_submit[] = "submit";
static char __pyx_k_target[] = "target";
static char __pyx_k_thread[] = "thread";
static char __pyx_k_time_2[] = "_time";
static char __pyx_k_tokens[] = "tokens";
static char __pyx_k_values[] = "values";
static char __pyx_k_0_0_0_0[] = "0.0.0.0";
static char __pyx_k_CPython[] = "CPython";
static char __pyx_k_Cluster[] = "Cluster";
static char __pyx_k_Encoder[] = "Encoder";
static char __pyx_k_IGNORED[] = "IGNORED";
static char __pyx_k_Metrics[] = "Metrics";
static char __pyx_k_NOT_SET[] = "_NOT_SET";
static char __pyx_k_RETHROW[] = "RETHROW";
static char __pyx_k_Session[] = "Session";
static char __pyx_k_WeakSet[] = "WeakSet";
static char __pyx_k_address[] = "address";
static char __pyx_k_cluster[] = "cluster";
static char __pyx_k_connect[] = "connect";
static char __pyx_k_decoder[] = "decoder";
static char __pyx_k_defunct[] = "defunct";
static char __pyx_k_discard[] = "discard";
static char __pyx_k_elapsed[] = "elapsed";
static char __pyx_k_enabled[] = "enabled";
static char __pyx_k_encoder[] = "encoder";
static char __pyx_k_errback[] = "errback";
static char __pyx_k_event_2[] = "_event";
static char __pyx_k_execute[] = "execute";
static char __pyx_k_factory[] = "factory";
static char __pyx_k_futures[] = "futures";
static char __pyx_k_genexpr[] = "genexpr";
static char __pyx_k_groupby[] = "groupby";
static char __pyx_k_holders[] = "holders";
static char __pyx_k_is_down[] = "is_down";
static char __pyx_k_ks_meta[] = "ks_meta";
static char __pyx_k_logging[] = "logging";
static char __pyx_k_mapping[] = "mapping";
static char __pyx_k_message[] = "message";
static char __pyx_k_metrics[] = "metrics";
static char __pyx_k_modules[] = "modules";
static char __pyx_k_murmur3[] = "murmur3";
static char __pyx_k_on_down[] = "on_down";
static char __pyx_k_partial[] = "partial";
static char __pyx_k_patcher[] = "patcher";
static char __pyx_k_prepare[] = "__prepare__";
static char __pyx_k_queries[] = "queries";
static char __pyx_k_query_2[] = "_query";
static char __pyx_k_queue_2[] = "queue";
static char __pyx_k_results[] = "results";
static char __pyx_k_retry_2[] = "retry";
static char __pyx_k_run_now[] = "run_now";
static char __pyx_k_session[] = "session";
static char __pyx_k_success[] = "success";
static char __pyx_k_timeout[] = "timeout";
static char __pyx_k_tracing[] = "tracing";
static char __pyx_k_warning[] = "warning";
static char __pyx_k_weakref[] = "weakref";
static char __pyx_k_Internal[] = "\n    Internal\n    ";
static char __pyx_k_KeyError[] = "KeyError";
static char __pyx_k_Metadata[] = "Metadata";
static char __pyx_k_NEW_NODE[] = "NEW_NODE";
static char __pyx_k_UserType[] = "UserType";
static char __pyx_k_addValue[] = "addValue";
static char __pyx_k_add_host[] = "add_host";
static char __pyx_k_auth_exc[] = "auth_exc";
static char __pyx_k_callback[] = "callback";
static char __pyx_k_cf_query[] = "cf_query";
static char __pyx_k_conn_exc[] = "conn_exc";
static char __pyx_k_distance[] = "distance";
static char __pyx_k_errbacks[] = "_errbacks";
static char __pyx_k_errors_2[] = "_errors";
static char __pyx_k_eventlet[] = "eventlet";
static char __pyx_k_exc_info[] = "exc_info";
static char __pyx_k_executor[] = "executor";
static char __pyx_k_function[] = "function";
static char __pyx_k_get_host[] = "get_host";
static char __pyx_k_is_setup[] = "_is_setup";
static char __pyx_k_keyspace[] = "keyspace";
static char __pyx_k_ks_chunk[] = "ks_chunk";
static char __pyx_k_ks_query[] = "ks_query";
static char __pyx_k_listener[] = "listener";
static char __pyx_k_max_wait[] = "max_wait";
static char __pyx_k_messages[] = "messages";
static char __pyx_k_metadata[] = "metadata";
static char __pyx_k_new_pool[] = "new_pool";
static char __pyx_k_old_host[] = "old_host";
static char __pyx_k_on_retry[] = "on_retry";
static char __pyx_k_platform[] = "platform";
static char __pyx_k_populate[] = "populate";
static char __pyx_k_previous[] = "previous";
static char __pyx_k_property[] = "property";
static char __pyx_k_qualname[] = "__qualname__";
static char __pyx_k_query_id[] = "query_id";
static char __pyx_k_register[] = "register";
static char __pyx_k_req_id_2[] = "req_id";
static char __pyx_k_response[] = "response";
static char __pyx_k_schedule[] = "schedule";
static char __pyx_k_send_msg[] = "send_msg";
static char __pyx_k_sessions[] = "sessions";
static char __pyx_k_set_down[] = "set_down";
static char __pyx_k_shutdown[] = "shutdown";
static char __pyx_k_sockopts[] = "sockopts";
static char __pyx_k_submit_2[] = "_submit";
static char __pyx_k_trace_id[] = "trace_id";
static char __pyx_k_type_map[] = "type_map";
static char __pyx_k_udt_name[] = "udt_name";
static char __pyx_k_usertype[] = "usertype";
static char __pyx_k_versions[] = "versions";
static char __pyx_k_warnings[] = "warnings";
static char __pyx_k_127_0_0_1[] = "127.0.0.1";
static char __pyx_k_Exception[] = "Exception";
static char __pyx_k_Scheduler[] = "_Scheduler";
static char __pyx_k_Statement[] = "Statement";
static char __pyx_k_TypeError[] = "TypeError";
static char __pyx_k_aggregate[] = "aggregate";
static char __pyx_k_all_hosts[] = "all_hosts";
static char __pyx_k_callbacks[] = "_callbacks";
static char __pyx_k_cassandra[] = "cassandra";
static char __pyx_k_cf_result[] = "cf_result";
static char __pyx_k_cluster_2[] = "_cluster";
static char __pyx_k_col_query[] = "col_query";
static char __pyx_k_errback_2[] = "_errback";
static char __pyx_k_exception[] = "exception";
static char __pyx_k_functools[] = "functools";
static char __pyx_k_getLogger[] = "getLogger";
static char __pyx_k_get_pools[] = "get_pools";
static char __pyx_k_get_state[] = "get_state";
static char __pyx_k_host_addr[] = "host_addr";
static char __pyx_k_is_closed[] = "is_closed";
static char __pyx_k_iteritems[] = "iteritems";
static char __pyx_k_itertools[] = "itertools";
static char __pyx_k_keyspaces[] = "keyspaces";
static char __pyx_k_ks_result[] = "ks_result";
static char __pyx_k_listeners[] = "_listeners";
static char __pyx_k_local_row[] = "local_row";
static char __pyx_k_metaclass[] = "__metaclass__";
static char __pyx_k_metrics_2[] = "_metrics";
static char __pyx_k_next_time[] = "next_time";
static char __pyx_k_on_ignore[] = "on_ignore";
static char __pyx_k_on_remove[] = "on_remove";
static char __pyx_k_prepare_2[] = "prepare";
static char __pyx_k_reconnect[] = "_reconnect";
static char __pyx_k_reprepare[] = "_reprepare";
static char __pyx_k_responses[] = "responses";
static char __pyx_k_retry_num[] = "retry_num";
static char __pyx_k_scheduler[] = "scheduler";
static char __pyx_k_signature[] = "signature";
static char __pyx_k_six_moves[] = "six.moves";
static char __pyx_k_text_type[] = "text_type";
static char __pyx_k_this_time[] = "this_time";
static char __pyx_k_threading[] = "threading";
static char __pyx_k_timeout_2[] = "_timeout";
static char __pyx_k_timestamp[] = "timestamp";
static char __pyx_k_token_map[] = "token_map";
static char __pyx_k_type_meta[] = "type_meta";
static char __pyx_k_user_type[] = "user_type";
static char __pyx_k_wait_time[] = "wait_time";
static char __pyx_k_MOVED_NODE[] = "MOVED_NODE";
static char __pyx_k_QueryTrace[] = "QueryTrace";
static char __pyx_k_ValueError[] = "ValueError";
static char __pyx_k_batch_type[] = "batch_type";
static char __pyx_k_callback_2[] = "_callback";
static char __pyx_k_cf_success[] = "cf_success";
static char __pyx_k_col_result[] = "col_result";
static char __pyx_k_connection[] = "connection";
static char __pyx_k_datacenter[] = "datacenter";
static char __pyx_k_event_type[] = "event_type";
static char __pyx_k_executor_2[] = "_executor";
static char __pyx_k_fetch_size[] = "fetch_size";
static char __pyx_k_is_defunct[] = "is_defunct";
static char __pyx_k_ks_success[] = "ks_success";
static char __pyx_k_last_error[] = "last_error";
static char __pyx_k_local_rows[] = "local_rows";
static char __pyx_k_next_delay[] = "next_delay";
static char __pyx_k_on_timeout[] = "_on_timeout";
static char __pyx_k_parameters[] = "parameters";
static char __pyx_k_pk_indexes[] = "pk_indexes";
static char __pyx_k_put_nowait[] = "put_nowait";
static char __pyx_k_query_plan[] = "query_plan";
static char __pyx_k_request_id[] = "request_id";
static char __pyx_k_retry_task[] = "_retry_task";
static char __pyx_k_retry_type[] = "retry_type";
static char __pyx_k_schema_ver[] = "schema_ver";
static char __pyx_k_set_result[] = "_set_result";
static char __pyx_k_setdefault[] = "setdefault";
static char __pyx_k_start_time[] = "_start_time";
static char __pyx_k_statements[] = "statements";
static char __pyx_k_user_types[] = "_user_types";
static char __pyx_k_warnings_2[] = "_warnings";
static char __pyx_k_ImportError[] = "ImportError";
static char __pyx_k_PagedResult[] = "PagedResult";
static char __pyx_k_RetryPolicy[] = "RetryPolicy";
static char __pyx_k_add_errback[] = "add_errback";
static char __pyx_k_bind_params[] = "bind_params";
static char __pyx_k_change_type[] = "change_type";
static char __pyx_k_col_success[] = "col_success";
static char __pyx_k_collections[] = "collections";
static char __pyx_k_compression[] = "compression";
static char __pyx_k_consistency[] = "consistency";
static char __pyx_k_cql_version[] = "cql_version";
static char __pyx_k_data_center[] = "data_center";
static char __pyx_k_defaultdict[] = "defaultdict";
static char __pyx_k_field_names[] = "field_names";
static char __pyx_k_found_hosts[] = "found_hosts";
static char __pyx_k_have_future[] = "have_future";
static char __pyx_k_host_errors[] = "host_errors";
static char __pyx_k_insert_task[] = "_insert_task";
static char __pyx_k_is_shutdown[] = "is_shutdown";
static char __pyx_k_kwargs_dict[] = "kwargs_dict";
static char __pyx_k_listeners_2[] = "listeners";
static char __pyx_k_local_query[] = "local_query";
static char __pyx_k_max_workers[] = "max_workers";
static char __pyx_k_method_name[] = "method_name";
static char __pyx_k_new_handler[] = "new_handler";
static char __pyx_k_new_session[] = "_new_session";
static char __pyx_k_new_version[] = "new_version";
static char __pyx_k_obj_weakref[] = "obj_weakref";
static char __pyx_k_partitioner[] = "partitioner";
static char __pyx_k_peers_query[] = "peers_query";
static char __pyx_k_query_trace[] = "_query_trace";
static char __pyx_k_reconnect_2[] = "reconnect";
static char __pyx_k_reconnector[] = "reconnector";
static char __pyx_k_remove_host[] = "remove_host";
static char __pyx_k_remove_pool[] = "remove_pool";
static char __pyx_k_row_factory[] = "row_factory";
static char __pyx_k_rpc_address[] = "rpc_address";
static char __pyx_k_ssl_options[] = "ssl_options";
static char __pyx_k_start_timer[] = "_start_timer";
static char __pyx_k_try_connect[] = "_try_connect";
static char __pyx_k_types_query[] = "types_query";
static char __pyx_k_BatchMessage[] = "BatchMessage";
static char __pyx_k_ErrorMessage[] = "ErrorMessage";
static char __pyx_k_HostDistance[] = "HostDistance";
static char __pyx_k_QueryMessage[] = "QueryMessage";
static char __pyx_k_REMOVED_NODE[] = "REMOVED_NODE";
static char __pyx_k_SELECT_LOCAL[] = "_SELECT_LOCAL";
static char __pyx_k_SELECT_PEERS[] = "_SELECT_PEERS";
static char __pyx_k_Unauthorized[] = "Unauthorized";
static char __pyx_k_add_callback[] = "add_callback";
static char __pyx_k_cancel_timer[] = "_cancel_timer";
static char __pyx_k_cluster_name[] = "cluster_name";
static char __pyx_k_conn_factory[] = "conn_factory";
static char __pyx_k_connection_2[] = "_connection";
static char __pyx_k_control_conn[] = "control_conn";
static char __pyx_k_create_timer[] = "create_timer";
static char __pyx_k_current_host[] = "_current_host";
static char __pyx_k_current_pool[] = "_current_pool";
static char __pyx_k_delay_window[] = "delay_window";
static char __pyx_k_dict_factory[] = "dict_factory";
static char __pyx_k_errback_args[] = "errback_args";
static char __pyx_k_final_result[] = "_final_result";
static char __pyx_k_finalize_add[] = "_finalize_add";
static char __pyx_k_from_message[] = "from_message";
static char __pyx_k_futures_lock[] = "futures_lock";
static char __pyx_k_local_result[] = "local_result";
static char __pyx_k_max_requests[] = "max_requests";
static char __pyx_k_min_requests[] = "min_requests";
static char __pyx_k_new_schedule[] = "new_schedule";
static char __pyx_k_on_exception[] = "on_exception";
static char __pyx_k_paging_state[] = "_paging_state";
static char __pyx_k_peers_result[] = "peers_result";
static char __pyx_k_protect_name[] = "protect_name";
static char __pyx_k_query_string[] = "query_string";
static char __pyx_k_retry_policy[] = "retry_policy";
static char __pyx_k_self_weakref[] = "self_weakref";
static char __pyx_k_send_request[] = "send_request";
static char __pyx_k_set_keyspace[] = "set_keyspace";
static char __pyx_k_signal_error[] = "_signal_error";
static char __pyx_k_staticmethod[] = "staticmethod";
static char __pyx_k_string_types[] = "string_types";
static char __pyx_k_to_exception[] = "to_exception";
static char __pyx_k_types_result[] = "types_result";
static char __pyx_k_user_types_2[] = "user_types";
static char __pyx_k_where_clause[] = "where_clause";
static char __pyx_k_Cluster_on_up[] = "Cluster.on_up";
static char __pyx_k_PriorityQueue[] = "PriorityQueue";
static char __pyx_k_ResultMessage[] = "ResultMessage";
static char __pyx_k_SCHEMA_CHANGE[] = "SCHEMA_CHANGE";
static char __pyx_k_STATUS_CHANGE[] = "STATUS_CHANGE";
static char __pyx_k_Scheduler_run[] = "_Scheduler.run";
static char __pyx_k_StopIteration[] = "StopIteration";
static char __pyx_k_add_callbacks[] = "add_callbacks";
static char __pyx_k_auth_provider[] = "_auth_provider";
static char __pyx_k_authenticator[] = "authenticator";
static char __pyx_k_callback_args[] = "callback_args";
static char __pyx_k_callback_lock[] = "_callback_lock";
static char __pyx_k_clear_watcher[] = "_clear_watcher";
static char __pyx_k_excluded_host[] = "excluded_host";
static char __pyx_k_execute_async[] = "execute_async";
static char __pyx_k_fail_on_error[] = "fail_on_error";
static char __pyx_k_gevent_monkey[] = "gevent.monkey";
static char __pyx_k_gevent_socket[] = "gevent.socket";
static char __pyx_k_host_distance[] = "host_distance";
static char __pyx_k_is_shutdown_2[] = "_is_shutdown";
static char __pyx_k_ks_statements[] = "ks_statements";
static char __pyx_k_listener_lock[] = "_listener_lock";
static char __pyx_k_load_balancer[] = "_load_balancer";
static char __pyx_k_local_address[] = "local_address";
static char __pyx_k_log_if_failed[] = "_log_if_failed";
static char __pyx_k_no_result_yet[] = "(no result yet)";
static char __pyx_k_query_retries[] = "_query_retries";
static char __pyx_k_refresh_nodes[] = "refresh_nodes";
static char __pyx_k_request_timer[] = "request_timer";
static char __pyx_k_schema_change[] = "schema_change";
static char __pyx_k_status_change[] = "status_change";
static char __pyx_k_table_changed[] = "table_changed";
static char __pyx_k_total_timeout[] = "total_timeout";
static char __pyx_k_try_reconnect[] = "try_reconnect";
static char __pyx_k_types_success[] = "types_success";
static char __pyx_k_user_type_map[] = "user_type_map";
static char __pyx_k_AttributeError[] = "AttributeError";
static char __pyx_k_BatchStatement[] = "BatchStatement";
static char __pyx_k_BoundStatement[] = "BoundStatement";
static char __pyx_k_Cluster___init[] = "Cluster.__init__";
static char __pyx_k_Cluster_on_add[] = "Cluster.on_add";
static char __pyx_k_ExecuteMessage[] = "ExecuteMessage";
static char __pyx_k_HostConnection[] = "HostConnection";
static char __pyx_k_InvalidRequest[] = "InvalidRequest";
static char __pyx_k_PrepareMessage[] = "PrepareMessage";
static char __pyx_k_QueryExhausted[] = "QueryExhausted";
static char __pyx_k_ReferenceError[] = "ReferenceError";
static char __pyx_k_ResponseFuture[] = "ResponseFuture";
static char __pyx_k_SELECT_COLUMNS[] = "_SELECT_COLUMNS";
static char __pyx_k_Session___init[] = "Session.__init__";
static char __pyx_k_Session_submit[] = "Session.submit";
static char __pyx_k_Task_Scheduler[] = "Task Scheduler";
static char __pyx_k_cassandra_pool[] = "cassandra.pool";
static char __pyx_k_cassandra_util[] = "cassandra.util";
static char __pyx_k_connection_exc[] = "connection_exc";
static char __pyx_k_contact_points[] = "contact_points";
static char __pyx_k_custom_payload[] = "custom_payload";
static char __pyx_k_decode_message[] = "decode_message";
static char __pyx_k_encode_message[] = "encode_message";
static char __pyx_k_errback_kwargs[] = "errback_kwargs";
static char __pyx_k_get_pool_state[] = "get_pool_state";
static char __pyx_k_handle_results[] = "_handle_results";
static char __pyx_k_has_more_pages[] = "has_more_pages";
static char __pyx_k_idle_heartbeat[] = "_idle_heartbeat";
static char __pyx_k_max_trace_wait[] = "max_trace_wait";
static char __pyx_k_on_other_error[] = "on_other_error";
static char __pyx_k_on_unavailable[] = "on_unavailable";
static char __pyx_k_paging_state_2[] = "paging_state";
static char __pyx_k_rebuild_schema[] = "rebuild_schema";
static char __pyx_k_refresh_schema[] = "refresh_schema";
static char __pyx_k_schema_version[] = "schema_version";
static char __pyx_k_shared_results[] = "shared_results";
static char __pyx_k_stop_scheduler[] = "_stop_scheduler";
static char __pyx_k_triggers_query[] = "triggers_query";
static char __pyx_k_type_signature[] = "type_signature";
static char __pyx_k_watch_callback[] = "_watch_callback";
static char __pyx_k_Cluster_connect[] = "Cluster.connect";
static char __pyx_k_Cluster_on_down[] = "Cluster.on_down";
static char __pyx_k_LibevConnection[] = "LibevConnection";
static char __pyx_k_NoHostAvailable[] = "NoHostAvailable";
static char __pyx_k_ProtocolHandler[] = "ProtocolHandler";
static char __pyx_k_Removing_host_s[] = "Removing host %s";
static char __pyx_k_SELECT_TRIGGERS[] = "_SELECT_TRIGGERS";
static char __pyx_k_Session_execute[] = "Session.execute";
static char __pyx_k_Session_on_down[] = "Session.on_down";
static char __pyx_k_Session_prepare[] = "Session.prepare";
static char __pyx_k_SimpleStatement[] = "SimpleStatement";
static char __pyx_k_TOPOLOGY_CHANGE[] = "TOPOLOGY_CHANGE";
static char __pyx_k_auth_provider_2[] = "auth_provider";
static char __pyx_k_callback_kwargs[] = "callback_kwargs";
static char __pyx_k_cassandra_query[] = "cassandra.query";
static char __pyx_k_check_supported[] = "check_supported";
static char __pyx_k_clear_callbacks[] = "clear_callbacks";
static char __pyx_k_column_metadata[] = "column_metadata";
static char __pyx_k_connect_timeout[] = "connect_timeout";
static char __pyx_k_default_timeout[] = "default_timeout";
static char __pyx_k_evict_udt_class[] = "evict_udt_class";
static char __pyx_k_final_exception[] = "_final_exception";
static char __pyx_k_finished_future[] = "finished_future";
static char __pyx_k_functions_query[] = "functions_query";
static char __pyx_k_futures_results[] = "futures_results";
static char __pyx_k_get_connections[] = "get_connections";
static char __pyx_k_get_query_trace[] = "get_query_trace";
static char __pyx_k_make_query_plan[] = "make_query_plan";
static char __pyx_k_max_connections[] = "max_connections";
static char __pyx_k_metrics_enabled[] = "metrics_enabled";
static char __pyx_k_old_reconnector[] = "old_reconnector";
static char __pyx_k_on_read_timeout[] = "on_read_timeout";
static char __pyx_k_on_reconnection[] = "on_reconnection";
static char __pyx_k_prepare_message[] = "prepare_message";
static char __pyx_k_response_future[] = "response_future";
static char __pyx_k_run_in_executor[] = "run_in_executor";
static char __pyx_k_schedule_unique[] = "schedule_unique";
static char __pyx_k_scheduled_tasks[] = "_scheduled_tasks";
static char __pyx_k_startup_version[] = "startup_version";
static char __pyx_k_topology_change[] = "topology_change";
static char __pyx_k_trigger_success[] = "trigger_success";
static char __pyx_k_triggers_result[] = "triggers_result";
static char __pyx_k_Cluster_add_host[] = "Cluster.add_host";
static char __pyx_k_Cluster_shutdown[] = "Cluster.shutdown";
static char __pyx_k_ConsistencyLevel[] = "ConsistencyLevel";
static char __pyx_k_FETCH_SIZE_UNSET[] = "FETCH_SIZE_UNSET";
static char __pyx_k_GeventConnection[] = "GeventConnection";
static char __pyx_k_PagedResult_next[] = "PagedResult.next";
static char __pyx_k_Pool_is_shutdown[] = "Pool is shutdown";
static char __pyx_k_RESULT_KIND_ROWS[] = "RESULT_KIND_ROWS";
static char __pyx_k_SELECT_FUNCTIONS[] = "_SELECT_FUNCTIONS";
static char __pyx_k_SELECT_KEYSPACES[] = "_SELECT_KEYSPACES";
static char __pyx_k_SELECT_USERTYPES[] = "_SELECT_USERTYPES";
static char __pyx_k_Scheduler___init[] = "_Scheduler.__init__";
static char __pyx_k_Session_shutdown[] = "Session.shutdown";
static char __pyx_k_TokenAwarePolicy[] = "TokenAwarePolicy";
static char __pyx_k_aggregates_query[] = "aggregates_query";
static char __pyx_k_connection_class[] = "connection_class";
static char __pyx_k_core_connections[] = "core_connections";
static char __pyx_k_current_keyspace[] = "current_keyspace";
static char __pyx_k_current_response[] = "current_response";
static char __pyx_k_custom_payload_2[] = "_custom_payload";
static char __pyx_k_eventlet_patcher[] = "eventlet.patcher";
static char __pyx_k_executor_threads[] = "executor_threads";
static char __pyx_k_expiring_weakref[] = "expiring_weakref";
static char __pyx_k_function_changed[] = "function_changed";
static char __pyx_k_functions_result[] = "functions_result";
static char __pyx_k_future_completed[] = "_future_completed";
static char __pyx_k_initial_response[] = "initial_response";
static char __pyx_k_is_host_addition[] = "is_host_addition";
static char __pyx_k_keyspace_changed[] = "keyspace_changed";
static char __pyx_k_on_write_timeout[] = "on_write_timeout";
static char __pyx_k_previous_version[] = "previous_version";
static char __pyx_k_protocol_handler[] = "_protocol_handler";
static char __pyx_k_protocol_version[] = "protocol_version";
static char __pyx_k_refresh_schema_2[] = "_refresh_schema";
static char __pyx_k_register_timeout[] = "register_timeout";
static char __pyx_k_reuse_connection[] = "reuse_connection";
static char __pyx_k_set_final_result[] = "_set_final_result";
static char __pyx_k_shutdown_cluster[] = "_shutdown_cluster";
static char __pyx_k_triggers_success[] = "triggers_success";
static char __pyx_k_usertype_changed[] = "usertype_changed";
static char __pyx_k_Cluster_listeners[] = "Cluster.listeners";
static char __pyx_k_Cluster_on_remove[] = "Cluster.on_remove";
static char __pyx_k_ControlConnection[] = "ControlConnection";
static char __pyx_k_DefaultConnection[] = "DefaultConnection";
static char __pyx_k_OperationTimedOut[] = "OperationTimedOut";
static char __pyx_k_PreparedStatement[] = "PreparedStatement";
static char __pyx_k_SELECT_AGGREGATES[] = "_SELECT_AGGREGATES";
static char __pyx_k_Session_get_pools[] = "Session.get_pools";
static char __pyx_k_Session_on_remove[] = "Session.on_remove";
static char __pyx_k_add_done_callback[] = "add_done_callback";
static char __pyx_k_add_or_renew_pool[] = "add_or_renew_pool";
static char __pyx_k_aggregate_changed[] = "aggregate_changed";
static char __pyx_k_aggregates_result[] = "aggregates_result";
static char __pyx_k_borrow_connection[] = "borrow_connection";
static char __pyx_k_cassandra_cluster[] = "cassandra.cluster";
static char __pyx_k_cassandra_encoder[] = "cassandra.encoder";
static char __pyx_k_cassandra_metrics[] = "cassandra.metrics";
static char __pyx_k_consistency_level[] = "consistency_level";
static char __pyx_k_functions_success[] = "functions_success";
static char __pyx_k_is_monkey_patched[] = "is_monkey_patched";
static char __pyx_k_make_query_plan_2[] = "_make_query_plan";
static char __pyx_k_new_authenticator[] = "new_authenticator";
static char __pyx_k_preloaded_results[] = "preloaded_results";
static char __pyx_k_prepared_keyspace[] = "prepared_keyspace";
static char __pyx_k_rebuild_token_map[] = "rebuild_token_map";
static char __pyx_k_reconnection_lock[] = "_reconnection_lock";
static char __pyx_k_register_listener[] = "register_listener";
static char __pyx_k_register_watchers[] = "register_watchers";
static char __pyx_k_return_connection[] = "return_connection";
static char __pyx_k_schema_mismatches[] = "schema_mismatches";
static char __pyx_k_set_location_info[] = "set_location_info";
static char __pyx_k_start_reconnector[] = "_start_reconnector";
static char __pyx_k_wait_for_response[] = "wait_for_response";
static char __pyx_k_AsyncoreConnection[] = "AsyncoreConnection";
static char __pyx_k_ConnectionShutdown[] = "ConnectionShutdown";
static char __pyx_k_DeprecationWarning[] = "DeprecationWarning";
static char __pyx_k_EventletConnection[] = "EventletConnection";
static char __pyx_k_HostConnectionPool[] = "HostConnectionPool";
static char __pyx_k_PagedResult___init[] = "PagedResult.__init__";
static char __pyx_k_PagedResult___iter[] = "PagedResult.__iter__";
static char __pyx_k_Scheduler_schedule[] = "_Scheduler.schedule";
static char __pyx_k_Scheduler_shutdown[] = "_Scheduler.shutdown";
static char __pyx_k_ThreadPoolExecutor[] = "ThreadPoolExecutor";
static char __pyx_k_add_or_return_host[] = "add_or_return_host";
static char __pyx_k_aggregates_success[] = "aggregates_success";
static char __pyx_k_cassandra_cqltypes[] = "cassandra.cqltypes";
static char __pyx_k_cassandra_metadata[] = "cassandra.metadata";
static char __pyx_k_cassandra_policies[] = "cassandra.policies";
static char __pyx_k_cassandra_protocol[] = "cassandra.protocol";
static char __pyx_k_concurrent_futures[] = "concurrent.futures";
static char __pyx_k_connection_factory[] = "connection_factory";
static char __pyx_k_control_connection[] = "control_connection";
static char __pyx_k_default_fetch_size[] = "default_fetch_size";
static char __pyx_k_future_completed_2[] = "future_completed";
static char __pyx_k_initialize_reactor[] = "initialize_reactor";
static char __pyx_k_prepared_statement[] = "prepared_statement";
static char __pyx_k_protocol_downgrade[] = "protocol_downgrade";
static char __pyx_k_protocol_version_2[] = "_protocol_version";
static char __pyx_k_reconnect_internal[] = "_reconnect_internal";
static char __pyx_k_register_user_type[] = "register_user_type";
static char __pyx_k_set_new_connection[] = "_set_new_connection";
static char __pyx_k_wait_for_responses[] = "wait_for_responses";
static char __pyx_k_Cluster_remove_host[] = "Cluster.remove_host";
static char __pyx_k_ConnectionException[] = "ConnectionException";
static char __pyx_k_ConnectionHeartbeat[] = "ConnectionHeartbeat";
static char __pyx_k_ReconnectionHandler[] = "_ReconnectionHandler";
static char __pyx_k_SELECT_SCHEMA_LOCAL[] = "_SELECT_SCHEMA_LOCAL";
static char __pyx_k_SELECT_SCHEMA_PEERS[] = "_SELECT_SCHEMA_PEERS";
static char __pyx_k_Session_remove_pool[] = "Session.remove_pool";
static char __pyx_k_WeakValueDictionary[] = "WeakValueDictionary";
static char __pyx_k_default_lbp_factory[] = "default_lbp_factory";
static char __pyx_k_force_token_rebuild[] = "force_token_rebuild";
static char __pyx_k_named_tuple_factory[] = "named_tuple_factory";
static char __pyx_k_on_connection_error[] = "on_connection_error";
static char __pyx_k_prepare_all_queries[] = "_prepare_all_queries";
static char __pyx_k_prepared_statements[] = "_prepared_statements";
static char __pyx_k_reconnection_policy[] = "reconnection_policy";
static char __pyx_k_remaining_callbacks[] = "remaining_callbacks";
static char __pyx_k_set_final_exception[] = "_set_final_exception";
static char __pyx_k_unregister_listener[] = "unregister_listener";
static char __pyx_k_AuthenticationFailed[] = "AuthenticationFailed";
static char __pyx_k_Cluster__new_session[] = "Cluster._new_session";
static char __pyx_k_DEFAULT_MAX_REQUESTS[] = "DEFAULT_MAX_REQUESTS";
static char __pyx_k_DEFAULT_MIN_REQUESTS[] = "DEFAULT_MIN_REQUESTS";
static char __pyx_k_RESULT_KIND_PREPARED[] = "RESULT_KIND_PREPARED";
static char __pyx_k_ResponseFuture___str[] = "ResponseFuture.__str__";
static char __pyx_k_Session_set_keyspace[] = "Session.set_keyspace";
static char __pyx_k_UnsupportedOperation[] = "UnsupportedOperation";
static char __pyx_k_UserTypeDoesNotExist[] = "UserTypeDoesNotExist";
static char __pyx_k_cassandra_connection[] = "cassandra.connection";
static char __pyx_k_cql_encode_all_types[] = "cql_encode_all_types";
static char __pyx_k_default_retry_policy[] = "default_retry_policy";
static char __pyx_k_delay_for_event_type[] = "_delay_for_event_type";
static char __pyx_k_event_schedule_times[] = "_event_schedule_times";
static char __pyx_k_handle_schema_change[] = "_handle_schema_change";
static char __pyx_k_handle_status_change[] = "_handle_status_change";
static char __pyx_k_meta_refresh_enabled[] = "_meta_refresh_enabled";
static char __pyx_k_prepare_on_all_hosts[] = "prepare_on_all_hosts";
static char __pyx_k_reconnection_handler[] = "_reconnection_handler";
static char __pyx_k_update_created_pools[] = "update_created_pools";
static char __pyx_k_update_location_info[] = "_update_location_info";
static char __pyx_k_use_client_timestamp[] = "use_client_timestamp";
static char __pyx_k_user_type_registered[] = "user_type_registered";
static char __pyx_k_Cluster__finalize_add[] = "Cluster._finalize_add";
static char __pyx_k_Cluster_auth_provider[] = "Cluster.auth_provider";
static char __pyx_k_Cluster_refresh_nodes[] = "Cluster.refresh_nodes";
static char __pyx_k_Error_preparing_query[] = "Error preparing query:";
static char __pyx_k_Error_querying_host_s[] = "Error querying host %s";
static char __pyx_k_MIN_SUPPORTED_VERSION[] = "MIN_SUPPORTED_VERSION";
static char __pyx_k_PreparedQueryNotFound[] = "PreparedQueryNotFound";
static char __pyx_k_ResponseFuture___init[] = "ResponseFuture.__init__";
static char __pyx_k_ResponseFuture__query[] = "ResponseFuture._query";
static char __pyx_k_ResponseFuture__retry[] = "ResponseFuture._retry";
static char __pyx_k_ResponseFuture_result[] = "ResponseFuture.result";
static char __pyx_k_Session_execute_async[] = "Session.execute_async";
static char __pyx_k_WHERE_keyspace_name_s[] = " WHERE keyspace_name = '%s'";
static char __pyx_k_control_conn_disposed[] = "control_conn_disposed";
static char __pyx_k_execute_after_prepare[] = "_execute_after_prepare";
static char __pyx_k_get_schema_mismatches[] = "_get_schema_mismatches";
static char __pyx_k_is_control_connection[] = "is_control_connection";
static char __pyx_k_load_balancing_policy[] = "load_balancing_policy";
static char __pyx_k_python_implementation[] = "python_implementation";
static char __pyx_k_run_add_or_renew_pool[] = "run_add_or_renew_pool";
static char __pyx_k_schema_agreement_lock[] = "_schema_agreement_lock";
static char __pyx_k_schema_agreement_wait[] = "schema_agreement_wait";
static char __pyx_k_set_keyspace_blocking[] = "set_keyspace_blocking";
static char __pyx_k_submit_schema_refresh[] = "submit_schema_refresh";
static char __pyx_k_update_custom_payload[] = "update_custom_payload";
static char __pyx_k_Cluster_refresh_schema[] = "Cluster.refresh_schema";
static char __pyx_k_NoConnectionsAvailable[] = "NoConnectionsAvailable";
static char __pyx_k_NoHostAvailable___init[] = "NoHostAvailable.__init__";
static char __pyx_k_OverloadedErrorMessage[] = "OverloadedErrorMessage";
static char __pyx_k_SELECT_COLUMN_FAMILIES[] = "_SELECT_COLUMN_FAMILIES";
static char __pyx_k_Scheduler__insert_task[] = "_Scheduler._insert_task";
static char __pyx_k_Session_get_pool_state[] = "Session.get_pool_state";
static char __pyx_k_SimpleConvictionPolicy[] = "SimpleConvictionPolicy";
static char __pyx_k_auth_provider_callable[] = "_auth_provider_callable";
static char __pyx_k_create_response_future[] = "_create_response_future";
static char __pyx_k_expect_host_to_be_down[] = "expect_host_to_be_down";
static char __pyx_k_get_connection_holders[] = "get_connection_holders";
static char __pyx_k_handle_topology_change[] = "_handle_topology_change";
static char __pyx_k_make_connection_kwargs[] = "_make_connection_kwargs";
static char __pyx_k_on_up_future_completed[] = "_on_up_future_completed";
static char __pyx_k_refresh_table_metadata[] = "refresh_table_metadata";
static char __pyx_k_set_keyspace_completed[] = "_set_keyspace_completed";
static char __pyx_k_ControlConnection_on_up[] = "ControlConnection.on_up";
static char __pyx_k_DCAwareRoundRobinPolicy[] = "DCAwareRoundRobinPolicy";
static char __pyx_k_HostReconnectionHandler[] = "_HostReconnectionHandler";
static char __pyx_k_ReadTimeoutErrorMessage[] = "ReadTimeoutErrorMessage";
static char __pyx_k_ResponseFuture_warnings[] = "ResponseFuture.warnings";
static char __pyx_k_UnavailableErrorMessage[] = "UnavailableErrorMessage";
static char __pyx_k_client_protocol_handler[] = "client_protocol_handler";
static char __pyx_k_connect_to_remote_hosts[] = "connect_to_remote_hosts";
static char __pyx_k_ensure_core_connections[] = "_ensure_core_connections";
static char __pyx_k_idle_heartbeat_interval[] = "idle_heartbeat_interval";
static char __pyx_k_make_connection_factory[] = "_make_connection_factory";
static char __pyx_k_prepare_on_all_sessions[] = "prepare_on_all_sessions";
static char __pyx_k_prepared_statement_lock[] = "_prepared_statement_lock";
static char __pyx_k_refresh_schema_metadata[] = "refresh_schema_metadata";
static char __pyx_k_validate_refresh_schema[] = "_validate_refresh_schema";
static char __pyx_k_Cassandra_host_s_removed[] = "Cassandra host %s removed";
static char __pyx_k_ControlConnection___init[] = "ControlConnection.__init__";
static char __pyx_k_ControlConnection_on_add[] = "ControlConnection.on_add";
static char __pyx_k_Got_unexpected_message_r[] = "Got unexpected message: %r";
static char __pyx_k_RESULT_KIND_SET_KEYSPACE[] = "RESULT_KIND_SET_KEYSPACE";
static char __pyx_k_Scheduler__log_if_failed[] = "_Scheduler._log_if_failed";
static char __pyx_k_WriteTimeoutErrorMessage[] = "WriteTimeoutErrorMessage";
static char __pyx_k_is_gevent_monkey_patched[] = "_is_gevent_monkey_patched";
static char __pyx_k_max_connections_per_host[] = "_max_connections_per_host";
static char __pyx_k_serial_consistency_level[] = "serial_consistency_level";
static char __pyx_k_set_meta_refresh_enabled[] = "set_meta_refresh_enabled";
static char __pyx_k_should_rebuild_token_map[] = "should_rebuild_token_map";
static char __pyx_k_start_fetching_next_page[] = "start_fetching_next_page";
static char __pyx_k_Cluster_register_listener[] = "Cluster.register_listener";
static char __pyx_k_ControlConnection__submit[] = "ControlConnection._submit";
static char __pyx_k_ControlConnection_connect[] = "ControlConnection.connect";
static char __pyx_k_ControlConnection_on_down[] = "ControlConnection.on_down";
static char __pyx_k_RESULT_KIND_SCHEMA_CHANGE[] = "RESULT_KIND_SCHEMA_CHANGE";
static char __pyx_k_ResponseFuture__reprepare[] = "ResponseFuture._reprepare";
static char __pyx_k_Scheduler_schedule_unique[] = "_Scheduler.schedule_unique";
static char __pyx_k_Session_add_or_renew_pool[] = "Session.add_or_renew_pool";
static char __pyx_k_Session_prepare_line_1725[] = "Session.prepare (line 1725)";
static char __pyx_k_cassandra_io_libevreactor[] = "cassandra.io.libevreactor";
static char __pyx_k_conviction_policy_factory[] = "conviction_policy_factory";
static char __pyx_k_core_connections_per_host[] = "_core_connections_per_host";
static char __pyx_k_default_consistency_level[] = "default_consistency_level";
static char __pyx_k_ensure_core_connections_2[] = "ensure_core_connections";
static char __pyx_k_is_currently_reconnecting[] = "is_currently_reconnecting";
static char __pyx_k_max_schema_agreement_wait[] = "max_schema_agreement_wait";
static char __pyx_k_refresh_keyspace_metadata[] = "refresh_keyspace_metadata";
static char __pyx_k_signal_connection_failure[] = "signal_connection_failure";
static char __pyx_k_statements_and_parameters[] = "_statements_and_parameters";
static char __pyx_k_wait_for_schema_agreement[] = "wait_for_schema_agreement";
static char __pyx_k_Cluster__start_reconnector[] = "Cluster._start_reconnector";
static char __pyx_k_Cluster_connection_factory[] = "Cluster.connection_factory";
static char __pyx_k_Cluster_protocol_downgrade[] = "Cluster.protocol_downgrade";
static char __pyx_k_Cluster_register_user_type[] = "Cluster.register_user_type";
static char __pyx_k_ControlConnection_shutdown[] = "ControlConnection.shutdown";
static char __pyx_k_ControlReconnectionHandler[] = "_ControlReconnectionHandler";
static char __pyx_k_Control_connection_created[] = "Control connection created";
static char __pyx_k_ProtocolVersionUnsupported[] = "ProtocolVersionUnsupported";
static char __pyx_k_ResponseFuture__on_timeout[] = "ResponseFuture._on_timeout";
static char __pyx_k_ResponseFuture__retry_task[] = "ResponseFuture._retry_task";
static char __pyx_k_ResponseFuture__set_result[] = "ResponseFuture._set_result";
static char __pyx_k_ResponseFuture_add_errback[] = "ResponseFuture.add_errback";
static char __pyx_k_cassandra_io_geventreactor[] = "cassandra.io.geventreactor";
static char __pyx_k_control_connection_timeout[] = "control_connection_timeout";
static char __pyx_k_currently_handling_node_up[] = "_currently_handling_node_up";
static char __pyx_k_is_eventlet_monkey_patched[] = "_is_eventlet_monkey_patched";
static char __pyx_k_refresh_user_type_metadata[] = "refresh_user_type_metadata";
static char __pyx_k_set_keyspace_for_all_conns[] = "_set_keyspace_for_all_conns";
static char __pyx_k_set_keyspace_for_all_pools[] = "_set_keyspace_for_all_pools";
static char __pyx_k_Cluster_unregister_listener[] = "Cluster.unregister_listener";
static char __pyx_k_ControlConnection_on_remove[] = "ControlConnection.on_remove";
static char __pyx_k_ControlConnection_reconnect[] = "ControlConnection.reconnect";
static char __pyx_k_Host_s_has_been_marked_down[] = "Host %s has been marked down";
static char __pyx_k_IsBootstrappingErrorMessage[] = "IsBootstrappingErrorMessage";
static char __pyx_k_ResponseFuture__start_timer[] = "ResponseFuture._start_timer";
static char __pyx_k_ResponseFuture_add_callback[] = "ResponseFuture.add_callback";
static char __pyx_k_ResponseFuture_send_request[] = "ResponseFuture.send_request";
static char __pyx_k_Unable_to_fetch_query_trace[] = "Unable to fetch query trace:";
static char __pyx_k_max_requests_per_connection[] = "_max_requests_per_connection";
static char __pyx_k_min_requests_per_connection[] = "_min_requests_per_connection";
static char __pyx_k_schema_event_refresh_window[] = "schema_event_refresh_window";
static char __pyx_k_Cluster__prepare_all_queries[] = "Cluster._prepare_all_queries";
static char __pyx_k_Cluster_is_already_shut_down[] = "Cluster is already shut down";
static char __pyx_k_ControlConnection__reconnect[] = "ControlConnection._reconnect";
static char __pyx_k_Host_s_was_already_marked_up[] = "Host %s was already marked up";
static char __pyx_k_ResponseFuture__cancel_timer[] = "ResponseFuture._cancel_timer";
static char __pyx_k_ResponseFuture_add_callbacks[] = "ResponseFuture.add_callbacks";
static char __pyx_k_Session_prepare_on_all_hosts[] = "Session.prepare_on_all_hosts";
static char __pyx_k_Session_update_created_pools[] = "Session.update_created_pools";
static char __pyx_k_Session_user_type_registered[] = "Session.user_type_registered";
static char __pyx_k_cassandra_io_asyncorereactor[] = "cassandra.io.asyncorereactor";
static char __pyx_k_cassandra_io_eventletreactor[] = "cassandra.io.eventletreactor";
static char __pyx_k_get_max_connections_per_host[] = "get_max_connections_per_host";
static char __pyx_k_run_in_executor_locals_new_f[] = "run_in_executor.<locals>.new_f";
static char __pyx_k_set_max_connections_per_host[] = "set_max_connections_per_host";
static char __pyx_k_Cluster_submit_schema_refresh[] = "Cluster.submit_schema_refresh";
static char __pyx_k_ExponentialReconnectionPolicy[] = "ExponentialReconnectionPolicy";
static char __pyx_k_Removed_connection_pool_for_r[] = "Removed connection pool for %r";
static char __pyx_k_ResponseFuture_custom_payload[] = "ResponseFuture.custom_payload";
static char __pyx_k_ResponseFuture_has_more_pages[] = "ResponseFuture.has_more_pages";
static char __pyx_k_Session_on_down_locals_lambda[] = "Session.on_down.<locals>.<lambda>";
static char __pyx_k_cleanup_failed_on_up_handling[] = "_cleanup_failed_on_up_handling";
static char __pyx_k_get_core_connections_per_host[] = "get_core_connections_per_host";
static char __pyx_k_refresh_schema_and_set_result[] = "refresh_schema_and_set_result";
static char __pyx_k_schema_event_refresh_window_2[] = "_schema_event_refresh_window";
static char __pyx_k_set_core_connections_per_host[] = "set_core_connections_per_host";
static char __pyx_k_topology_event_refresh_window[] = "topology_event_refresh_window";
static char __pyx_k_An_iterator_over_the_rows_from[] = "\n    An iterator over the rows from a paged query result.  Whenever the number\n    of result rows for a query exceed the :attr:`~.query.Statement.fetch_size`\n    (or :attr:`~.Session.default_fetch_size`, if not set) an instance of this\n    class will be returned.\n\n    You can treat this as a normal iterator over rows::\n\n        >>> from cassandra.query import SimpleStatement\n        >>> statement = SimpleStatement(\"SELECT * FROM users\", fetch_size=10)\n        >>> for user_row in session.execute(statement):\n        ...     process_user(user_row)\n\n    Whenever there are no more rows in the current page, the next page will\n    be fetched transparently.  However, note that it *is* possible for\n    an :class:`Exception` to be raised while fetching the next page, just\n    like you might see on a normal call to ``session.execute()``.\n\n    .. versionadded: 2.0.0\n    ";
static char __pyx_k_Cluster_get_connection_holders[] = "Cluster.get_connection_holders";
static char __pyx_k_Cluster_refresh_table_metadata[] = "Cluster.refresh_table_metadata";
static char __pyx_k_ControlConnection__try_connect[] = "ControlConnection._try_connect";
static char __pyx_k_ControlReconnectionHandler_try[] = "_ControlReconnectionHandler.try_reconnect";
static char __pyx_k_Failed_to_run_task_on_executor[] = "Failed to run task on executor";
static char __pyx_k_ResponseFuture_clear_callbacks[] = "ResponseFuture.clear_callbacks";
static char __pyx_k_ResponseFuture_get_query_trace[] = "ResponseFuture.get_query_trace";
static char __pyx_k_ResponseFuture_query_s_request[] = "<ResponseFuture: query='%s' request_id=%s result=%s exception=%s host=%s>";
static char __pyx_k_WHERE_keyspace_name_s_AND_type[] = " WHERE keyspace_name = '%s' AND type_name = '%s'";
static char __pyx_k_control_connection_Closing_old[] = "[control connection] Closing old connection %r, replacing with %r";
static char __pyx_k_control_connection_Established[] = "[control connection] Established new connection %r, registering watchers and refreshing schema and topology";
static char __pyx_k_control_connection_Opening_new[] = "[control connection] Opening new connection to %s";
static char __pyx_k_control_connection_Waiting_for[] = "[control connection] Waiting for schema agreement";
static char __pyx_k_pool_finished_setting_keyspace[] = "pool_finished_setting_keyspace";
static char __pyx_k_refresh_user_function_metadata[] = "refresh_user_function_metadata";
static char __pyx_k_A_collection_of_connection_pool[] = "\n    A collection of connection pools for each host in the cluster.\n    Instances of this class should not be created directly, only\n    using :meth:`.Cluster.connect()`.\n\n    Queries and statements can be executed through ``Session`` instances\n    using the :meth:`~.Session.execute()` and :meth:`~.Session.execute_async()`\n    methods.\n\n    Example usage::\n\n        >>> session = cluster.connect()\n        >>> session.set_keyspace(\"mykeyspace\")\n        >>> session.execute(\"SELECT * FROM mycf\")\n\n    ";
static char __pyx_k_A_convenient_combination_of_met[] = "\n        A convenient combination of :meth:`.add_callback()` and\n        :meth:`.add_errback()`.\n\n        Example usage::\n\n            >>> session = cluster.connect()\n            >>> query = \"SELECT * FROM mycf\"\n            >>> future = session.execute_async(query)\n\n            >>> def log_results(results, level='debug'):\n            ...     for row in results:\n            ...         log.log(level, \"Result: %s\", row)\n\n            >>> def log_error(exc, query):\n            ...     log.error(\"Query '%s' failed: %s\", query, exc)\n\n            >>> future.add_callbacks(\n            ...     callback=log_results, callback_kwargs={'level': 'info'},\n            ...     errback=log_error, errback_args=(query,))\n\n        ";
static char __pyx_k_An_asynchronous_response_delive[] = "\n    An asynchronous response delivery mechanism that is returned from calls\n    to :meth:`.Session.execute_async()`.\n\n    There are two ways for results to be delivered:\n     - Synchronously, by calling :meth:`.result()`\n     - Asynchronously, by attaching callback and errback functions via\n       :meth:`.add_callback()`, :meth:`.add_errback()`, and\n       :meth:`.add_callbacks()`.\n    ";
static char __pyx_k_An_attempt_was_made_to_use_a_us[] = "\n    An attempt was made to use a user-defined type that does not exist.\n\n    .. versionadded:: 2.1.0\n    ";
static char __pyx_k_Attaches_a_callback_function_to[] = "\n        Attaches a callback function to be called when the final results arrive.\n\n        By default, `fn` will be called with the results as the first and only\n        argument.  If `*args` or `**kwargs` are supplied, they will be passed\n        through as additional positional or keyword arguments to `fn`.\n\n        If an error is hit while executing the operation, a callback attached\n        here will not be called.  Use :meth:`.add_errback()` or :meth:`add_callbacks()`\n        if you wish to handle that case.\n\n        If the final result has already been seen when this method is called,\n        the callback will be called immediately (before this method returns).\n\n        Note: in the case that the result is not available when the callback is added,\n        the callback is executed by IO event thread. This means that the callback\n        should not block or attempt further synchronous requests, because no further\n        IO will be processed until the callback returns.\n\n        **Important**: if the callback you attach results in an exception being\n        raised, **the exception will be ignored**, so please ensure your\n        callback handles all error cases that you care about.\n\n        Usage example::\n\n            >>> session = cluster.connect(\"mykeyspace\")\n\n            >>> def handle_results(rows, start_time, should_log=False):\n            ...     if should_log:\n            ...         log.info(\"Total time: %f\", time.time() - start_time)\n            ...     ...\n\n            >>> future = session.execute_async(\"SELECT * FROM users\")\n            >>> future.add_callback(handle_results, time.time(), should_log=True)\n\n        ";
static char __pyx_k_Cluster__make_connection_kwargs[] = "Cluster._make_connection_kwargs";
static char __pyx_k_Cluster__on_up_future_completed[] = "Cluster._on_up_future_completed";
static char __pyx_k_Cluster_get_max_connections_per[] = "Cluster.get_max_connections_per_host";
static char __pyx_k_Cluster_prepare_on_all_sessions[] = "Cluster.prepare_on_all_sessions";
static char __pyx_k_Cluster_refresh_schema_metadata[] = "Cluster.refresh_schema_metadata";
static char __pyx_k_Cluster_set_max_connections_per[] = "Cluster.set_max_connections_per_host() only has an effect when using protocol_version 1 or 2.";
static char __pyx_k_Connection_error_when_preparing[] = "Connection error when preparing statement on host %s: %s";
static char __pyx_k_ControlConnection__refresh_node[] = "ControlConnection._refresh_node_list_and_token_map";
static char __pyx_k_ControlConnection__signal_error[] = "ControlConnection._signal_error";
static char __pyx_k_ControlReconnectionHandler___in[] = "_ControlReconnectionHandler.__init__";
static char __pyx_k_ControlReconnectionHandler_on_e[] = "_ControlReconnectionHandler.on_exception";
static char __pyx_k_ControlReconnectionHandler_on_r[] = "_ControlReconnectionHandler.on_reconnection";
static char __pyx_k_Excluding_host_s_with_no_tokens[] = "Excluding host (%s) with no tokens in system.peers table of %s.";
static char __pyx_k_Execute_the_given_query_and_ret[] = "\n        Execute the given query and return a :class:`~.ResponseFuture` object\n        which callbacks may be attached to for asynchronous response\n        delivery.  You may also call :meth:`~.ResponseFuture.result()`\n        on the :class:`.ResponseFuture` to syncronously block for results at\n        any time.\n\n        If `trace` is set to :const:`True`, you may call\n        :meth:`.ResponseFuture.get_query_trace()` after the request\n        completes to retrieve a :class:`.QueryTrace` instance.\n\n        `custom_payload` is a :ref:`custom_payload` dict to be passed to the server.\n        If `query` is a Statement with its own custom_payload. The message payload\n        will be a union of the two, with the values specified here taking precedence.\n\n        If the server sends a custom payload in the response message,\n        the dict can be obtained following :meth:`.ResponseFuture.result` via\n        :attr:`.ResponseFuture.custom_payload`\n\n        Example usage::\n\n            >>> session = cluster.connect()\n            >>> future = session.execute_async(\"SELECT * FROM mycf\")\n\n            >>> def log_results(results):\n            ...     for row in results:\n            ...         log.info(\"Results: %s\", row)\n\n            >>> def log_error(exc):\n            >>>     log.error(\"Operation failed: %s\", exc)\n\n            >>> future.add_callbacks(log_results, log_error)\n\n        Async execution with blocking wait for results::\n\n            >>> future = session.execute_async(\"SELECT * FROM mycf\")\n            >>> # do other stuff...\n\n            >>> try:\n            ...     results = future.result()\n            ... except Exception:\n            ...     log.exception(\"Operation failed:\")\n\n        ";
static char __pyx_k_New_Cassandra_host_r_discovered[] = "New Cassandra host %r discovered";
static char __pyx_k_Node_list_was_not_refreshed_See[] = "Node list was not refreshed. See log for details.";
static char __pyx_k_Prepares_a_query_string_returni[] = "\n        Prepares a query string, returning a :class:`~cassandra.query.PreparedStatement`\n        instance which can be used as follows::\n\n            >>> session = cluster.connect(\"mykeyspace\")\n            >>> query = \"INSERT INTO users (id, name, age) VALUES (?, ?, ?)\"\n            >>> prepared = session.prepare(query)\n            >>> session.execute(prepared, (user.id, user.name, user.age))\n\n        Or you may bind values to the prepared statement ahead of time::\n\n            >>> prepared = session.prepare(query)\n            >>> bound_stmt = prepared.bind((user.id, user.name, user.age))\n            >>> session.execute(bound_stmt)\n\n        Of course, prepared statements may (and should) be reused::\n\n            >>> prepared = session.prepare(query)\n            >>> for user in users:\n            ...     bound = prepared.bind((user.id, user.name, user.age))\n            ...     session.execute(bound)\n\n        **Important**: PreparedStatements should be prepared only once.\n        Preparing the same query more than once will likely affect performance.\n\n        `custom_payload` is a key value map to be passed along with the prepare\n        message. See :ref:`custom_payload`.\n        ";
static char __pyx_k_Raised_when_an_operation_is_att[] = "\n    Raised when an operation is attempted but all connections are\n    busy, defunct, closed, or resulted in errors when used.\n    ";
static char __pyx_k_Raised_when_meth_ResponseFuture[] = "\n    Raised when :meth:`.ResponseFuture.start_fetching_next_page()` is called and\n    there are no more pages.  You can check :attr:`.ResponseFuture.has_more_pages`\n    before calling to avoid this.\n\n    .. versionadded:: 2.0.0\n    ";
static char __pyx_k_ResponseFuture__make_query_plan[] = "ResponseFuture._make_query_plan";
static char __pyx_k_ResponseFuture_result_line_3288[] = "ResponseFuture.result (line 3288)";
static char __pyx_k_Return_the_final_result_or_rais[] = "\n        Return the final result or raise an Exception if errors were\n        encountered.  If the final result or error has not been set\n        yet, this method will block until that time.\n\n        .. versionchanged:: 2.6.0\n\n        **`timeout` is deprecated. Use timeout in the Session execute functions instead.\n        The following description applies to deprecated behavior:**\n\n        You may set a timeout (in seconds) with the `timeout` parameter.\n        By default, the :attr:`~.default_timeout` for the :class:`.Session`\n        this was created through will be used for the timeout on this\n        operation.\n\n        This timeout applies to the entire request, including any retries\n        (decided internally by the :class:`.policies.RetryPolicy` used with\n        the request).\n\n        If the timeout is exceeded, an :exc:`cassandra.OperationTimedOut` will be raised.\n        This is a client-side timeout. For more information\n        about server-side coordinator timeouts, see :class:`.policies.RetryPolicy`.\n\n        Example usage::\n\n            >>> future = session.execute_async(\"SELECT * FROM mycf\")\n            >>> # do other stuff...\n\n            >>> try:\n            ...     rows = future.result()\n            ...     for row in rows:\n            ...         ... # process results\n            ... except Exception:\n            ...     log.exception(\"Operation failed:\")\n\n        ";
static char __pyx_k_SELECT_cluster_name_data_center[] = "SELECT cluster_name, data_center, rack, tokens, partitioner, schema_version FROM system.local WHERE key='local'";
static char __pyx_k_Session__create_response_future[] = "Session._create_response_future";
static char __pyx_k_Session_execute_async_line_1615[] = "Session.execute_async (line 1615)";
static char __pyx_k_Shutting_down_Cluster_Scheduler[] = "Shutting down Cluster Scheduler";
static char __pyx_k_Starting_reconnector_for_host_s[] = "Starting reconnector for host %s";
static char __pyx_k_Starting_to_handle_up_status_of[] = "Starting to handle up status of node %s";
static char __pyx_k_The_main_class_to_use_when_inte[] = "\n    The main class to use when interacting with a Cassandra cluster.\n    Typically, one instance of this class will be created for each\n    separate Cassandra cluster that your application interacts with.\n\n    Example usage::\n\n        >>> from cassandra.cluster import Cluster\n        >>> cluster = Cluster(['192.168.1.1', '192.168.1.2'])\n        >>> session = cluster.connect()\n        >>> session.execute(\"CREATE KEYSPACE ...\")\n        >>> ...\n        >>> cluster.shutdown()\n\n    ";
static char __pyx_k_This_module_houses_the_main_cla[] = "\nThis module houses the main classes you will interact with,\n:class:`.Cluster` and :class:`.Session`.\n";
static char __pyx_k_Timed_out_trying_to_prepare_all[] = "Timed out trying to prepare all statements on host %s: %s";
static char __pyx_k_Unexpected_failure_while_adding[] = "Unexpected failure while adding node %s, will not mark up:";
static char __pyx_k_User_Aggregate_metadata_was_not[] = "User Aggregate metadata was not refreshed. See log for details.";
static char __pyx_k_User_Type_serialization_is_only[] = "User Type serialization is only supported in native protocol version 3+ (%d in use). CQL encoding for simple statements will still work, but named tuples will be returned when reading type %s.%s.";
static char __pyx_k_Users_adamholmberg_git_python_m[] = "/Users/adamholmberg/git/python-master/cassandra/cluster.py";
static char __pyx_k_WHERE_keyspace_name_s_AND_aggre[] = " WHERE keyspace_name = '%s' AND aggregate_name = '%s' AND signature = [%s]";
static char __pyx_k_WHERE_keyspace_name_s_AND_colum[] = " WHERE keyspace_name = '%s' AND columnfamily_name = '%s'";
static char __pyx_k_WHERE_keyspace_name_s_AND_funct[] = " WHERE keyspace_name = '%s' AND function_name = '%s' AND signature = [%s]";
static char __pyx_k_control_connection_Aborting_wai[] = "[control connection] Aborting wait for schema match due to shutdown";
static char __pyx_k_control_connection_Attempting_t[] = "[control connection] Attempting to reconnect";
static char __pyx_k_control_connection_Control_conn[] = "[control connection] Control connection host (%s) is considered down, starting reconnection";
static char __pyx_k_control_connection_Error_connec[] = "[control connection] Error connecting to %s:";
static char __pyx_k_control_connection_Error_refres[] = "[control connection] Error refreshing schema";
static char __pyx_k_control_connection_Fetched_keys[] = "[control connection] Fetched keyspace info for %s, rebuilding metadata";
static char __pyx_k_control_connection_Fetched_sche[] = "[control connection] Fetched schema, rebuilding metadata";
static char __pyx_k_control_connection_Fetched_tabl[] = "[control connection] Fetched table info for %s.%s, rebuilding metadata";
static char __pyx_k_control_connection_Fetched_user[] = "[control connection] Fetched user type info for %s.%s, rebuilding metadata";
static char __pyx_k_control_connection_Finished_fet[] = "[control connection] Finished fetching ring info";
static char __pyx_k_control_connection_Found_host_t[] = "[control connection] Found host that has been removed: %r";
static char __pyx_k_control_connection_Found_new_ho[] = "[control connection] Found new host to connect to: %s";
static char __pyx_k_control_connection_Rebuilding_t[] = "[control connection] Rebuilding token map due to topology changes";
static char __pyx_k_control_connection_Refreshing_n[] = "[control connection] Refreshing node list and token map using preloaded results";
static char __pyx_k_control_connection_Schemas_matc[] = "[control connection] Schemas match";
static char __pyx_k_control_connection_Schemas_mism[] = "[control connection] Schemas mismatched, trying again";
static char __pyx_k_control_connection_Skipping_nod[] = "[control connection] Skipping node list refresh because meta refresh is disabled";
static char __pyx_k_control_connection_Skipping_sch[] = "[control connection] Skipping schema refresh because meta refresh is disabled";
static char __pyx_k_control_connection_Timed_out_wa[] = "[control connection] Timed out waiting for response during schema agreement check: %s";
static char __pyx_k_control_connection_error_reconn[] = "[control connection] error reconnecting";
static char __pyx_k_control_connection_this_version[] = "[control connection] this version of Cassandra does not allow access to schema_triggers metadata with authorization enabled (CASSANDRA-7967); The driver will operate normally, but will not reflect triggers in the local metadata model, or schema strings.";
static char __pyx_k_control_connection_triggers_tab[] = "[control connection] triggers table not found";
static char __pyx_k_control_connection_user_aggrega[] = "[control connection] user aggregates table not found";
static char __pyx_k_control_connection_user_functio[] = "[control connection] user functions table not found";
static char __pyx_k_control_connection_user_types_t[] = "[control connection] user types table not found";
static char __pyx_k_default_retry_policy_should_not[] = "default_retry_policy should not be a class, it should be an instance of that class";
static char __pyx_k_get_and_set_reconnection_handle[] = "_get_and_set_reconnection_handler";
static char __pyx_k_get_max_requests_per_connection[] = "get_max_requests_per_connection";
static char __pyx_k_get_min_requests_per_connection[] = "get_min_requests_per_connection";
static char __pyx_k_keyspace_is_required_to_refresh[] = "keyspace is required to refresh specific sub-entity {table, usertype, function, aggregate}";
static char __pyx_k_refresh_node_list_and_token_map[] = "refresh_node_list_and_token_map";
static char __pyx_k_refresh_user_aggregate_metadata[] = "refresh_user_aggregate_metadata";
static char __pyx_k_set_max_requests_per_connection[] = "set_max_requests_per_connection";
static char __pyx_k_set_min_requests_per_connection[] = "set_min_requests_per_connection";
static char __pyx_k_table_usertype_function_aggrega[] = "{table, usertype, function, aggregate} are mutually exclusive";
static char __pyx_k_topology_event_refresh_window_2[] = "_topology_event_refresh_window";
static char __pyx_k_Added_pool_for_host_s_to_session[] = "Added pool for host %s to session";
static char __pyx_k_All_connections_for_host_s_are_a[] = "All connections for host %s are at capacity, moving to the next host";
static char __pyx_k_All_futures_have_completed_for_a[] = "All futures have completed for added host %s";
static char __pyx_k_An_internally_scheduled_tasked_f[] = "An internally scheduled tasked failed with an unhandled exception:";
static char __pyx_k_Another_thread_is_already_handli[] = "Another thread is already handling up status of node %s";
static char __pyx_k_Attempting_to_open_new_connectio[] = "Attempting to open new connection pools for host %s";
static char __pyx_k_BatchStatement_execution_is_only[] = "BatchStatement execution is only supported with protocol version 2 or higher (supported in Cassandra 2.0 and higher).  Consider setting Cluster.protocol_version to 2 to support this operation.";
static char __pyx_k_Cannot_downgrade_protocol_versio[] = "Cannot downgrade protocol version (%d) below minimum supported version: %d";
static char __pyx_k_Cluster__cleanup_failed_on_up_ha[] = "Cluster._cleanup_failed_on_up_handling";
static char __pyx_k_Cluster__ensure_core_connections[] = "Cluster._ensure_core_connections";
static char __pyx_k_Cluster__make_connection_factory[] = "Cluster._make_connection_factory";
static char __pyx_k_Cluster__prepare_all_queries_loc[] = "Cluster._prepare_all_queries.<locals>.<lambda>";
static char __pyx_k_Cluster__validate_refresh_schema[] = "Cluster._validate_refresh_schema.<locals>.genexpr";
static char __pyx_k_Cluster_get_core_connections_per[] = "Cluster.get_core_connections_per_host";
static char __pyx_k_Cluster_get_max_requests_per_con[] = "Cluster.get_max_requests_per_connection";
static char __pyx_k_Cluster_get_min_requests_per_con[] = "Cluster.get_min_requests_per_connection";
static char __pyx_k_Cluster_on_add_locals_future_com[] = "Cluster.on_add.<locals>.future_completed";
static char __pyx_k_Cluster_refresh_keyspace_metadat[] = "Cluster.refresh_keyspace_metadata";
static char __pyx_k_Cluster_refresh_user_aggregate_m[] = "Cluster.refresh_user_aggregate_metadata";
static char __pyx_k_Cluster_refresh_user_function_me[] = "Cluster.refresh_user_function_metadata";
static char __pyx_k_Cluster_refresh_user_type_metada[] = "Cluster.refresh_user_type_metadata";
static char __pyx_k_Cluster_set_core_connections_per[] = "Cluster.set_core_connections_per_host() only has an effect when using protocol_version 1 or 2.";
static char __pyx_k_Cluster_set_max_requests_per_con[] = "Cluster.set_max_requests_per_connection() only has an effect when using protocol_version 1 or 2.";
static char __pyx_k_Cluster_set_meta_refresh_enabled[] = "Cluster.set_meta_refresh_enabled";
static char __pyx_k_Cluster_set_min_requests_per_con[] = "Cluster.set_min_requests_per_connection() only has an effect when using protocol_version 1 or 2.";
static char __pyx_k_Cluster_signal_connection_failur[] = "Cluster.signal_connection_failure";
static char __pyx_k_Connecting_to_cluster_contact_po[] = "Connecting to cluster, contact points: %s; protocol version: %s";
static char __pyx_k_Connection_pool_could_not_be_cre[] = "Connection pool could not be created, not marking node %s up";
static char __pyx_k_Connection_pools_established_for[] = "Connection pools established for node %s";
static char __pyx_k_ControlConnection__delay_for_eve[] = "ControlConnection._delay_for_event_type";
static char __pyx_k_ControlConnection__get_and_set_r[] = "ControlConnection._get_and_set_reconnection_handler";
static char __pyx_k_ControlConnection__get_schema_mi[] = "ControlConnection._get_schema_mismatches.<locals>.genexpr";
static char __pyx_k_ControlConnection__handle_schema[] = "ControlConnection._handle_schema_change";
static char __pyx_k_ControlConnection__handle_status[] = "ControlConnection._handle_status_change";
static char __pyx_k_ControlConnection__handle_topolo[] = "ControlConnection._handle_topology_change";
static char __pyx_k_ControlConnection__reconnect_int[] = "ControlConnection._reconnect_internal";
static char __pyx_k_ControlConnection__refresh_schem[] = "ControlConnection._refresh_schema.<locals>.genexpr";
static char __pyx_k_ControlConnection__set_new_conne[] = "ControlConnection._set_new_connection";
static char __pyx_k_ControlConnection__update_locati[] = "ControlConnection._update_location_info";
static char __pyx_k_ControlConnection_get_connection[] = "ControlConnection.get_connections";
static char __pyx_k_ControlConnection_refresh_node_l[] = "ControlConnection.refresh_node_list_and_token_map";
static char __pyx_k_ControlConnection_refresh_schema[] = "ControlConnection.refresh_schema";
static char __pyx_k_ControlConnection_return_connect[] = "ControlConnection.return_connection";
static char __pyx_k_ControlConnection_set_meta_refre[] = "ControlConnection.set_meta_refresh_enabled";
static char __pyx_k_ControlConnection_wait_for_schem[] = "ControlConnection.wait_for_schema_agreement";
static char __pyx_k_Control_connection_failed_to_con[] = "Control connection failed to connect, shutting down Cluster:";
static char __pyx_k_DEFAULT_MAX_CONNECTIONS_PER_LOCA[] = "DEFAULT_MAX_CONNECTIONS_PER_LOCAL_HOST";
static char __pyx_k_DEFAULT_MAX_CONNECTIONS_PER_REMO[] = "DEFAULT_MAX_CONNECTIONS_PER_REMOTE_HOST";
static char __pyx_k_DEFAULT_MIN_CONNECTIONS_PER_LOCA[] = "DEFAULT_MIN_CONNECTIONS_PER_LOCAL_HOST";
static char __pyx_k_DEFAULT_MIN_CONNECTIONS_PER_REMO[] = "DEFAULT_MIN_CONNECTIONS_PER_REMOTE_HOST";
static char __pyx_k_Done_preparing_all_known_prepare[] = "Done preparing all known prepared statements against host %s";
static char __pyx_k_Done_preparing_all_queries_for_h[] = "Done preparing all queries for host %s, ";
static char __pyx_k_Done_preparing_queries_for_new_h[] = "Done preparing queries for new host %r";
static char __pyx_k_Downgrading_core_protocol_versio[] = "Downgrading core protocol version from %d to %d for %s";
static char __pyx_k_Error_preparing_query_for_host_s[] = "Error preparing query for host %s:";
static char __pyx_k_Error_preparing_query_on_all_hos[] = "Error preparing query on all hosts:";
static char __pyx_k_Error_trying_to_prepare_all_stat[] = "Error trying to prepare all statements on host %s: %r";
static char __pyx_k_Error_trying_to_reconnect_contro[] = "Error trying to reconnect control connection: %r";
static char __pyx_k_Error_waiting_for_schema_agreeme[] = "Error waiting for schema agreement before preparing statements against host %s";
static char __pyx_k_Exception_refreshing_schema_in_r[] = "Exception refreshing schema in response to schema change:";
static char __pyx_k_Failed_to_create_connection_pool[] = "Failed to create connection pool for new host %s:";
static char __pyx_k_Failed_to_prepare_query_for_host[] = "Failed to prepare query for host %s: %r";
static char __pyx_k_Failed_to_set_keyspace_on_all_ho[] = "Failed to set keyspace on all hosts: %s";
static char __pyx_k_Failed_to_submit_task_to_executo[] = "Failed to submit task to executor";
static char __pyx_k_Got_different_query_ID_in_server[] = "Got different query ID in server response (%s) than we had before (%s)";
static char __pyx_k_Got_unexpected_response_type_whe[] = "Got unexpected response type when preparing statement on host %s: %s";
static char __pyx_k_Got_unexpected_response_when_pre[] = "Got unexpected response when preparing statement on host %s: %r";
static char __pyx_k_Handling_new_host_r_and_notifyin[] = "Handling new host %r and notifying listeners";
static char __pyx_k_Host_has_been_marked_down_or_rem[] = "Host has been marked down or removed";
static char __pyx_k_Host_s_is_overloaded_retrying_ag[] = "Host %s is overloaded, retrying against a different host";
static char __pyx_k_Host_s_may_be_up_will_prepare_qu[] = "Host %s may be up; will prepare queries and open connection pool";
static char __pyx_k_Ignoring_schedule_unique_for_alr[] = "Ignoring schedule_unique for already-scheduled task: %r";
static char __pyx_k_Ignoring_scheduled_task_after_sh[] = "Ignoring scheduled task after shutdown: %r";
static char __pyx_k_Keyspace_metadata_was_not_refres[] = "Keyspace metadata was not refreshed. See log for details.";
static char __pyx_k_Keyspace_s_does_not_exist_or_has[] = "Keyspace %s does not exist or has not been discovered by the driver";
static char __pyx_k_Node_s_is_reporting_a_schema_dis[] = "Node %s is reporting a schema disagreement: %s";
static char __pyx_k_Not_adding_connection_pool_for_n[] = "Not adding connection pool for new host %r because the load balancing policy has marked it as IGNORED";
static char __pyx_k_Not_executing_scheduled_task_due[] = "Not executing scheduled task due to Scheduler shutdown";
static char __pyx_k_Now_that_host_s_is_up_cancelling[] = "Now that host %s is up, cancelling the reconnection handler";
static char __pyx_k_Old_host_reconnector_found_for_s[] = "Old host reconnector found for %s, cancelling";
static char __pyx_k_Preparing_all_known_prepared_sta[] = "Preparing all known prepared statements against host %s";
static char __pyx_k_Re_preparing_unrecognized_prepar[] = "Re-preparing unrecognized prepared statement against host %s: %s";
static char __pyx_k_Refreshing_schema_in_response_to[] = "Refreshing schema in response to schema change. Keyspace: %s; Table: %s, Type: %s, Function: %s, Aggregate: %s";
static char __pyx_k_ResponseFuture__execute_after_pr[] = "ResponseFuture._execute_after_prepare";
static char __pyx_k_ResponseFuture__set_final_except[] = "ResponseFuture._set_final_exception";
static char __pyx_k_ResponseFuture__set_final_result[] = "ResponseFuture._set_final_result";
static char __pyx_k_ResponseFuture__set_keyspace_com[] = "ResponseFuture._set_keyspace_completed";
static char __pyx_k_ResponseFuture_add_callback_line[] = "ResponseFuture.add_callback (line 3359)";
static char __pyx_k_ResponseFuture_add_callbacks_lin[] = "ResponseFuture.add_callbacks (line 3422)";
static char __pyx_k_ResponseFuture_result_timeout_ar[] = "ResponseFuture.result timeout argument is deprecated. Specify the request timeout via Session.execute[_async].";
static char __pyx_k_ResponseFuture_start_fetching_ne[] = "ResponseFuture.start_fetching_next_page";
static char __pyx_k_SELECT_FROM_system_schema_aggreg[] = "SELECT * FROM system.schema_aggregates";
static char __pyx_k_SELECT_FROM_system_schema_column[] = "SELECT * FROM system.schema_columnfamilies";
static char __pyx_k_SELECT_FROM_system_schema_functi[] = "SELECT * FROM system.schema_functions";
static char __pyx_k_SELECT_FROM_system_schema_keyspa[] = "SELECT * FROM system.schema_keyspaces";
static char __pyx_k_SELECT_FROM_system_schema_trigge[] = "SELECT * FROM system.schema_triggers";
static char __pyx_k_SELECT_FROM_system_schema_userty[] = "SELECT * FROM system.schema_usertypes";
static char __pyx_k_SELECT_peer_data_center_rack_tok[] = "SELECT peer, data_center, rack, tokens, rpc_address, schema_version FROM system.peers";
static char __pyx_k_SELECT_peer_rpc_address_schema_v[] = "SELECT peer, rpc_address, schema_version FROM system.peers";
static char __pyx_k_SELECT_schema_version_FROM_syste[] = "SELECT schema_version FROM system.local WHERE key='local'";
static char __pyx_k_Schema_metadata_was_not_refreshe[] = "Schema metadata was not refreshed. See log for details.";
static char __pyx_k_Schema_was_not_refreshed_See_log[] = "Schema was not refreshed. See log for details.";
static char __pyx_k_Session__set_keyspace_for_all_po[] = "Session._set_keyspace_for_all_pools.<locals>.pool_finished_setting_keyspace";
static char __pyx_k_Session_add_or_renew_pool_locals[] = "Session.add_or_renew_pool.<locals>.run_add_or_renew_pool";
static char __pyx_k_Session_get_pool_state_locals_ge[] = "Session.get_pool_state.<locals>.genexpr";
static char __pyx_k_Session_user_type_registered_loc[] = "Session.user_type_registered.<locals>.encode.<locals>.genexpr";
static char __pyx_k_Shutting_down_control_connection[] = "Shutting down control connection";
static char __pyx_k_Signalling_to_control_connection[] = "Signalling to control connection that host %s is up";
static char __pyx_k_Signalling_to_load_balancing_pol[] = "Signalling to load balancing policy that host %s is up";
static char __pyx_k_Skipping_schema_refresh_due_to_l[] = "Skipping schema refresh due to lack of schema agreement";
static char __pyx_k_Skipping_schema_refresh_in_respo[] = "Skipping schema refresh in response to schema change because meta refresh is disabled; Keyspace: %s; Table: %s, Type: %s, Function: %s";
static char __pyx_k_Table_metadata_was_not_refreshed[] = "Table metadata was not refreshed. See log for details.";
static char __pyx_k_The_Session_s_current_keyspace_s[] = "The Session's current keyspace (%s) does not match the keyspace the statement was prepared with (%s)";
static char __pyx_k_The_query_argument_must_be_an_in[] = "The query argument must be an instance of a subclass of cassandra.query.Statement when trace=True";
static char __pyx_k_Tried_to_execute_unknown_prepare[] = "Tried to execute unknown prepared statement: id=%s";
static char __pyx_k_Unable_to_complete_the_operation[] = "Unable to complete the operation against any hosts";
static char __pyx_k_Unable_to_connect_to_any_servers[] = "Unable to connect to any servers";
static char __pyx_k_Unexpected_exception_while_handl[] = "Unexpected exception while handling result in ResponseFuture:";
static char __pyx_k_Unexpected_failure_handling_node[] = "Unexpected failure handling node %s being marked up:";
static char __pyx_k_Unexpected_failure_while_marking[] = "Unexpected failure while marking node %s up:";
static char __pyx_k_User_Function_metadata_was_not_r[] = "User Function metadata was not refreshed. See log for details.";
static char __pyx_k_User_Type_metadata_was_not_refre[] = "User Type metadata was not refreshed. See log for details.";
static char __pyx_k_User_type_s_does_not_exist_in_ke[] = "User type %s does not exist in keyspace %s";
static char __pyx_k_Waiting_to_acquire_lock_for_hand[] = "Waiting to acquire lock for handling up status of node %s";
static char __pyx_k_auth_provider_must_be_callable_w[] = "auth_provider must be callable when protocol_version == 1";
static char __pyx_k_auth_provider_must_implement_the[] = "auth_provider must implement the cassandra.auth.AuthProvider interface when protocol_version >= 2";
static char __pyx_k_contact_points_should_not_be_a_s[] = "contact_points should not be a string, it should be a sequence (e.g. list) of strings";
static char __pyx_k_conviction_policy_factory_must_b[] = "conviction_policy_factory must be callable";
static char __pyx_k_custom_payload_cannot_be_retriev[] = "custom_payload cannot be retrieved before ResponseFuture is finalized";
static char __pyx_k_get_and_set_reconnection_handler[] = "get_and_set_reconnection_handler";
static char __pyx_k_load_balancing_policy_should_not[] = "load_balancing_policy should not be a class, it should be an instance of that class";
static char __pyx_k_reconnection_policy_should_not_b[] = "reconnection_policy should not be a class, it should be an instance of that class";
static char __pyx_k_refresh_schema_is_deprecated_Use[] = "refresh_schema is deprecated. Use Cluster.refresh_*_metadata instead.";
static char __pyx_k_submit_schema_refresh_is_depreca[] = "submit_schema_refresh is deprecated. Use Cluster.refresh_*_metadata instead.";
static char __pyx_k_warnings_cannot_be_retrieved_bef[] = "warnings cannot be retrieved before ResponseFuture is finalized";
static char __pyx_k_Cluster_set_max_connections_per_2[] = "Cluster.set_max_connections_per_host";
static char __pyx_k_control_connection_Attempting_t_2[] = "[control connection] Attempting to use preloaded results for schema agreement";
static char __pyx_k_control_connection_Error_refres_2[] = "[control connection] Error refreshing node list and token map";
static char __pyx_k_control_connection_Fetched_user_2[] = "[control connection] Fetched user function info for %s.%s, rebuilding metadata";
static char __pyx_k_control_connection_Fetched_user_3[] = "[control connection] Fetched user aggregate info for %s.%s, rebuilding metadata";
static char __pyx_k_control_connection_Refreshing_n_2[] = "[control connection] Refreshing node list and token map";
static char __pyx_k_refresh_node_list_and_token_map_2[] = "_refresh_node_list_and_token_map";
static char __pyx_k_Cluster__validate_refresh_schema_2[] = "Cluster._validate_refresh_schema";
static char __pyx_k_Cluster_set_core_connections_per_2[] = "Cluster.set_core_connections_per_host";
static char __pyx_k_Cluster_set_max_requests_per_con_2[] = "Cluster.set_max_requests_per_connection";
static char __pyx_k_Cluster_set_min_requests_per_con_2[] = "Cluster.set_min_requests_per_connection";
static char __pyx_k_ControlConnection__get_schema_mi_2[] = "ControlConnection._get_schema_mismatches";
static char __pyx_k_ControlConnection__refresh_schem_2[] = "ControlConnection._refresh_schema.<locals>._handle_results";
static char __pyx_k_ControlConnection__refresh_schem_3[] = "ControlConnection._refresh_schema";
static char __pyx_k_Error_trying_to_prepare_all_stat_2[] = "Error trying to prepare all statements on host %s";
static char __pyx_k_Got_unexpected_response_when_pre_2[] = "Got unexpected response when preparing statement on host %s: %s";
static char __pyx_k_SELECT_FROM_system_schema_column_2[] = "SELECT * FROM system.schema_columns";
static char __pyx_k_Session__set_keyspace_for_all_po_2[] = "Session._set_keyspace_for_all_pools";
static char __pyx_k_Session_user_type_registered_loc_2[] = "Session.user_type_registered.<locals>.encode";
static PyObject *__pyx_kp_s_0_0_0_0;
static PyObject *__pyx_kp_s_127_0_0_1;
static PyObject *__pyx_kp_s_A_collection_of_connection_pool;
static PyObject *__pyx_kp_u_A_convenient_combination_of_met;
static PyObject *__pyx_kp_s_Added_pool_for_host_s_to_session;
static PyObject *__pyx_kp_s_All_connections_for_host_s_are_a;
static PyObject *__pyx_kp_s_All_futures_have_completed_for_a;
static PyObject *__pyx_kp_s_An_asynchronous_response_delive;
static PyObject *__pyx_kp_s_An_attempt_was_made_to_use_a_us;
static PyObject *__pyx_kp_s_An_internally_scheduled_tasked_f;
static PyObject *__pyx_kp_s_An_iterator_over_the_rows_from;
static PyObject *__pyx_kp_s_Another_thread_is_already_handli;
static PyObject *__pyx_n_s_AsyncoreConnection;
static PyObject *__pyx_kp_u_Attaches_a_callback_function_to;
static PyObject *__pyx_kp_s_Attempting_to_open_new_connectio;
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_n_s_AuthenticationFailed;
static PyObject *__pyx_n_s_BatchMessage;
static PyObject *__pyx_n_s_BatchStatement;
static PyObject *__pyx_kp_s_BatchStatement_execution_is_only;
static PyObject *__pyx_n_s_BoundStatement;
static PyObject *__pyx_n_s_CPython;
static PyObject *__pyx_kp_s_Cannot_downgrade_protocol_versio;
static PyObject *__pyx_kp_s_Cassandra_host_s_removed;
static PyObject *__pyx_n_s_Cluster;
static PyObject *__pyx_n_s_Cluster___init;
static PyObject *__pyx_n_s_Cluster__cleanup_failed_on_up_ha;
static PyObject *__pyx_n_s_Cluster__ensure_core_connections;
static PyObject *__pyx_n_s_Cluster__finalize_add;
static PyObject *__pyx_n_s_Cluster__make_connection_factory;
static PyObject *__pyx_n_s_Cluster__make_connection_kwargs;
static PyObject *__pyx_n_s_Cluster__new_session;
static PyObject *__pyx_n_s_Cluster__on_up_future_completed;
static PyObject *__pyx_n_s_Cluster__prepare_all_queries;
static PyObject *__pyx_n_s_Cluster__prepare_all_queries_loc;
static PyObject *__pyx_n_s_Cluster__start_reconnector;
static PyObject *__pyx_n_s_Cluster__validate_refresh_schema;
static PyObject *__pyx_n_s_Cluster__validate_refresh_schema_2;
static PyObject *__pyx_n_s_Cluster_add_host;
static PyObject *__pyx_n_s_Cluster_auth_provider;
static PyObject *__pyx_n_s_Cluster_connect;
static PyObject *__pyx_n_s_Cluster_connection_factory;
static PyObject *__pyx_n_s_Cluster_get_connection_holders;
static PyObject *__pyx_n_s_Cluster_get_core_connections_per;
static PyObject *__pyx_n_s_Cluster_get_max_connections_per;
static PyObject *__pyx_n_s_Cluster_get_max_requests_per_con;
static PyObject *__pyx_n_s_Cluster_get_min_requests_per_con;
static PyObject *__pyx_kp_s_Cluster_is_already_shut_down;
static PyObject *__pyx_n_s_Cluster_listeners;
static PyObject *__pyx_n_s_Cluster_on_add;
static PyObject *__pyx_n_s_Cluster_on_add_locals_future_com;
static PyObject *__pyx_n_s_Cluster_on_down;
static PyObject *__pyx_n_s_Cluster_on_remove;
static PyObject *__pyx_n_s_Cluster_on_up;
static PyObject *__pyx_n_s_Cluster_prepare_on_all_sessions;
static PyObject *__pyx_n_s_Cluster_protocol_downgrade;
static PyObject *__pyx_n_s_Cluster_refresh_keyspace_metadat;
static PyObject *__pyx_n_s_Cluster_refresh_nodes;
static PyObject *__pyx_n_s_Cluster_refresh_schema;
static PyObject *__pyx_n_s_Cluster_refresh_schema_metadata;
static PyObject *__pyx_n_s_Cluster_refresh_table_metadata;
static PyObject *__pyx_n_s_Cluster_refresh_user_aggregate_m;
static PyObject *__pyx_n_s_Cluster_refresh_user_function_me;
static PyObject *__pyx_n_s_Cluster_refresh_user_type_metada;
static PyObject *__pyx_n_s_Cluster_register_listener;
static PyObject *__pyx_n_s_Cluster_register_user_type;
static PyObject *__pyx_n_s_Cluster_remove_host;
static PyObject *__pyx_kp_s_Cluster_set_core_connections_per;
static PyObject *__pyx_n_s_Cluster_set_core_connections_per_2;
static PyObject *__pyx_kp_s_Cluster_set_max_connections_per;
static PyObject *__pyx_n_s_Cluster_set_max_connections_per_2;
static PyObject *__pyx_kp_s_Cluster_set_max_requests_per_con;
static PyObject *__pyx_n_s_Cluster_set_max_requests_per_con_2;
static PyObject *__pyx_n_s_Cluster_set_meta_refresh_enabled;
static PyObject *__pyx_kp_s_Cluster_set_min_requests_per_con;
static PyObject *__pyx_n_s_Cluster_set_min_requests_per_con_2;
static PyObject *__pyx_n_s_Cluster_shutdown;
static PyObject *__pyx_n_s_Cluster_signal_connection_failur;
static PyObject *__pyx_n_s_Cluster_submit_schema_refresh;
static PyObject *__pyx_n_s_Cluster_unregister_listener;
static PyObject *__pyx_kp_s_Connecting_to_cluster_contact_po;
static PyObject *__pyx_n_s_ConnectionException;
static PyObject *__pyx_n_s_ConnectionHeartbeat;
static PyObject *__pyx_n_s_ConnectionShutdown;
static PyObject *__pyx_kp_s_Connection_error_when_preparing;
static PyObject *__pyx_kp_s_Connection_pool_could_not_be_cre;
static PyObject *__pyx_kp_s_Connection_pools_established_for;
static PyObject *__pyx_n_s_ConsistencyLevel;
static PyObject *__pyx_n_s_ControlConnection;
static PyObject *__pyx_n_s_ControlConnection___init;
static PyObject *__pyx_n_s_ControlConnection__delay_for_eve;
static PyObject *__pyx_n_s_ControlConnection__get_and_set_r;
static PyObject *__pyx_n_s_ControlConnection__get_schema_mi;
static PyObject *__pyx_n_s_ControlConnection__get_schema_mi_2;
static PyObject *__pyx_n_s_ControlConnection__handle_schema;
static PyObject *__pyx_n_s_ControlConnection__handle_status;
static PyObject *__pyx_n_s_ControlConnection__handle_topolo;
static PyObject *__pyx_n_s_ControlConnection__reconnect;
static PyObject *__pyx_n_s_ControlConnection__reconnect_int;
static PyObject *__pyx_n_s_ControlConnection__refresh_node;
static PyObject *__pyx_n_s_ControlConnection__refresh_schem;
static PyObject *__pyx_n_s_ControlConnection__refresh_schem_2;
static PyObject *__pyx_n_s_ControlConnection__refresh_schem_3;
static PyObject *__pyx_n_s_ControlConnection__set_new_conne;
static PyObject *__pyx_n_s_ControlConnection__signal_error;
static PyObject *__pyx_n_s_ControlConnection__submit;
static PyObject *__pyx_n_s_ControlConnection__try_connect;
static PyObject *__pyx_n_s_ControlConnection__update_locati;
static PyObject *__pyx_n_s_ControlConnection_connect;
static PyObject *__pyx_n_s_ControlConnection_get_connection;
static PyObject *__pyx_n_s_ControlConnection_on_add;
static PyObject *__pyx_n_s_ControlConnection_on_down;
static PyObject *__pyx_n_s_ControlConnection_on_remove;
static PyObject *__pyx_n_s_ControlConnection_on_up;
static PyObject *__pyx_n_s_ControlConnection_reconnect;
static PyObject *__pyx_n_s_ControlConnection_refresh_node_l;
static PyObject *__pyx_n_s_ControlConnection_refresh_schema;
static PyObject *__pyx_n_s_ControlConnection_return_connect;
static PyObject *__pyx_n_s_ControlConnection_set_meta_refre;
static PyObject *__pyx_n_s_ControlConnection_shutdown;
static PyObject *__pyx_n_s_ControlConnection_wait_for_schem;
static PyObject *__pyx_n_s_ControlReconnectionHandler;
static PyObject *__pyx_n_s_ControlReconnectionHandler___in;
static PyObject *__pyx_n_s_ControlReconnectionHandler_on_e;
static PyObject *__pyx_n_s_ControlReconnectionHandler_on_r;
static PyObject *__pyx_n_s_ControlReconnectionHandler_try;
static PyObject *__pyx_kp_s_Control_connection_created;
static PyObject *__pyx_kp_s_Control_connection_failed_to_con;
static PyObject *__pyx_n_s_DCAwareRoundRobinPolicy;
static PyObject *__pyx_n_s_DEFAULT_MAX_CONNECTIONS_PER_LOCA;
static PyObject *__pyx_n_s_DEFAULT_MAX_CONNECTIONS_PER_REMO;
static PyObject *__pyx_n_s_DEFAULT_MAX_REQUESTS;
static PyObject *__pyx_n_s_DEFAULT_MIN_CONNECTIONS_PER_LOCA;
static PyObject *__pyx_n_s_DEFAULT_MIN_CONNECTIONS_PER_REMO;
static PyObject *__pyx_n_s_DEFAULT_MIN_REQUESTS;
static PyObject *__pyx_n_s_DOWN;
static PyObject *__pyx_n_s_DefaultConnection;
static PyObject *__pyx_n_s_DeprecationWarning;
static PyObject *__pyx_kp_s_Done_preparing_all_known_prepare;
static PyObject *__pyx_kp_s_Done_preparing_all_queries_for_h;
static PyObject *__pyx_kp_s_Done_preparing_queries_for_new_h;
static PyObject *__pyx_kp_s_Downgrading_core_protocol_versio;
static PyObject *__pyx_n_s_Empty;
static PyObject *__pyx_n_s_Encoder;
static PyObject *__pyx_n_s_ErrorMessage;
static PyObject *__pyx_kp_s_Error_preparing_query;
static PyObject *__pyx_kp_s_Error_preparing_query_for_host_s;
static PyObject *__pyx_kp_s_Error_preparing_query_on_all_hos;
static PyObject *__pyx_kp_s_Error_querying_host_s;
static PyObject *__pyx_kp_s_Error_trying_to_prepare_all_stat;
static PyObject *__pyx_kp_s_Error_trying_to_prepare_all_stat_2;
static PyObject *__pyx_kp_s_Error_trying_to_reconnect_contro;
static PyObject *__pyx_kp_s_Error_waiting_for_schema_agreeme;
static PyObject *__pyx_n_s_Event;
static PyObject *__pyx_n_s_EventletConnection;
static PyObject *__pyx_n_s_Exception;
static PyObject *__pyx_kp_s_Exception_refreshing_schema_in_r;
static PyObject *__pyx_kp_s_Excluding_host_s_with_no_tokens;
static PyObject *__pyx_n_s_ExecuteMessage;
static PyObject *__pyx_kp_u_Execute_the_given_query_and_ret;
static PyObject *__pyx_n_s_ExponentialReconnectionPolicy;
static PyObject *__pyx_n_s_FETCH_SIZE_UNSET;
static PyObject *__pyx_kp_s_Failed_to_create_connection_pool;
static PyObject *__pyx_kp_s_Failed_to_prepare_query_for_host;
static PyObject *__pyx_kp_s_Failed_to_run_task_on_executor;
static PyObject *__pyx_kp_s_Failed_to_set_keyspace_on_all_ho;
static PyObject *__pyx_kp_s_Failed_to_submit_task_to_executo;
static PyObject *__pyx_n_s_GeventConnection;
static PyObject *__pyx_kp_s_Got_different_query_ID_in_server;
static PyObject *__pyx_kp_s_Got_unexpected_message_r;
static PyObject *__pyx_kp_s_Got_unexpected_response_type_whe;
static PyObject *__pyx_kp_s_Got_unexpected_response_when_pre;
static PyObject *__pyx_kp_s_Got_unexpected_response_when_pre_2;
static PyObject *__pyx_kp_s_Handling_new_host_r_and_notifyin;
static PyObject *__pyx_n_s_Host;
static PyObject *__pyx_n_s_HostConnection;
static PyObject *__pyx_n_s_HostConnectionPool;
static PyObject *__pyx_n_s_HostDistance;
static PyObject *__pyx_n_s_HostReconnectionHandler;
static PyObject *__pyx_kp_s_Host_has_been_marked_down_or_rem;
static PyObject *__pyx_kp_s_Host_s_has_been_marked_down;
static PyObject *__pyx_kp_s_Host_s_is_overloaded_retrying_ag;
static PyObject *__pyx_kp_s_Host_s_may_be_up_will_prepare_qu;
static PyObject *__pyx_kp_s_Host_s_was_already_marked_up;
static PyObject *__pyx_n_s_IGNORED;
static PyObject *__pyx_kp_s_Ignoring_schedule_unique_for_alr;
static PyObject *__pyx_kp_s_Ignoring_scheduled_task_after_sh;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_kp_s_Internal;
static PyObject *__pyx_n_s_InvalidRequest;
static PyObject *__pyx_n_s_IsBootstrappingErrorMessage;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_kp_s_Keyspace_metadata_was_not_refres;
static PyObject *__pyx_kp_s_Keyspace_s_does_not_exist_or_has;
static PyObject *__pyx_n_s_LOCAL;
static PyObject *__pyx_n_s_LibevConnection;
static PyObject *__pyx_n_s_Lock;
static PyObject *__pyx_n_s_MIN_SUPPORTED_VERSION;
static PyObject *__pyx_n_s_MOVED_NODE;
static PyObject *__pyx_n_s_Metadata;
static PyObject *__pyx_n_s_Metrics;
static PyObject *__pyx_n_s_NEW_NODE;
static PyObject *__pyx_n_s_NOT_SET;
static PyObject *__pyx_kp_s_New_Cassandra_host_r_discovered;
static PyObject *__pyx_n_s_NoConnectionsAvailable;
static PyObject *__pyx_n_s_NoHostAvailable;
static PyObject *__pyx_n_s_NoHostAvailable___init;
static PyObject *__pyx_kp_s_Node_list_was_not_refreshed_See;
static PyObject *__pyx_kp_s_Node_s_is_reporting_a_schema_dis;
static PyObject *__pyx_kp_s_Not_adding_connection_pool_for_n;
static PyObject *__pyx_kp_s_Not_executing_scheduled_task_due;
static PyObject *__pyx_kp_s_Now_that_host_s_is_up_cancelling;
static PyObject *__pyx_n_s_ONE;
static PyObject *__pyx_kp_s_Old_host_reconnector_found_for_s;
static PyObject *__pyx_n_s_OperationTimedOut;
static PyObject *__pyx_n_s_OverloadedErrorMessage;
static PyObject *__pyx_n_s_PY2;
static PyObject *__pyx_n_s_PagedResult;
static PyObject *__pyx_n_s_PagedResult___init;
static PyObject *__pyx_n_s_PagedResult___iter;
static PyObject *__pyx_n_s_PagedResult_next;
static PyObject *__pyx_kp_s_Pool_is_shutdown;
static PyObject *__pyx_n_s_PrepareMessage;
static PyObject *__pyx_n_s_PreparedQueryNotFound;
static PyObject *__pyx_n_s_PreparedStatement;
static PyObject *__pyx_kp_u_Prepares_a_query_string_returni;
static PyObject *__pyx_kp_s_Preparing_all_known_prepared_sta;
static PyObject *__pyx_n_s_PriorityQueue;
static PyObject *__pyx_n_s_ProtocolHandler;
static PyObject *__pyx_n_s_ProtocolVersionUnsupported;
static PyObject *__pyx_n_s_QueryExhausted;
static PyObject *__pyx_n_s_QueryMessage;
static PyObject *__pyx_n_s_QueryTrace;
static PyObject *__pyx_n_s_Queue;
static PyObject *__pyx_n_s_REMOTE;
static PyObject *__pyx_n_s_REMOVED_NODE;
static PyObject *__pyx_n_s_RESULT_KIND_PREPARED;
static PyObject *__pyx_n_s_RESULT_KIND_ROWS;
static PyObject *__pyx_n_s_RESULT_KIND_SCHEMA_CHANGE;
static PyObject *__pyx_n_s_RESULT_KIND_SET_KEYSPACE;
static PyObject *__pyx_n_s_RETHROW;
static PyObject *__pyx_n_s_RETRY;
static PyObject *__pyx_n_s_RLock;
static PyObject *__pyx_kp_s_Raised_when_an_operation_is_att;
static PyObject *__pyx_kp_s_Raised_when_meth_ResponseFuture;
static PyObject *__pyx_kp_s_Re_preparing_unrecognized_prepar;
static PyObject *__pyx_n_s_ReadTimeoutErrorMessage;
static PyObject *__pyx_n_s_ReconnectionHandler;
static PyObject *__pyx_n_s_ReferenceError;
static PyObject *__pyx_kp_s_Refreshing_schema_in_response_to;
static PyObject *__pyx_kp_s_Removed_connection_pool_for_r;
static PyObject *__pyx_kp_s_Removing_host_s;
static PyObject *__pyx_n_s_ResponseFuture;
static PyObject *__pyx_n_s_ResponseFuture___init;
static PyObject *__pyx_n_s_ResponseFuture___str;
static PyObject *__pyx_n_s_ResponseFuture__cancel_timer;
static PyObject *__pyx_n_s_ResponseFuture__execute_after_pr;
static PyObject *__pyx_n_s_ResponseFuture__make_query_plan;
static PyObject *__pyx_n_s_ResponseFuture__on_timeout;
static PyObject *__pyx_n_s_ResponseFuture__query;
static PyObject *__pyx_n_s_ResponseFuture__reprepare;
static PyObject *__pyx_n_s_ResponseFuture__retry;
static PyObject *__pyx_n_s_ResponseFuture__retry_task;
static PyObject *__pyx_n_s_ResponseFuture__set_final_except;
static PyObject *__pyx_n_s_ResponseFuture__set_final_result;
static PyObject *__pyx_n_s_ResponseFuture__set_keyspace_com;
static PyObject *__pyx_n_s_ResponseFuture__set_result;
static PyObject *__pyx_n_s_ResponseFuture__start_timer;
static PyObject *__pyx_n_s_ResponseFuture_add_callback;
static PyObject *__pyx_kp_u_ResponseFuture_add_callback_line;
static PyObject *__pyx_n_s_ResponseFuture_add_callbacks;
static PyObject *__pyx_kp_u_ResponseFuture_add_callbacks_lin;
static PyObject *__pyx_n_s_ResponseFuture_add_errback;
static PyObject *__pyx_n_s_ResponseFuture_clear_callbacks;
static PyObject *__pyx_n_s_ResponseFuture_custom_payload;
static PyObject *__pyx_n_s_ResponseFuture_get_query_trace;
static PyObject *__pyx_n_s_ResponseFuture_has_more_pages;
static PyObject *__pyx_kp_s_ResponseFuture_query_s_request;
static PyObject *__pyx_n_s_ResponseFuture_result;
static PyObject *__pyx_kp_u_ResponseFuture_result_line_3288;
static PyObject *__pyx_kp_s_ResponseFuture_result_timeout_ar;
static PyObject *__pyx_n_s_ResponseFuture_send_request;
static PyObject *__pyx_n_s_ResponseFuture_start_fetching_ne;
static PyObject *__pyx_n_s_ResponseFuture_warnings;
static PyObject *__pyx_n_s_ResultMessage;
static PyObject *__pyx_n_s_RetryPolicy;
static PyObject *__pyx_kp_u_Return_the_final_result_or_rais;
static PyObject *__pyx_n_s_SCHEMA_CHANGE;
static PyObject *__pyx_n_s_SELECT_AGGREGATES;
static PyObject *__pyx_n_s_SELECT_COLUMNS;
static PyObject *__pyx_n_s_SELECT_COLUMN_FAMILIES;
static PyObject *__pyx_kp_s_SELECT_FROM_system_schema_aggreg;
static PyObject *__pyx_kp_s_SELECT_FROM_system_schema_column;
static PyObject *__pyx_kp_s_SELECT_FROM_system_schema_column_2;
static PyObject *__pyx_kp_s_SELECT_FROM_system_schema_functi;
static PyObject *__pyx_kp_s_SELECT_FROM_system_schema_keyspa;
static PyObject *__pyx_kp_s_SELECT_FROM_system_schema_trigge;
static PyObject *__pyx_kp_s_SELECT_FROM_system_schema_userty;
static PyObject *__pyx_n_s_SELECT_FUNCTIONS;
static PyObject *__pyx_n_s_SELECT_KEYSPACES;
static PyObject *__pyx_n_s_SELECT_LOCAL;
static PyObject *__pyx_n_s_SELECT_PEERS;
static PyObject *__pyx_n_s_SELECT_SCHEMA_LOCAL;
static PyObject *__pyx_n_s_SELECT_SCHEMA_PEERS;
static PyObject *__pyx_n_s_SELECT_TRIGGERS;
static PyObject *__pyx_n_s_SELECT_USERTYPES;
static PyObject *__pyx_kp_s_SELECT_cluster_name_data_center;
static PyObject *__pyx_kp_s_SELECT_peer_data_center_rack_tok;
static PyObject *__pyx_kp_s_SELECT_peer_rpc_address_schema_v;
static PyObject *__pyx_kp_s_SELECT_schema_version_FROM_syste;
static PyObject *__pyx_n_s_STATUS_CHANGE;
static PyObject *__pyx_n_s_Scheduler;
static PyObject *__pyx_n_s_Scheduler___init;
static PyObject *__pyx_n_s_Scheduler__insert_task;
static PyObject *__pyx_n_s_Scheduler__log_if_failed;
static PyObject *__pyx_n_s_Scheduler_run;
static PyObject *__pyx_n_s_Scheduler_schedule;
static PyObject *__pyx_n_s_Scheduler_schedule_unique;
static PyObject *__pyx_n_s_Scheduler_shutdown;
static PyObject *__pyx_kp_s_Schema_metadata_was_not_refreshe;
static PyObject *__pyx_kp_s_Schema_was_not_refreshed_See_log;
static PyObject *__pyx_n_s_Session;
static PyObject *__pyx_n_s_Session___init;
static PyObject *__pyx_n_s_Session__create_response_future;
static PyObject *__pyx_n_s_Session__set_keyspace_for_all_po;
static PyObject *__pyx_n_s_Session__set_keyspace_for_all_po_2;
static PyObject *__pyx_n_s_Session_add_or_renew_pool;
static PyObject *__pyx_n_s_Session_add_or_renew_pool_locals;
static PyObject *__pyx_n_s_Session_execute;
static PyObject *__pyx_n_s_Session_execute_async;
static PyObject *__pyx_kp_u_Session_execute_async_line_1615;
static PyObject *__pyx_n_s_Session_get_pool_state;
static PyObject *__pyx_n_s_Session_get_pool_state_locals_ge;
static PyObject *__pyx_n_s_Session_get_pools;
static PyObject *__pyx_n_s_Session_on_down;
static PyObject *__pyx_n_s_Session_on_down_locals_lambda;
static PyObject *__pyx_n_s_Session_on_remove;
static PyObject *__pyx_n_s_Session_prepare;
static PyObject *__pyx_kp_u_Session_prepare_line_1725;
static PyObject *__pyx_n_s_Session_prepare_on_all_hosts;
static PyObject *__pyx_n_s_Session_remove_pool;
static PyObject *__pyx_n_s_Session_set_keyspace;
static PyObject *__pyx_n_s_Session_shutdown;
static PyObject *__pyx_n_s_Session_submit;
static PyObject *__pyx_n_s_Session_update_created_pools;
static PyObject *__pyx_n_s_Session_user_type_registered;
static PyObject *__pyx_n_s_Session_user_type_registered_loc;
static PyObject *__pyx_n_s_Session_user_type_registered_loc_2;
static PyObject *__pyx_kp_s_Shutting_down_Cluster_Scheduler;
static PyObject *__pyx_kp_s_Shutting_down_control_connection;
static PyObject *__pyx_kp_s_Signalling_to_control_connection;
static PyObject *__pyx_kp_s_Signalling_to_load_balancing_pol;
static PyObject *__pyx_n_s_SimpleConvictionPolicy;
static PyObject *__pyx_n_s_SimpleStatement;
static PyObject *__pyx_kp_s_Skipping_schema_refresh_due_to_l;
static PyObject *__pyx_kp_s_Skipping_schema_refresh_in_respo;
static PyObject *__pyx_kp_s_Starting_reconnector_for_host_s;
static PyObject *__pyx_kp_s_Starting_to_handle_up_status_of;
static PyObject *__pyx_n_s_Statement;
static PyObject *__pyx_n_s_StopIteration;
static PyObject *__pyx_n_s_TOPOLOGY_CHANGE;
static PyObject *__pyx_kp_s_Table_metadata_was_not_refreshed;
static PyObject *__pyx_kp_s_Task_Scheduler;
static PyObject *__pyx_kp_s_The_Session_s_current_keyspace_s;
static PyObject *__pyx_kp_s_The_main_class_to_use_when_inte;
static PyObject *__pyx_kp_s_The_query_argument_must_be_an_in;
static PyObject *__pyx_n_s_Thread;
static PyObject *__pyx_n_s_ThreadPoolExecutor;
static PyObject *__pyx_kp_s_Timed_out_trying_to_prepare_all;
static PyObject *__pyx_n_s_TokenAwarePolicy;
static PyObject *__pyx_kp_s_Tried_to_execute_unknown_prepare;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_UP;
static PyObject *__pyx_kp_s_USE_s;
static PyObject *__pyx_kp_s_Unable_to_complete_the_operation;
static PyObject *__pyx_kp_s_Unable_to_connect_to_any_servers;
static PyObject *__pyx_kp_s_Unable_to_fetch_query_trace;
static PyObject *__pyx_n_s_Unauthorized;
static PyObject *__pyx_n_s_UnavailableErrorMessage;
static PyObject *__pyx_kp_s_Unexpected_exception_while_handl;
static PyObject *__pyx_kp_s_Unexpected_failure_handling_node;
static PyObject *__pyx_kp_s_Unexpected_failure_while_adding;
static PyObject *__pyx_kp_s_Unexpected_failure_while_marking;
static PyObject *__pyx_n_s_UnsupportedOperation;
static PyObject *__pyx_n_s_UserType;
static PyObject *__pyx_n_s_UserTypeDoesNotExist;
static PyObject *__pyx_kp_s_User_Aggregate_metadata_was_not;
static PyObject *__pyx_kp_s_User_Function_metadata_was_not_r;
static PyObject *__pyx_kp_s_User_Type_metadata_was_not_refre;
static PyObject *__pyx_kp_s_User_Type_serialization_is_only;
static PyObject *__pyx_kp_s_User_type_s_does_not_exist_in_ke;
static PyObject *__pyx_kp_s_Users_adamholmberg_git_python_m;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_kp_s_WHERE_keyspace_name_s;
static PyObject *__pyx_kp_s_WHERE_keyspace_name_s_AND_aggre;
static PyObject *__pyx_kp_s_WHERE_keyspace_name_s_AND_colum;
static PyObject *__pyx_kp_s_WHERE_keyspace_name_s_AND_funct;
static PyObject *__pyx_kp_s_WHERE_keyspace_name_s_AND_type;
static PyObject *__pyx_kp_s_Waiting_to_acquire_lock_for_hand;
static PyObject *__pyx_n_s_WeakSet;
static PyObject *__pyx_n_s_WeakValueDictionary;
static PyObject *__pyx_n_s_WriteTimeoutErrorMessage;
static PyObject *__pyx_kp_s__101;
static PyObject *__pyx_kp_s__159;
static PyObject *__pyx_n_s__359;
static PyObject *__pyx_kp_s__67;
static PyObject *__pyx_kp_s__85;
static PyObject *__pyx_n_s_add;
static PyObject *__pyx_n_s_addValue;
static PyObject *__pyx_n_s_add_callback;
static PyObject *__pyx_n_s_add_callbacks;
static PyObject *__pyx_n_s_add_done_callback;
static PyObject *__pyx_n_s_add_errback;
static PyObject *__pyx_n_s_add_host;
static PyObject *__pyx_n_s_add_or_renew_pool;
static PyObject *__pyx_n_s_add_or_return_host;
static PyObject *__pyx_n_s_addr;
static PyObject *__pyx_n_s_address;
static PyObject *__pyx_n_s_aggregate;
static PyObject *__pyx_n_s_aggregate_changed;
static PyObject *__pyx_n_s_aggregates_query;
static PyObject *__pyx_n_s_aggregates_result;
static PyObject *__pyx_n_s_aggregates_success;
static PyObject *__pyx_n_s_agreed;
static PyObject *__pyx_n_s_all;
static PyObject *__pyx_n_s_all_hosts;
static PyObject *__pyx_n_s_any;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_atexit;
static PyObject *__pyx_n_s_auth_exc;
static PyObject *__pyx_n_s_auth_provider;
static PyObject *__pyx_n_s_auth_provider_2;
static PyObject *__pyx_n_s_auth_provider_callable;
static PyObject *__pyx_kp_s_auth_provider_must_be_callable_w;
static PyObject *__pyx_kp_s_auth_provider_must_implement_the;
static PyObject *__pyx_n_s_authenticator;
static PyObject *__pyx_n_s_batch_type;
static PyObject *__pyx_n_s_bind;
static PyObject *__pyx_n_s_bind_params;
static PyObject *__pyx_n_s_block;
static PyObject *__pyx_n_s_borrow_connection;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_n_s_callback;
static PyObject *__pyx_n_s_callback_2;
static PyObject *__pyx_n_s_callback_args;
static PyObject *__pyx_n_s_callback_kwargs;
static PyObject *__pyx_n_s_callback_lock;
static PyObject *__pyx_n_s_callbacks;
static PyObject *__pyx_n_s_cancel;
static PyObject *__pyx_n_s_cancel_timer;
static PyObject *__pyx_n_s_cassandra;
static PyObject *__pyx_n_s_cassandra_cluster;
static PyObject *__pyx_n_s_cassandra_connection;
static PyObject *__pyx_n_s_cassandra_cqltypes;
static PyObject *__pyx_n_s_cassandra_encoder;
static PyObject *__pyx_n_s_cassandra_io_asyncorereactor;
static PyObject *__pyx_n_s_cassandra_io_eventletreactor;
static PyObject *__pyx_n_s_cassandra_io_geventreactor;
static PyObject *__pyx_n_s_cassandra_io_libevreactor;
static PyObject *__pyx_n_s_cassandra_metadata;
static PyObject *__pyx_n_s_cassandra_metrics;
static PyObject *__pyx_n_s_cassandra_policies;
static PyObject *__pyx_n_s_cassandra_pool;
static PyObject *__pyx_n_s_cassandra_protocol;
static PyObject *__pyx_n_s_cassandra_query;
static PyObject *__pyx_n_s_cassandra_util;
static PyObject *__pyx_n_s_cb;
static PyObject *__pyx_n_s_cf_query;
static PyObject *__pyx_n_s_cf_result;
static PyObject *__pyx_n_s_cf_success;
static PyObject *__pyx_n_s_change_type;
static PyObject *__pyx_n_s_check_supported;
static PyObject *__pyx_n_s_chunks;
static PyObject *__pyx_n_s_cl;
static PyObject *__pyx_n_s_cleanup_failed_on_up_handling;
static PyObject *__pyx_n_s_clear;
static PyObject *__pyx_n_s_clear_callbacks;
static PyObject *__pyx_n_s_clear_watcher;
static PyObject *__pyx_n_s_client_protocol_handler;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_cluster;
static PyObject *__pyx_n_s_cluster_2;
static PyObject *__pyx_n_s_cluster_name;
static PyObject *__pyx_n_s_col_query;
static PyObject *__pyx_n_s_col_result;
static PyObject *__pyx_n_s_col_success;
static PyObject *__pyx_n_s_collections;
static PyObject *__pyx_n_s_column_metadata;
static PyObject *__pyx_n_s_compression;
static PyObject *__pyx_n_s_concurrent_futures;
static PyObject *__pyx_n_s_conn;
static PyObject *__pyx_n_s_conn_exc;
static PyObject *__pyx_n_s_conn_factory;
static PyObject *__pyx_n_s_connect;
static PyObject *__pyx_n_s_connect_timeout;
static PyObject *__pyx_n_s_connect_to_remote_hosts;
static PyObject *__pyx_n_s_connection;
static PyObject *__pyx_n_s_connection_2;
static PyObject *__pyx_n_s_connection_class;
static PyObject *__pyx_n_s_connection_exc;
static PyObject *__pyx_n_s_connection_factory;
static PyObject *__pyx_n_s_consistency;
static PyObject *__pyx_n_s_consistency_level;
static PyObject *__pyx_n_s_contact_points;
static PyObject *__pyx_kp_s_contact_points_should_not_be_a_s;
static PyObject *__pyx_n_s_control_conn;
static PyObject *__pyx_n_s_control_conn_disposed;
static PyObject *__pyx_n_s_control_connection;
static PyObject *__pyx_kp_s_control_connection_Aborting_wai;
static PyObject *__pyx_kp_s_control_connection_Attempting_t;
static PyObject *__pyx_kp_s_control_connection_Attempting_t_2;
static PyObject *__pyx_kp_s_control_connection_Closing_old;
static PyObject *__pyx_kp_s_control_connection_Control_conn;
static PyObject *__pyx_kp_s_control_connection_Error_connec;
static PyObject *__pyx_kp_s_control_connection_Error_refres;
static PyObject *__pyx_kp_s_control_connection_Error_refres_2;
static PyObject *__pyx_kp_s_control_connection_Established;
static PyObject *__pyx_kp_s_control_connection_Fetched_keys;
static PyObject *__pyx_kp_s_control_connection_Fetched_sche;
static PyObject *__pyx_kp_s_control_connection_Fetched_tabl;
static PyObject *__pyx_kp_s_control_connection_Fetched_user;
static PyObject *__pyx_kp_s_control_connection_Fetched_user_2;
static PyObject *__pyx_kp_s_control_connection_Fetched_user_3;
static PyObject *__pyx_kp_s_control_connection_Finished_fet;
static PyObject *__pyx_kp_s_control_connection_Found_host_t;
static PyObject *__pyx_kp_s_control_connection_Found_new_ho;
static PyObject *__pyx_kp_s_control_connection_Opening_new;
static PyObject *__pyx_kp_s_control_connection_Rebuilding_t;
static PyObject *__pyx_kp_s_control_connection_Refreshing_n;
static PyObject *__pyx_kp_s_control_connection_Refreshing_n_2;
static PyObject *__pyx_kp_s_control_connection_Schemas_matc;
static PyObject *__pyx_kp_s_control_connection_Schemas_mism;
static PyObject *__pyx_kp_s_control_connection_Skipping_nod;
static PyObject *__pyx_kp_s_control_connection_Skipping_sch;
static PyObject *__pyx_kp_s_control_connection_Timed_out_wa;
static PyObject *__pyx_kp_s_control_connection_Waiting_for;
static PyObject *__pyx_kp_s_control_connection_error_reconn;
static PyObject *__pyx_kp_s_control_connection_this_version;
static PyObject *__pyx_n_s_control_connection_timeout;
static PyObject *__pyx_kp_s_control_connection_triggers_tab;
static PyObject *__pyx_kp_s_control_connection_user_aggrega;
static PyObject *__pyx_kp_s_control_connection_user_functio;
static PyObject *__pyx_kp_s_control_connection_user_types_t;
static PyObject *__pyx_n_s_conviction_policy_factory;
static PyObject *__pyx_kp_s_conviction_policy_factory_must_b;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_n_s_core_connections;
static PyObject *__pyx_n_s_core_connections_per_host;
static PyObject *__pyx_n_s_cql_encode_all_types;
static PyObject *__pyx_n_s_cql_version;
static PyObject *__pyx_n_s_create_response_future;
static PyObject *__pyx_n_s_create_timer;
static PyObject *__pyx_n_s_current_host;
static PyObject *__pyx_n_s_current_keyspace;
static PyObject *__pyx_n_s_current_pool;
static PyObject *__pyx_n_s_current_response;
static PyObject *__pyx_n_s_currently_handling_node_up;
static PyObject *__pyx_n_s_custom_payload;
static PyObject *__pyx_n_s_custom_payload_2;
static PyObject *__pyx_kp_s_custom_payload_cannot_be_retriev;
static PyObject *__pyx_n_s_daemon;
static PyObject *__pyx_n_s_data_center;
static PyObject *__pyx_n_s_datacenter;
static PyObject *__pyx_n_s_debug;
static PyObject *__pyx_n_s_decode_message;
static PyObject *__pyx_n_s_decoder;
static PyObject *__pyx_n_s_default_consistency_level;
static PyObject *__pyx_n_s_default_fetch_size;
static PyObject *__pyx_n_s_default_lbp_factory;
static PyObject *__pyx_n_s_default_retry_policy;
static PyObject *__pyx_kp_s_default_retry_policy_should_not;
static PyObject *__pyx_n_s_default_timeout;
static PyObject *__pyx_n_s_defaultdict;
static PyObject *__pyx_n_s_defunct;
static PyObject *__pyx_n_s_delay;
static PyObject *__pyx_n_s_delay_for_event_type;
static PyObject *__pyx_n_s_delay_window;
static PyObject *__pyx_n_s_dict_factory;
static PyObject *__pyx_n_s_discard;
static PyObject *__pyx_n_s_distance;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_e;
static PyObject *__pyx_n_s_elapsed;
static PyObject *__pyx_n_s_enabled;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_encode_message;
static PyObject *__pyx_n_s_encoder;
static PyObject *__pyx_n_s_ensure_core_connections;
static PyObject *__pyx_n_s_ensure_core_connections_2;
static PyObject *__pyx_n_s_enter;
static PyObject *__pyx_n_s_errback;
static PyObject *__pyx_n_s_errback_2;
static PyObject *__pyx_n_s_errback_args;
static PyObject *__pyx_n_s_errback_kwargs;
static PyObject *__pyx_n_s_errbacks;
static PyObject *__pyx_n_s_error;
static PyObject *__pyx_n_s_errors;
static PyObject *__pyx_n_s_errors_2;
static PyObject *__pyx_n_s_event;
static PyObject *__pyx_n_s_event_2;
static PyObject *__pyx_n_s_event_schedule_times;
static PyObject *__pyx_n_s_event_type;
static PyObject *__pyx_n_s_eventlet;
static PyObject *__pyx_kp_s_eventlet_patcher;
static PyObject *__pyx_n_s_evict_udt_class;
static PyObject *__pyx_n_s_exc;
static PyObject *__pyx_n_s_exc_info;
static PyObject *__pyx_n_s_exception;
static PyObject *__pyx_n_s_excluded_host;
static PyObject *__pyx_n_s_execute;
static PyObject *__pyx_n_s_execute_after_prepare;
static PyObject *__pyx_n_s_execute_async;
static PyObject *__pyx_n_s_executor;
static PyObject *__pyx_n_s_executor_2;
static PyObject *__pyx_n_s_executor_threads;
static PyObject *__pyx_n_s_exit;
static PyObject *__pyx_n_s_expect_host_to_be_down;
static PyObject *__pyx_n_s_expiring_weakref;
static PyObject *__pyx_n_s_f;
static PyObject *__pyx_n_s_factory;
static PyObject *__pyx_n_s_fail_on_error;
static PyObject *__pyx_n_s_fetch_size;
static PyObject *__pyx_n_s_field_names;
static PyObject *__pyx_n_s_final_exception;
static PyObject *__pyx_n_s_final_result;
static PyObject *__pyx_n_s_finalize_add;
static PyObject *__pyx_n_s_finished_future;
static PyObject *__pyx_n_s_fn;
static PyObject *__pyx_n_s_force_token_rebuild;
static PyObject *__pyx_n_s_found_hosts;
static PyObject *__pyx_n_s_from_message;
static PyObject *__pyx_n_s_function;
static PyObject *__pyx_n_s_function_changed;
static PyObject *__pyx_n_s_functions_query;
static PyObject *__pyx_n_s_functions_result;
static PyObject *__pyx_n_s_functions_success;
static PyObject *__pyx_n_s_functools;
static PyObject *__pyx_n_s_future;
static PyObject *__pyx_n_s_future_completed;
static PyObject *__pyx_n_s_future_completed_2;
static PyObject *__pyx_n_s_futures;
static PyObject *__pyx_n_s_futures_lock;
static PyObject *__pyx_n_s_futures_results;
static PyObject *__pyx_n_s_genexpr;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_getLogger;
static PyObject *__pyx_n_s_get_and_set_reconnection_handle;
static PyObject *__pyx_n_s_get_and_set_reconnection_handler;
static PyObject *__pyx_n_s_get_connection_holders;
static PyObject *__pyx_n_s_get_connections;
static PyObject *__pyx_n_s_get_core_connections_per_host;
static PyObject *__pyx_n_s_get_host;
static PyObject *__pyx_n_s_get_max_connections_per_host;
static PyObject *__pyx_n_s_get_max_requests_per_connection;
static PyObject *__pyx_n_s_get_min_requests_per_connection;
static PyObject *__pyx_n_s_get_pool_state;
static PyObject *__pyx_n_s_get_pools;
static PyObject *__pyx_n_s_get_query_trace;
static PyObject *__pyx_n_s_get_schema_mismatches;
static PyObject *__pyx_n_s_get_state;
static PyObject *__pyx_n_s_gevent;
static PyObject *__pyx_kp_s_gevent_monkey;
static PyObject *__pyx_n_s_gevent_socket;
static PyObject *__pyx_n_s_groupby;
static PyObject *__pyx_n_s_handle_results;
static PyObject *__pyx_n_s_handle_schema_change;
static PyObject *__pyx_n_s_handle_status_change;
static PyObject *__pyx_n_s_handle_topology_change;
static PyObject *__pyx_n_s_has_more_pages;
static PyObject *__pyx_n_s_have_future;
static PyObject *__pyx_n_s_hex;
static PyObject *__pyx_n_s_holders;
static PyObject *__pyx_n_s_host;
static PyObject *__pyx_n_s_host_addr;
static PyObject *__pyx_n_s_host_distance;
static PyObject *__pyx_n_s_host_errors;
static PyObject *__pyx_n_s_hosts;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_idle_heartbeat;
static PyObject *__pyx_n_s_idle_heartbeat_interval;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_info;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_initial_response;
static PyObject *__pyx_n_s_initialize_reactor;
static PyObject *__pyx_n_s_insert_task;
static PyObject *__pyx_n_s_is_closed;
static PyObject *__pyx_n_s_is_control_connection;
static PyObject *__pyx_n_s_is_currently_reconnecting;
static PyObject *__pyx_n_s_is_defunct;
static PyObject *__pyx_n_s_is_down;
static PyObject *__pyx_n_s_is_eventlet_monkey_patched;
static PyObject *__pyx_n_s_is_gevent_monkey_patched;
static PyObject *__pyx_n_s_is_host_addition;
static PyObject *__pyx_n_s_is_monkey_patched;
static PyObject *__pyx_n_s_is_set;
static PyObject *__pyx_n_s_is_setup;
static PyObject *__pyx_n_s_is_shutdown;
static PyObject *__pyx_n_s_is_shutdown_2;
static PyObject *__pyx_n_s_is_up;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_iter;
static PyObject *__pyx_n_s_iteritems;
static PyObject *__pyx_n_s_itertools;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_keys;
static PyObject *__pyx_n_s_keyspace;
static PyObject *__pyx_n_s_keyspace_changed;
static PyObject *__pyx_kp_s_keyspace_is_required_to_refresh;
static PyObject *__pyx_n_s_keyspaces;
static PyObject *__pyx_n_s_kind;
static PyObject *__pyx_n_s_klass;
static PyObject *__pyx_n_s_ks_chunk;
static PyObject *__pyx_n_s_ks_meta;
static PyObject *__pyx_n_s_ks_query;
static PyObject *__pyx_n_s_ks_result;
static PyObject *__pyx_n_s_ks_statements;
static PyObject *__pyx_n_s_ks_success;
static PyObject *__pyx_n_s_kwargs;
static PyObject *__pyx_n_s_kwargs_dict;
static PyObject *__pyx_n_s_last_error;
static PyObject *__pyx_n_s_listener;
static PyObject *__pyx_n_s_listener_lock;
static PyObject *__pyx_n_s_listeners;
static PyObject *__pyx_n_s_listeners_2;
static PyObject *__pyx_n_s_load_balancer;
static PyObject *__pyx_n_s_load_balancing_policy;
static PyObject *__pyx_kp_s_load_balancing_policy_should_not;
static PyObject *__pyx_n_s_local_address;
static PyObject *__pyx_n_s_local_query;
static PyObject *__pyx_n_s_local_result;
static PyObject *__pyx_n_s_local_row;
static PyObject *__pyx_n_s_local_rows;
static PyObject *__pyx_n_s_lock;
static PyObject *__pyx_n_s_lock_2;
static PyObject *__pyx_n_s_log;
static PyObject *__pyx_n_s_log_if_failed;
static PyObject *__pyx_n_s_logging;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_make_connection_factory;
static PyObject *__pyx_n_s_make_connection_kwargs;
static PyObject *__pyx_n_s_make_query_plan;
static PyObject *__pyx_n_s_make_query_plan_2;
static PyObject *__pyx_n_s_mapping;
static PyObject *__pyx_n_s_max_connections;
static PyObject *__pyx_n_s_max_connections_per_host;
static PyObject *__pyx_n_s_max_requests;
static PyObject *__pyx_n_s_max_requests_per_connection;
static PyObject *__pyx_n_s_max_schema_agreement_wait;
static PyObject *__pyx_n_s_max_trace_wait;
static PyObject *__pyx_n_s_max_wait;
static PyObject *__pyx_n_s_max_workers;
static PyObject *__pyx_n_s_message;
static PyObject *__pyx_n_s_messages;
static PyObject *__pyx_n_s_meta_refresh_enabled;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_metadata;
static PyObject *__pyx_n_s_method_name;
static PyObject *__pyx_n_s_metrics;
static PyObject *__pyx_n_s_metrics_2;
static PyObject *__pyx_n_s_metrics_enabled;
static PyObject *__pyx_n_s_min_requests;
static PyObject *__pyx_n_s_min_requests_per_connection;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_modules;
static PyObject *__pyx_n_s_msg;
static PyObject *__pyx_n_s_murmur3;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_named_tuple_factory;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_n_s_new_authenticator;
static PyObject *__pyx_n_s_new_f;
static PyObject *__pyx_n_s_new_handler;
static PyObject *__pyx_n_s_new_pool;
static PyObject *__pyx_n_s_new_schedule;
static PyObject *__pyx_n_s_new_session;
static PyObject *__pyx_n_s_new_version;
static PyObject *__pyx_n_s_next;
static PyObject *__pyx_n_s_next_2;
static PyObject *__pyx_n_s_next_delay;
static PyObject *__pyx_n_s_next_time;
static PyObject *__pyx_kp_s_no_result_yet;
static PyObject *__pyx_n_s_now;
static PyObject *__pyx_n_s_obj;
static PyObject *__pyx_n_s_obj_weakref;
static PyObject *__pyx_n_s_object;
static PyObject *__pyx_n_s_old;
static PyObject *__pyx_n_s_old_host;
static PyObject *__pyx_n_s_old_reconnector;
static PyObject *__pyx_n_s_on_add;
static PyObject *__pyx_n_s_on_connection_error;
static PyObject *__pyx_n_s_on_down;
static PyObject *__pyx_n_s_on_exception;
static PyObject *__pyx_n_s_on_ignore;
static PyObject *__pyx_n_s_on_other_error;
static PyObject *__pyx_n_s_on_read_timeout;
static PyObject *__pyx_n_s_on_reconnection;
static PyObject *__pyx_n_s_on_remove;
static PyObject *__pyx_n_s_on_retry;
static PyObject *__pyx_n_s_on_timeout;
static PyObject *__pyx_n_s_on_unavailable;
static PyObject *__pyx_n_s_on_up;
static PyObject *__pyx_n_s_on_up_future_completed;
static PyObject *__pyx_n_s_on_write_timeout;
static PyObject *__pyx_n_s_paging_state;
static PyObject *__pyx_n_s_paging_state_2;
static PyObject *__pyx_n_s_parameters;
static PyObject *__pyx_n_s_partial;
static PyObject *__pyx_n_s_partitioner;
static PyObject *__pyx_n_s_patcher;
static PyObject *__pyx_n_s_peer;
static PyObject *__pyx_n_s_peers_query;
static PyObject *__pyx_n_s_peers_result;
static PyObject *__pyx_n_s_pk_indexes;
static PyObject *__pyx_n_s_platform;
static PyObject *__pyx_n_s_pool;
static PyObject *__pyx_n_s_pool_finished_setting_keyspace;
static PyObject *__pyx_n_s_pools;
static PyObject *__pyx_n_s_pop;
static PyObject *__pyx_n_s_populate;
static PyObject *__pyx_n_s_port;
static PyObject *__pyx_n_s_preloaded_results;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_prepare_2;
static PyObject *__pyx_n_s_prepare_all_queries;
static PyObject *__pyx_n_s_prepare_message;
static PyObject *__pyx_n_s_prepare_on_all_hosts;
static PyObject *__pyx_n_s_prepare_on_all_sessions;
static PyObject *__pyx_n_s_prepared_keyspace;
static PyObject *__pyx_n_s_prepared_statement;
static PyObject *__pyx_n_s_prepared_statement_lock;
static PyObject *__pyx_n_s_prepared_statements;
static PyObject *__pyx_n_s_previous;
static PyObject *__pyx_n_s_previous_version;
static PyObject *__pyx_n_s_property;
static PyObject *__pyx_n_s_protect_name;
static PyObject *__pyx_n_s_protocol_downgrade;
static PyObject *__pyx_n_s_protocol_handler;
static PyObject *__pyx_n_s_protocol_version;
static PyObject *__pyx_n_s_protocol_version_2;
static PyObject *__pyx_n_s_proxy;
static PyObject *__pyx_n_s_put_nowait;
static PyObject *__pyx_n_s_python_implementation;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_queries;
static PyObject *__pyx_n_s_query;
static PyObject *__pyx_n_s_query_2;
static PyObject *__pyx_n_s_query_id;
static PyObject *__pyx_n_s_query_plan;
static PyObject *__pyx_n_s_query_retries;
static PyObject *__pyx_n_s_query_string;
static PyObject *__pyx_n_s_query_trace;
static PyObject *__pyx_n_s_queue;
static PyObject *__pyx_n_s_queue_2;
static PyObject *__pyx_n_s_rack;
static PyObject *__pyx_n_s_random;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_rebuild_schema;
static PyObject *__pyx_n_s_rebuild_token_map;
static PyObject *__pyx_n_s_reconnect;
static PyObject *__pyx_n_s_reconnect_2;
static PyObject *__pyx_n_s_reconnect_internal;
static PyObject *__pyx_n_s_reconnection_handler;
static PyObject *__pyx_n_s_reconnection_lock;
static PyObject *__pyx_n_s_reconnection_policy;
static PyObject *__pyx_kp_s_reconnection_policy_should_not_b;
static PyObject *__pyx_n_s_reconnector;
static PyObject *__pyx_n_s_ref;
static PyObject *__pyx_n_s_refresh_keyspace_metadata;
static PyObject *__pyx_n_s_refresh_node_list_and_token_map;
static PyObject *__pyx_n_s_refresh_node_list_and_token_map_2;
static PyObject *__pyx_n_s_refresh_nodes;
static PyObject *__pyx_n_s_refresh_schema;
static PyObject *__pyx_n_s_refresh_schema_2;
static PyObject *__pyx_n_s_refresh_schema_and_set_result;
static PyObject *__pyx_kp_s_refresh_schema_is_deprecated_Use;
static PyObject *__pyx_n_s_refresh_schema_metadata;
static PyObject *__pyx_n_s_refresh_table_metadata;
static PyObject *__pyx_n_s_refresh_user_aggregate_metadata;
static PyObject *__pyx_n_s_refresh_user_function_metadata;
static PyObject *__pyx_n_s_refresh_user_type_metadata;
static PyObject *__pyx_n_s_register;
static PyObject *__pyx_n_s_register_listener;
static PyObject *__pyx_n_s_register_timeout;
static PyObject *__pyx_n_s_register_user_type;
static PyObject *__pyx_n_s_register_watchers;
static PyObject *__pyx_n_s_remaining_callbacks;
static PyObject *__pyx_n_s_remove;
static PyObject *__pyx_n_s_remove_host;
static PyObject *__pyx_n_s_remove_pool;
static PyObject *__pyx_n_s_repr;
static PyObject *__pyx_n_s_reprepare;
static PyObject *__pyx_n_s_req_id;
static PyObject *__pyx_n_s_req_id_2;
static PyObject *__pyx_n_s_request_id;
static PyObject *__pyx_n_s_request_timer;
static PyObject *__pyx_n_s_response;
static PyObject *__pyx_n_s_response_future;
static PyObject *__pyx_n_s_responses;
static PyObject *__pyx_n_s_result;
static PyObject *__pyx_n_s_results;
static PyObject *__pyx_n_s_retry;
static PyObject *__pyx_n_s_retry_2;
static PyObject *__pyx_n_s_retry_num;
static PyObject *__pyx_n_s_retry_policy;
static PyObject *__pyx_n_s_retry_task;
static PyObject *__pyx_n_s_retry_type;
static PyObject *__pyx_n_s_return_connection;
static PyObject *__pyx_n_s_reuse_connection;
static PyObject *__pyx_n_s_row;
static PyObject *__pyx_n_s_row_factory;
static PyObject *__pyx_n_s_rpc_address;
static PyObject *__pyx_n_s_run;
static PyObject *__pyx_n_s_run_add_or_renew_pool;
static PyObject *__pyx_n_s_run_at;
static PyObject *__pyx_n_s_run_in_executor;
static PyObject *__pyx_n_s_run_in_executor_locals_new_f;
static PyObject *__pyx_n_s_run_now;
static PyObject *__pyx_kp_s_s;
static PyObject *__pyx_kp_s_s_2;
static PyObject *__pyx_n_s_s_3;
static PyObject *__pyx_kp_s_s_s;
static PyObject *__pyx_n_s_schedule;
static PyObject *__pyx_n_s_schedule_unique;
static PyObject *__pyx_n_s_scheduled_tasks;
static PyObject *__pyx_n_s_scheduler;
static PyObject *__pyx_n_s_schema_agreement_lock;
static PyObject *__pyx_n_s_schema_agreement_wait;
static PyObject *__pyx_n_s_schema_change;
static PyObject *__pyx_n_s_schema_event_refresh_window;
static PyObject *__pyx_n_s_schema_event_refresh_window_2;
static PyObject *__pyx_n_s_schema_mismatches;
static PyObject *__pyx_n_s_schema_ver;
static PyObject *__pyx_n_s_schema_version;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_self_weakref;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_send_msg;
static PyObject *__pyx_n_s_send_request;
static PyObject *__pyx_n_s_serial_consistency_level;
static PyObject *__pyx_n_s_session;
static PyObject *__pyx_n_s_sessions;
static PyObject *__pyx_n_s_set;
static PyObject *__pyx_n_s_set_core_connections_per_host;
static PyObject *__pyx_n_s_set_down;
static PyObject *__pyx_n_s_set_final_exception;
static PyObject *__pyx_n_s_set_final_result;
static PyObject *__pyx_n_s_set_keyspace;
static PyObject *__pyx_n_s_set_keyspace_blocking;
static PyObject *__pyx_n_s_set_keyspace_completed;
static PyObject *__pyx_n_s_set_keyspace_for_all_conns;
static PyObject *__pyx_n_s_set_keyspace_for_all_pools;
static PyObject *__pyx_n_s_set_location_info;
static PyObject *__pyx_n_s_set_max_connections_per_host;
static PyObject *__pyx_n_s_set_max_requests_per_connection;
static PyObject *__pyx_n_s_set_meta_refresh_enabled;
static PyObject *__pyx_n_s_set_min_requests_per_connection;
static PyObject *__pyx_n_s_set_new_connection;
static PyObject *__pyx_n_s_set_result;
static PyObject *__pyx_n_s_set_up;
static PyObject *__pyx_n_s_setdefault;
static PyObject *__pyx_n_s_setter;
static PyObject *__pyx_n_s_shared_results;
static PyObject *__pyx_n_s_should_rebuild_token_map;
static PyObject *__pyx_n_s_shutdown;
static PyObject *__pyx_n_s_shutdown_cluster;
static PyObject *__pyx_n_s_signal;
static PyObject *__pyx_n_s_signal_connection_failure;
static PyObject *__pyx_n_s_signal_error;
static PyObject *__pyx_n_s_signature;
static PyObject *__pyx_n_s_six;
static PyObject *__pyx_n_s_six_moves;
static PyObject *__pyx_n_s_sleep;
static PyObject *__pyx_n_s_socket;
static PyObject *__pyx_n_s_sockopts;
static PyObject *__pyx_n_s_ssl_options;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_start_fetching_next_page;
static PyObject *__pyx_n_s_start_reconnector;
static PyObject *__pyx_n_s_start_time;
static PyObject *__pyx_n_s_start_timer;
static PyObject *__pyx_n_s_startup_version;
static PyObject *__pyx_n_s_statements;
static PyObject *__pyx_n_s_statements_and_parameters;
static PyObject *__pyx_n_s_staticmethod;
static PyObject *__pyx_n_s_status_change;
static PyObject *__pyx_n_s_stop;
static PyObject *__pyx_n_s_stop_scheduler;
static PyObject *__pyx_n_s_str;
static PyObject *__pyx_n_s_string_types;
static PyObject *__pyx_n_s_submit;
static PyObject *__pyx_n_s_submit_2;
static PyObject *__pyx_n_s_submit_schema_refresh;
static PyObject *__pyx_kp_s_submit_schema_refresh_is_depreca;
static PyObject *__pyx_n_s_success;
static PyObject *__pyx_n_s_sum;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_n_s_t;
static PyObject *__pyx_n_s_table;
static PyObject *__pyx_n_s_table_changed;
static PyObject *__pyx_kp_s_table_usertype_function_aggrega;
static PyObject *__pyx_n_s_target;
static PyObject *__pyx_n_s_task;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_text_type;
static PyObject *__pyx_n_s_this_time;
static PyObject *__pyx_n_s_thread;
static PyObject *__pyx_n_s_threading;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_s_time_2;
static PyObject *__pyx_n_s_timeout;
static PyObject *__pyx_n_s_timeout_2;
static PyObject *__pyx_n_s_timer;
static PyObject *__pyx_n_s_timestamp;
static PyObject *__pyx_n_s_to_exception;
static PyObject *__pyx_n_s_token_map;
static PyObject *__pyx_n_s_tokens;
static PyObject *__pyx_n_s_topology_change;
static PyObject *__pyx_n_s_topology_event_refresh_window;
static PyObject *__pyx_n_s_topology_event_refresh_window_2;
static PyObject *__pyx_n_s_total_timeout;
static PyObject *__pyx_n_s_trace;
static PyObject *__pyx_n_s_trace_id;
static PyObject *__pyx_n_s_tracing;
static PyObject *__pyx_n_s_trigger_success;
static PyObject *__pyx_n_s_triggers_query;
static PyObject *__pyx_n_s_triggers_result;
static PyObject *__pyx_n_s_triggers_success;
static PyObject *__pyx_n_s_try_connect;
static PyObject *__pyx_n_s_try_reconnect;
static PyObject *__pyx_n_s_type;
static PyObject *__pyx_n_s_type_map;
static PyObject *__pyx_n_s_type_meta;
static PyObject *__pyx_n_s_type_signature;
static PyObject *__pyx_n_s_types_query;
static PyObject *__pyx_n_s_types_result;
static PyObject *__pyx_n_s_types_success;
static PyObject *__pyx_n_s_udt_name;
static PyObject *__pyx_n_s_unregister_listener;
static PyObject *__pyx_n_s_update_created_pools;
static PyObject *__pyx_n_s_update_custom_payload;
static PyObject *__pyx_n_s_update_location_info;
static PyObject *__pyx_n_s_use_client_timestamp;
static PyObject *__pyx_n_s_user_type;
static PyObject *__pyx_n_s_user_type_map;
static PyObject *__pyx_n_s_user_type_registered;
static PyObject *__pyx_n_s_user_types;
static PyObject *__pyx_n_s_user_types_2;
static PyObject *__pyx_n_s_usertype;
static PyObject *__pyx_n_s_usertype_changed;
static PyObject *__pyx_n_s_utf8;
static PyObject *__pyx_kp_s_utf_8;
static PyObject *__pyx_n_s_val;
static PyObject *__pyx_n_s_validate_refresh_schema;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_values;
static PyObject *__pyx_n_s_versions;
static PyObject *__pyx_n_s_wait;
static PyObject *__pyx_n_s_wait_for_response;
static PyObject *__pyx_n_s_wait_for_responses;
static PyObject *__pyx_n_s_wait_for_schema_agreement;
static PyObject *__pyx_n_s_wait_time;
static PyObject *__pyx_n_s_warn;
static PyObject *__pyx_n_s_warning;
static PyObject *__pyx_n_s_warnings;
static PyObject *__pyx_n_s_warnings_2;
static PyObject *__pyx_kp_s_warnings_cannot_be_retrieved_bef;
static PyObject *__pyx_n_s_watch_callback;
static PyObject *__pyx_n_s_weakref;
static PyObject *__pyx_n_s_where_clause;
static PyObject *__pyx_n_s_wraps;
static PyObject *__pyx_float_0_1;
static PyObject *__pyx_float_0_2;
static PyObject *__pyx_float_0_5;
static PyObject *__pyx_float_1_0;
static PyObject *__pyx_float_1e6;
static PyObject *__pyx_float_2_0;
static PyObject *__pyx_float_5_0;
static PyObject *__pyx_float_0_01;
static PyObject *__pyx_float_10_0;
static PyObject *__pyx_float_600_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_30;
static PyObject *__pyx_int_100;
static PyObject *__pyx_int_5000;
static PyObject *__pyx_int_9042;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__68;
static PyObject *__pyx_tuple__70;
static PyObject *__pyx_tuple__71;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__73;
static PyObject *__pyx_tuple__74;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__76;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_tuple__78;
static PyObject *__pyx_tuple__79;
static PyObject *__pyx_tuple__80;
static PyObject *__pyx_tuple__81;
static PyObject *__pyx_tuple__82;
static PyObject *__pyx_tuple__83;
static PyObject *__pyx_tuple__86;
static PyObject *__pyx_tuple__87;
static PyObject *__pyx_tuple__88;
static PyObject *__pyx_tuple__89;
static PyObject *__pyx_tuple__90;
static PyObject *__pyx_tuple__91;
static PyObject *__pyx_tuple__92;
static PyObject *__pyx_tuple__93;
static PyObject *__pyx_tuple__94;
static PyObject *__pyx_tuple__95;
static PyObject *__pyx_tuple__96;
static PyObject *__pyx_tuple__97;
static PyObject *__pyx_tuple__98;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_codeobj__5;
static PyObject *__pyx_tuple__100;
static PyObject *__pyx_tuple__102;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__104;
static PyObject *__pyx_tuple__105;
static PyObject *__pyx_tuple__106;
static PyObject *__pyx_tuple__107;
static PyObject *__pyx_tuple__108;
static PyObject *__pyx_tuple__109;
static PyObject *__pyx_tuple__110;
static PyObject *__pyx_tuple__111;
static PyObject *__pyx_tuple__112;
static PyObject *__pyx_tuple__113;
static PyObject *__pyx_tuple__114;
static PyObject *__pyx_tuple__115;
static PyObject *__pyx_tuple__116;
static PyObject *__pyx_tuple__117;
static PyObject *__pyx_tuple__118;
static PyObject *__pyx_tuple__119;
static PyObject *__pyx_tuple__120;
static PyObject *__pyx_tuple__121;
static PyObject *__pyx_tuple__122;
static PyObject *__pyx_tuple__123;
static PyObject *__pyx_tuple__124;
static PyObject *__pyx_tuple__125;
static PyObject *__pyx_tuple__126;
static PyObject *__pyx_tuple__127;
static PyObject *__pyx_tuple__128;
static PyObject *__pyx_tuple__129;
static PyObject *__pyx_tuple__130;
static PyObject *__pyx_tuple__131;
static PyObject *__pyx_tuple__132;
static PyObject *__pyx_tuple__133;
static PyObject *__pyx_tuple__134;
static PyObject *__pyx_tuple__135;
static PyObject *__pyx_tuple__136;
static PyObject *__pyx_tuple__137;
static PyObject *__pyx_tuple__138;
static PyObject *__pyx_tuple__139;
static PyObject *__pyx_tuple__140;
static PyObject *__pyx_tuple__141;
static PyObject *__pyx_tuple__142;
static PyObject *__pyx_tuple__143;
static PyObject *__pyx_tuple__144;
static PyObject *__pyx_tuple__145;
static PyObject *__pyx_tuple__146;
static PyObject *__pyx_tuple__147;
static PyObject *__pyx_tuple__148;
static PyObject *__pyx_tuple__149;
static PyObject *__pyx_tuple__150;
static PyObject *__pyx_tuple__151;
static PyObject *__pyx_tuple__152;
static PyObject *__pyx_tuple__153;
static PyObject *__pyx_tuple__154;
static PyObject *__pyx_tuple__155;
static PyObject *__pyx_tuple__157;
static PyObject *__pyx_tuple__160;
static PyObject *__pyx_tuple__161;
static PyObject *__pyx_tuple__163;
static PyObject *__pyx_tuple__165;
static PyObject *__pyx_tuple__167;
static PyObject *__pyx_tuple__171;
static PyObject *__pyx_tuple__173;
static PyObject *__pyx_tuple__175;
static PyObject *__pyx_tuple__176;
static PyObject *__pyx_tuple__178;
static PyObject *__pyx_tuple__180;
static PyObject *__pyx_tuple__182;
static PyObject *__pyx_tuple__184;
static PyObject *__pyx_tuple__186;
static PyObject *__pyx_tuple__188;
static PyObject *__pyx_tuple__190;
static PyObject *__pyx_tuple__192;
static PyObject *__pyx_tuple__194;
static PyObject *__pyx_tuple__196;
static PyObject *__pyx_tuple__198;
static PyObject *__pyx_tuple__200;
static PyObject *__pyx_tuple__202;
static PyObject *__pyx_tuple__204;
static PyObject *__pyx_tuple__206;
static PyObject *__pyx_tuple__207;
static PyObject *__pyx_tuple__209;
static PyObject *__pyx_tuple__211;
static PyObject *__pyx_tuple__213;
static PyObject *__pyx_tuple__215;
static PyObject *__pyx_tuple__217;
static PyObject *__pyx_tuple__219;
static PyObject *__pyx_tuple__221;
static PyObject *__pyx_tuple__223;
static PyObject *__pyx_tuple__224;
static PyObject *__pyx_tuple__226;
static PyObject *__pyx_tuple__227;
static PyObject *__pyx_tuple__229;
static PyObject *__pyx_tuple__231;
static PyObject *__pyx_tuple__233;
static PyObject *__pyx_tuple__234;
static PyObject *__pyx_tuple__236;
static PyObject *__pyx_tuple__237;
static PyObject *__pyx_tuple__239;
static PyObject *__pyx_tuple__241;
static PyObject *__pyx_tuple__243;
static PyObject *__pyx_tuple__245;
static PyObject *__pyx_tuple__247;
static PyObject *__pyx_tuple__249;
static PyObject *__pyx_tuple__251;
static PyObject *__pyx_tuple__252;
static PyObject *__pyx_tuple__254;
static PyObject *__pyx_tuple__255;
static PyObject *__pyx_tuple__257;
static PyObject *__pyx_tuple__258;
static PyObject *__pyx_tuple__260;
static PyObject *__pyx_tuple__261;
static PyObject *__pyx_tuple__263;
static PyObject *__pyx_tuple__264;
static PyObject *__pyx_tuple__266;
static PyObject *__pyx_tuple__267;
static PyObject *__pyx_tuple__269;
static PyObject *__pyx_tuple__270;
static PyObject *__pyx_tuple__272;
static PyObject *__pyx_tuple__273;
static PyObject *__pyx_tuple__275;
static PyObject *__pyx_tuple__277;
static PyObject *__pyx_tuple__279;
static PyObject *__pyx_tuple__281;
static PyObject *__pyx_tuple__283;
static PyObject *__pyx_tuple__285;
static PyObject *__pyx_tuple__287;
static PyObject *__pyx_tuple__289;
static PyObject *__pyx_tuple__291;
static PyObject *__pyx_tuple__292;
static PyObject *__pyx_tuple__294;
static PyObject *__pyx_tuple__296;
static PyObject *__pyx_tuple__298;
static PyObject *__pyx_tuple__300;
static PyObject *__pyx_tuple__302;
static PyObject *__pyx_tuple__304;
static PyObject *__pyx_tuple__306;
static PyObject *__pyx_tuple__308;
static PyObject *__pyx_tuple__310;
static PyObject *__pyx_tuple__312;
static PyObject *__pyx_tuple__314;
static PyObject *__pyx_tuple__316;
static PyObject *__pyx_tuple__318;
static PyObject *__pyx_tuple__320;
static PyObject *__pyx_tuple__322;
static PyObject *__pyx_tuple__324;
static PyObject *__pyx_tuple__326;
static PyObject *__pyx_tuple__328;
static PyObject *__pyx_tuple__330;
static PyObject *__pyx_tuple__332;
static PyObject *__pyx_tuple__334;
static PyObject *__pyx_tuple__336;
static PyObject *__pyx_tuple__338;
static PyObject *__pyx_tuple__340;
static PyObject *__pyx_tuple__342;
static PyObject *__pyx_tuple__344;
static PyObject *__pyx_tuple__346;
static PyObject *__pyx_tuple__348;
static PyObject *__pyx_tuple__350;
static PyObject *__pyx_tuple__352;
static PyObject *__pyx_tuple__353;
static PyObject *__pyx_tuple__355;
static PyObject *__pyx_tuple__356;
static PyObject *__pyx_tuple__358;
static PyObject *__pyx_tuple__360;
static PyObject *__pyx_tuple__362;
static PyObject *__pyx_tuple__363;
static PyObject *__pyx_tuple__365;
static PyObject *__pyx_tuple__367;
static PyObject *__pyx_tuple__369;
static PyObject *__pyx_tuple__371;
static PyObject *__pyx_tuple__373;
static PyObject *__pyx_tuple__375;
static PyObject *__pyx_tuple__376;
static PyObject *__pyx_tuple__378;
static PyObject *__pyx_tuple__380;
static PyObject *__pyx_tuple__382;
static PyObject *__pyx_tuple__384;
static PyObject *__pyx_tuple__386;
static PyObject *__pyx_tuple__387;
static PyObject *__pyx_tuple__389;
static PyObject *__pyx_tuple__391;
static PyObject *__pyx_tuple__393;
static PyObject *__pyx_tuple__395;
static PyObject *__pyx_tuple__397;
static PyObject *__pyx_tuple__399;
static PyObject *__pyx_tuple__401;
static PyObject *__pyx_tuple__403;
static PyObject *__pyx_tuple__405;
static PyObject *__pyx_tuple__407;
static PyObject *__pyx_tuple__409;
static PyObject *__pyx_tuple__411;
static PyObject *__pyx_tuple__413;
static PyObject *__pyx_tuple__415;
static PyObject *__pyx_tuple__416;
static PyObject *__pyx_tuple__418;
static PyObject *__pyx_tuple__420;
static PyObject *__pyx_tuple__422;
static PyObject *__pyx_tuple__424;
static PyObject *__pyx_tuple__426;
static PyObject *__pyx_tuple__428;
static PyObject *__pyx_tuple__429;
static PyObject *__pyx_tuple__431;
static PyObject *__pyx_tuple__433;
static PyObject *__pyx_tuple__435;
static PyObject *__pyx_tuple__437;
static PyObject *__pyx_tuple__439;
static PyObject *__pyx_tuple__441;
static PyObject *__pyx_tuple__443;
static PyObject *__pyx_tuple__445;
static PyObject *__pyx_tuple__447;
static PyObject *__pyx_tuple__449;
static PyObject *__pyx_tuple__451;
static PyObject *__pyx_tuple__453;
static PyObject *__pyx_tuple__455;
static PyObject *__pyx_tuple__457;
static PyObject *__pyx_tuple__458;
static PyObject *__pyx_tuple__460;
static PyObject *__pyx_tuple__462;
static PyObject *__pyx_tuple__464;
static PyObject *__pyx_tuple__465;
static PyObject *__pyx_tuple__467;
static PyObject *__pyx_tuple__469;
static PyObject *__pyx_tuple__471;
static PyObject *__pyx_tuple__473;
static PyObject *__pyx_codeobj__38;
static PyObject *__pyx_codeobj__64;
static PyObject *__pyx_codeobj__66;
static PyObject *__pyx_codeobj__69;
static PyObject *__pyx_codeobj__84;
static PyObject *__pyx_codeobj__156;
static PyObject *__pyx_codeobj__158;
static PyObject *__pyx_codeobj__162;
static PyObject *__pyx_codeobj__164;
static PyObject *__pyx_codeobj__166;
static PyObject *__pyx_codeobj__168;
static PyObject *__pyx_codeobj__169;
static PyObject *__pyx_codeobj__170;
static PyObject *__pyx_codeobj__172;
static PyObject *__pyx_codeobj__174;
static PyObject *__pyx_codeobj__177;
static PyObject *__pyx_codeobj__179;
static PyObject *__pyx_codeobj__181;
static PyObject *__pyx_codeobj__183;
static PyObject *__pyx_codeobj__185;
static PyObject *__pyx_codeobj__187;
static PyObject *__pyx_codeobj__189;
static PyObject *__pyx_codeobj__191;
static PyObject *__pyx_codeobj__193;
static PyObject *__pyx_codeobj__195;
static PyObject *__pyx_codeobj__197;
static PyObject *__pyx_codeobj__199;
static PyObject *__pyx_codeobj__201;
static PyObject *__pyx_codeobj__203;
static PyObject *__pyx_codeobj__205;
static PyObject *__pyx_codeobj__208;
static PyObject *__pyx_codeobj__210;
static PyObject *__pyx_codeobj__212;
static PyObject *__pyx_codeobj__214;
static PyObject *__pyx_codeobj__216;
static PyObject *__pyx_codeobj__218;
static PyObject *__pyx_codeobj__220;
static PyObject *__pyx_codeobj__222;
static PyObject *__pyx_codeobj__225;
static PyObject *__pyx_codeobj__228;
static PyObject *__pyx_codeobj__230;
static PyObject *__pyx_codeobj__232;
static PyObject *__pyx_codeobj__235;
static PyObject *__pyx_codeobj__238;
static PyObject *__pyx_codeobj__240;
static PyObject *__pyx_codeobj__242;
static PyObject *__pyx_codeobj__244;
static PyObject *__pyx_codeobj__246;
static PyObject *__pyx_codeobj__248;
static PyObject *__pyx_codeobj__250;
static PyObject *__pyx_codeobj__253;
static PyObject *__pyx_codeobj__256;
static PyObject *__pyx_codeobj__259;
static PyObject *__pyx_codeobj__262;
static PyObject *__pyx_codeobj__265;
static PyObject *__pyx_codeobj__268;
static PyObject *__pyx_codeobj__271;
static PyObject *__pyx_codeobj__274;
static PyObject *__pyx_codeobj__276;
static PyObject *__pyx_codeobj__278;
static PyObject *__pyx_codeobj__280;
static PyObject *__pyx_codeobj__282;
static PyObject *__pyx_codeobj__284;
static PyObject *__pyx_codeobj__286;
static PyObject *__pyx_codeobj__288;
static PyObject *__pyx_codeobj__290;
static PyObject *__pyx_codeobj__293;
static PyObject *__pyx_codeobj__295;
static PyObject *__pyx_codeobj__297;
static PyObject *__pyx_codeobj__299;
static PyObject *__pyx_codeobj__301;
static PyObject *__pyx_codeobj__303;
static PyObject *__pyx_codeobj__305;
static PyObject *__pyx_codeobj__307;
static PyObject *__pyx_codeobj__309;
static PyObject *__pyx_codeobj__311;
static PyObject *__pyx_codeobj__313;
static PyObject *__pyx_codeobj__315;
static PyObject *__pyx_codeobj__317;
static PyObject *__pyx_codeobj__319;
static PyObject *__pyx_codeobj__321;
static PyObject *__pyx_codeobj__323;
static PyObject *__pyx_codeobj__325;
static PyObject *__pyx_codeobj__327;
static PyObject *__pyx_codeobj__329;
static PyObject *__pyx_codeobj__331;
static PyObject *__pyx_codeobj__333;
static PyObject *__pyx_codeobj__335;
static PyObject *__pyx_codeobj__337;
static PyObject *__pyx_codeobj__339;
static PyObject *__pyx_codeobj__341;
static PyObject *__pyx_codeobj__343;
static PyObject *__pyx_codeobj__345;
static PyObject *__pyx_codeobj__347;
static PyObject *__pyx_codeobj__349;
static PyObject *__pyx_codeobj__351;
static PyObject *__pyx_codeobj__354;
static PyObject *__pyx_codeobj__357;
static PyObject *__pyx_codeobj__361;
static PyObject *__pyx_codeobj__364;
static PyObject *__pyx_codeobj__366;
static PyObject *__pyx_codeobj__368;
static PyObject *__pyx_codeobj__370;
static PyObject *__pyx_codeobj__372;
static PyObject *__pyx_codeobj__374;
static PyObject *__pyx_codeobj__377;
static PyObject *__pyx_codeobj__379;
static PyObject *__pyx_codeobj__381;
static PyObject *__pyx_codeobj__383;
static PyObject *__pyx_codeobj__385;
static PyObject *__pyx_codeobj__388;
static PyObject *__pyx_codeobj__390;
static PyObject *__pyx_codeobj__392;
static PyObject *__pyx_codeobj__394;
static PyObject *__pyx_codeobj__396;
static PyObject *__pyx_codeobj__398;
static PyObject *__pyx_codeobj__400;
static PyObject *__pyx_codeobj__402;
static PyObject *__pyx_codeobj__404;
static PyObject *__pyx_codeobj__406;
static PyObject *__pyx_codeobj__408;
static PyObject *__pyx_codeobj__410;
static PyObject *__pyx_codeobj__412;
static PyObject *__pyx_codeobj__414;
static PyObject *__pyx_codeobj__417;
static PyObject *__pyx_codeobj__419;
static PyObject *__pyx_codeobj__421;
static PyObject *__pyx_codeobj__423;
static PyObject *__pyx_codeobj__425;
static PyObject *__pyx_codeobj__427;
static PyObject *__pyx_codeobj__430;
static PyObject *__pyx_codeobj__432;
static PyObject *__pyx_codeobj__434;
static PyObject *__pyx_codeobj__436;
static PyObject *__pyx_codeobj__438;
static PyObject *__pyx_codeobj__440;
static PyObject *__pyx_codeobj__442;
static PyObject *__pyx_codeobj__444;
static PyObject *__pyx_codeobj__446;
static PyObject *__pyx_codeobj__448;
static PyObject *__pyx_codeobj__450;
static PyObject *__pyx_codeobj__452;
static PyObject *__pyx_codeobj__454;
static PyObject *__pyx_codeobj__456;
static PyObject *__pyx_codeobj__459;
static PyObject *__pyx_codeobj__461;
static PyObject *__pyx_codeobj__463;
static PyObject *__pyx_codeobj__466;
static PyObject *__pyx_codeobj__468;
static PyObject *__pyx_codeobj__470;
static PyObject *__pyx_codeobj__472;
static PyObject *__pyx_codeobj__474;

/* "cassandra/cluster.py":77
 * 
 * 
 * def _is_eventlet_monkey_patched():             # <<<<<<<<<<<<<<
 *     if 'eventlet.patcher' not in sys.modules:
 *         return False
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_1_is_eventlet_monkey_patched(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_1_is_eventlet_monkey_patched = {"_is_eventlet_monkey_patched", (PyCFunction)__pyx_pw_9cassandra_7cluster_1_is_eventlet_monkey_patched, METH_NOARGS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_1_is_eventlet_monkey_patched(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_is_eventlet_monkey_patched (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster__is_eventlet_monkey_patched(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster__is_eventlet_monkey_patched(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_eventlet = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_is_eventlet_monkey_patched", 0);

  /* "cassandra/cluster.py":78
 * 
 * def _is_eventlet_monkey_patched():
 *     if 'eventlet.patcher' not in sys.modules:             # <<<<<<<<<<<<<<
 *         return False
 *     import eventlet.patcher
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_modules); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_kp_s_eventlet_patcher, __pyx_t_2, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cassandra/cluster.py":79
 * def _is_eventlet_monkey_patched():
 *     if 'eventlet.patcher' not in sys.modules:
 *         return False             # <<<<<<<<<<<<<<
 *     import eventlet.patcher
 *     return eventlet.patcher.is_monkey_patched('socket')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":80
 *     if 'eventlet.patcher' not in sys.modules:
 *         return False
 *     import eventlet.patcher             # <<<<<<<<<<<<<<
 *     return eventlet.patcher.is_monkey_patched('socket')
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_kp_s_eventlet_patcher, 0, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_eventlet = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":81
 *         return False
 *     import eventlet.patcher
 *     return eventlet.patcher.is_monkey_patched('socket')             # <<<<<<<<<<<<<<
 * 
 * def _is_gevent_monkey_patched():
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_eventlet, __pyx_n_s_patcher); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_is_monkey_patched); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":77
 * 
 * 
 * def _is_eventlet_monkey_patched():             # <<<<<<<<<<<<<<
 *     if 'eventlet.patcher' not in sys.modules:
 *         return False
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster._is_eventlet_monkey_patched", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_eventlet);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":83
 *     return eventlet.patcher.is_monkey_patched('socket')
 * 
 * def _is_gevent_monkey_patched():             # <<<<<<<<<<<<<<
 *     if 'gevent.monkey' not in sys.modules:
 *         return False
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_3_is_gevent_monkey_patched(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_3_is_gevent_monkey_patched = {"_is_gevent_monkey_patched", (PyCFunction)__pyx_pw_9cassandra_7cluster_3_is_gevent_monkey_patched, METH_NOARGS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_3_is_gevent_monkey_patched(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_is_gevent_monkey_patched (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_2_is_gevent_monkey_patched(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_2_is_gevent_monkey_patched(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_gevent = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_is_gevent_monkey_patched", 0);

  /* "cassandra/cluster.py":84
 * 
 * def _is_gevent_monkey_patched():
 *     if 'gevent.monkey' not in sys.modules:             # <<<<<<<<<<<<<<
 *         return False
 *     import gevent.socket
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_modules); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_kp_s_gevent_monkey, __pyx_t_2, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cassandra/cluster.py":85
 * def _is_gevent_monkey_patched():
 *     if 'gevent.monkey' not in sys.modules:
 *         return False             # <<<<<<<<<<<<<<
 *     import gevent.socket
 *     return socket.socket is gevent.socket.socket
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":86
 *     if 'gevent.monkey' not in sys.modules:
 *         return False
 *     import gevent.socket             # <<<<<<<<<<<<<<
 *     return socket.socket is gevent.socket.socket
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent_socket, 0, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_gevent = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":87
 *         return False
 *     import gevent.socket
 *     return socket.socket is gevent.socket.socket             # <<<<<<<<<<<<<<
 * 
 * # default to gevent when we are monkey patched with gevent, eventlet when
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_socket); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_socket); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_gevent, __pyx_n_s_socket); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_socket); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_1 == __pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":83
 *     return eventlet.patcher.is_monkey_patched('socket')
 * 
 * def _is_gevent_monkey_patched():             # <<<<<<<<<<<<<<
 *     if 'gevent.monkey' not in sys.modules:
 *         return False
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster._is_gevent_monkey_patched", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gevent);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":137
 *     """
 * 
 *     def __init__(self, message, errors):             # <<<<<<<<<<<<<<
 *         Exception.__init__(self, message, errors)
 *         self.errors = errors
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_15NoHostAvailable_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_15NoHostAvailable_1__init__ = {"__init__", (PyCFunction)__pyx_pw_9cassandra_7cluster_15NoHostAvailable_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_15NoHostAvailable_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_errors = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_message,&__pyx_n_s_errors,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_errors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_message = values[1];
    __pyx_v_errors = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.NoHostAvailable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_15NoHostAvailable___init__(__pyx_self, __pyx_v_self, __pyx_v_message, __pyx_v_errors);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_15NoHostAvailable___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_errors) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cassandra/cluster.py":138
 * 
 *     def __init__(self, message, errors):
 *         Exception.__init__(self, message, errors)             # <<<<<<<<<<<<<<
 *         self.errors = errors
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_Exception, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_self);
  __Pyx_INCREF(__pyx_v_message);
  __Pyx_GIVEREF(__pyx_v_message);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_message);
  __Pyx_INCREF(__pyx_v_errors);
  __Pyx_GIVEREF(__pyx_v_errors);
  PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_errors);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":139
 *     def __init__(self, message, errors):
 *         Exception.__init__(self, message, errors)
 *         self.errors = errors             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_errors, __pyx_v_errors) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":137
 *     """
 * 
 *     def __init__(self, message, errors):             # <<<<<<<<<<<<<<
 *         Exception.__init__(self, message, errors)
 *         self.errors = errors
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.NoHostAvailable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":142
 * 
 * 
 * def _future_completed(future):             # <<<<<<<<<<<<<<
 *     """ Helper for run_in_executor() """
 *     exc = future.exception()
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_5_future_completed(PyObject *__pyx_self, PyObject *__pyx_v_future); /*proto*/
static char __pyx_doc_9cassandra_7cluster_4_future_completed[] = " Helper for run_in_executor() ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_5_future_completed = {"_future_completed", (PyCFunction)__pyx_pw_9cassandra_7cluster_5_future_completed, METH_O, __pyx_doc_9cassandra_7cluster_4_future_completed};
static PyObject *__pyx_pw_9cassandra_7cluster_5_future_completed(PyObject *__pyx_self, PyObject *__pyx_v_future) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_future_completed (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_4_future_completed(__pyx_self, ((PyObject *)__pyx_v_future));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_4_future_completed(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_future) {
  PyObject *__pyx_v_exc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_future_completed", 0);

  /* "cassandra/cluster.py":144
 * def _future_completed(future):
 *     """ Helper for run_in_executor() """
 *     exc = future.exception()             # <<<<<<<<<<<<<<
 *     if exc:
 *         log.debug("Failed to run task on executor", exc_info=exc)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_exception); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_exc = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":145
 *     """ Helper for run_in_executor() """
 *     exc = future.exception()
 *     if exc:             # <<<<<<<<<<<<<<
 *         log.debug("Failed to run task on executor", exc_info=exc)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_exc); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "cassandra/cluster.py":146
 *     exc = future.exception()
 *     if exc:
 *         log.debug("Failed to run task on executor", exc_info=exc)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_exc_info, __pyx_v_exc) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":142
 * 
 * 
 * def _future_completed(future):             # <<<<<<<<<<<<<<
 *     """ Helper for run_in_executor() """
 *     exc = future.exception()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cassandra.cluster._future_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":149
 * 
 * 
 * def run_in_executor(f):             # <<<<<<<<<<<<<<
 *     """
 *     A decorator to run the given method in the ThreadPoolExecutor.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7run_in_executor(PyObject *__pyx_self, PyObject *__pyx_v_f); /*proto*/
static char __pyx_doc_9cassandra_7cluster_6run_in_executor[] = "\n    A decorator to run the given method in the ThreadPoolExecutor.\n    ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7run_in_executor = {"run_in_executor", (PyCFunction)__pyx_pw_9cassandra_7cluster_7run_in_executor, METH_O, __pyx_doc_9cassandra_7cluster_6run_in_executor};
static PyObject *__pyx_pw_9cassandra_7cluster_7run_in_executor(PyObject *__pyx_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("run_in_executor (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_6run_in_executor(__pyx_self, ((PyObject *)__pyx_v_f));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":155
 * 
 *     @wraps(f)
 *     def new_f(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 * 
 *         if self.is_shutdown:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_15run_in_executor_1new_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_15run_in_executor_1new_f = {"new_f", (PyCFunction)__pyx_pw_9cassandra_7cluster_15run_in_executor_1new_f, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_15run_in_executor_1new_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("new_f (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "new_f") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("new_f", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("cassandra.cluster.run_in_executor.new_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_15run_in_executor_new_f(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_15run_in_executor_new_f(PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor *__pyx_cur_scope;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor *__pyx_outer_scope;
  PyObject *__pyx_v_future = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("new_f", 0);
  __pyx_outer_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "cassandra/cluster.py":157
 *     def new_f(self, *args, **kwargs):
 * 
 *         if self.is_shutdown:             # <<<<<<<<<<<<<<
 *             return
 *         try:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":158
 * 
 *         if self.is_shutdown:
 *             return             # <<<<<<<<<<<<<<
 *         try:
 *             future = self.executor.submit(f, self, *args, **kwargs)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":159
 *         if self.is_shutdown:
 *             return
 *         try:             # <<<<<<<<<<<<<<
 *             future = self.executor.submit(f, self, *args, **kwargs)
 *             future.add_done_callback(_future_completed)
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "cassandra/cluster.py":160
 *             return
 *         try:
 *             future = self.executor.submit(f, self, *args, **kwargs)             # <<<<<<<<<<<<<<
 *             future.add_done_callback(_future_completed)
 *         except Exception:
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_executor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_submit); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_cur_scope->__pyx_v_f)) { __Pyx_RaiseClosureNameError("f"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L4_error;} }
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_f);
      __Pyx_INCREF(__pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self);
      __pyx_t_7 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyNumber_Add(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __pyx_v_kwargs;
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_future = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "cassandra/cluster.py":161
 *         try:
 *             future = self.executor.submit(f, self, *args, **kwargs)
 *             future.add_done_callback(_future_completed)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             log.exception("Failed to submit task to executor")
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_add_done_callback); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_future_completed); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":162
 *             future = self.executor.submit(f, self, *args, **kwargs)
 *             future.add_done_callback(_future_completed)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             log.exception("Failed to submit task to executor")
 * 
 */
    __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_10) {
      __Pyx_AddTraceback("cassandra.cluster.run_in_executor.new_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_9);

      /* "cassandra/cluster.py":163
 *             future.add_done_callback(_future_completed)
 *         except Exception:
 *             log.exception("Failed to submit task to executor")             # <<<<<<<<<<<<<<
 * 
 *     return new_f
 */
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_exception); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L11_try_end:;
  }

  /* "cassandra/cluster.py":155
 * 
 *     @wraps(f)
 *     def new_f(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 * 
 *         if self.is_shutdown:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cassandra.cluster.run_in_executor.new_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_future);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":149
 * 
 * 
 * def run_in_executor(f):             # <<<<<<<<<<<<<<
 *     """
 *     A decorator to run the given method in the ThreadPoolExecutor.
 */

static PyObject *__pyx_pf_9cassandra_7cluster_6run_in_executor(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor *__pyx_cur_scope;
  PyObject *__pyx_v_new_f = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("run_in_executor", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct__run_in_executor(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct__run_in_executor, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_f = __pyx_v_f;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f);

  /* "cassandra/cluster.py":154
 *     """
 * 
 *     @wraps(f)             # <<<<<<<<<<<<<<
 *     def new_f(self, *args, **kwargs):
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_wraps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f);
    PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_cur_scope->__pyx_v_f);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":155
 * 
 *     @wraps(f)
 *     def new_f(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 * 
 *         if self.is_shutdown:
 */
  __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_15run_in_executor_1new_f, 0, __pyx_n_s_run_in_executor_locals_new_f, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_new_f = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":165
 *             log.exception("Failed to submit task to executor")
 * 
 *     return new_f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_new_f);
  __pyx_r = __pyx_v_new_f;
  goto __pyx_L0;

  /* "cassandra/cluster.py":149
 * 
 * 
 * def run_in_executor(f):             # <<<<<<<<<<<<<<
 *     """
 *     A decorator to run the given method in the ThreadPoolExecutor.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.run_in_executor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_new_f);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":168
 * 
 * 
 * def _shutdown_cluster(cluster):             # <<<<<<<<<<<<<<
 *     if cluster and not cluster.is_shutdown:
 *         cluster.shutdown()
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_9_shutdown_cluster(PyObject *__pyx_self, PyObject *__pyx_v_cluster); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_9_shutdown_cluster = {"_shutdown_cluster", (PyCFunction)__pyx_pw_9cassandra_7cluster_9_shutdown_cluster, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_9_shutdown_cluster(PyObject *__pyx_self, PyObject *__pyx_v_cluster) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_shutdown_cluster (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_8_shutdown_cluster(__pyx_self, ((PyObject *)__pyx_v_cluster));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_8_shutdown_cluster(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cluster) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_shutdown_cluster", 0);

  /* "cassandra/cluster.py":169
 * 
 * def _shutdown_cluster(cluster):
 *     if cluster and not cluster.is_shutdown:             # <<<<<<<<<<<<<<
 *         cluster.shutdown()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_cluster); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cluster, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = ((!__pyx_t_2) != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cassandra/cluster.py":170
 * def _shutdown_cluster(cluster):
 *     if cluster and not cluster.is_shutdown:
 *         cluster.shutdown()             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_cluster, __pyx_n_s_shutdown); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":168
 * 
 * 
 * def _shutdown_cluster(cluster):             # <<<<<<<<<<<<<<
 *     if cluster and not cluster.is_shutdown:
 *         cluster.shutdown()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster._shutdown_cluster", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":176
 * import platform
 * if platform.python_implementation() == 'CPython':
 *     def default_lbp_factory():             # <<<<<<<<<<<<<<
 *         if murmur3 is not None:
 *             return TokenAwarePolicy(DCAwareRoundRobinPolicy())
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_11default_lbp_factory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_11default_lbp_factory = {"default_lbp_factory", (PyCFunction)__pyx_pw_9cassandra_7cluster_11default_lbp_factory, METH_NOARGS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_11default_lbp_factory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("default_lbp_factory (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_10default_lbp_factory(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_10default_lbp_factory(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("default_lbp_factory", 0);

  /* "cassandra/cluster.py":177
 * if platform.python_implementation() == 'CPython':
 *     def default_lbp_factory():
 *         if murmur3 is not None:             # <<<<<<<<<<<<<<
 *             return TokenAwarePolicy(DCAwareRoundRobinPolicy())
 *         return DCAwareRoundRobinPolicy()
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_murmur3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":178
 *     def default_lbp_factory():
 *         if murmur3 is not None:
 *             return TokenAwarePolicy(DCAwareRoundRobinPolicy())             # <<<<<<<<<<<<<<
 *         return DCAwareRoundRobinPolicy()
 * else:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_TokenAwarePolicy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_DCAwareRoundRobinPolicy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (__pyx_t_7) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":179
 *         if murmur3 is not None:
 *             return TokenAwarePolicy(DCAwareRoundRobinPolicy())
 *         return DCAwareRoundRobinPolicy()             # <<<<<<<<<<<<<<
 * else:
 *     def default_lbp_factory():
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_DCAwareRoundRobinPolicy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_7) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":176
 * import platform
 * if platform.python_implementation() == 'CPython':
 *     def default_lbp_factory():             # <<<<<<<<<<<<<<
 *         if murmur3 is not None:
 *             return TokenAwarePolicy(DCAwareRoundRobinPolicy())
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.default_lbp_factory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":181
 *         return DCAwareRoundRobinPolicy()
 * else:
 *     def default_lbp_factory():             # <<<<<<<<<<<<<<
 *         return DCAwareRoundRobinPolicy()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_13default_lbp_factory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_13default_lbp_factory = {"default_lbp_factory", (PyCFunction)__pyx_pw_9cassandra_7cluster_13default_lbp_factory, METH_NOARGS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_13default_lbp_factory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("default_lbp_factory (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_12default_lbp_factory(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_12default_lbp_factory(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("default_lbp_factory", 0);

  /* "cassandra/cluster.py":182
 * else:
 *     def default_lbp_factory():
 *         return DCAwareRoundRobinPolicy()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DCAwareRoundRobinPolicy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":181
 *         return DCAwareRoundRobinPolicy()
 * else:
 *     def default_lbp_factory():             # <<<<<<<<<<<<<<
 *         return DCAwareRoundRobinPolicy()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cassandra.cluster.default_lbp_factory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":281
 * 
 *     @property
 *     def auth_provider(self):             # <<<<<<<<<<<<<<
 *         """
 *         When :attr:`~.Cluster.protocol_version` is 2 or higher, this should
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_1auth_provider(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_auth_provider[] = "\n        When :attr:`~.Cluster.protocol_version` is 2 or higher, this should\n        be an instance of a subclass of :class:`~cassandra.auth.AuthProvider`,\n        such as :class:`~.PlainTextAuthProvider`.\n\n        When :attr:`~.Cluster.protocol_version` is 1, this should be\n        a function that accepts one argument, the IP address of a node,\n        and returns a dict of credentials for that node.\n\n        When not using authentication, this should be left as :const:`None`.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_1auth_provider = {"auth_provider", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_1auth_provider, METH_O, __pyx_doc_9cassandra_7cluster_7Cluster_auth_provider};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_1auth_provider(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("auth_provider (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_auth_provider(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_auth_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("auth_provider", 0);

  /* "cassandra/cluster.py":293
 *         When not using authentication, this should be left as :const:`None`.
 *         """
 *         return self._auth_provider             # <<<<<<<<<<<<<<
 * 
 *     @auth_provider.setter  # noqa
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_auth_provider); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":281
 * 
 *     @property
 *     def auth_provider(self):             # <<<<<<<<<<<<<<
 *         """
 *         When :attr:`~.Cluster.protocol_version` is 2 or higher, this should
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.auth_provider", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":296
 * 
 *     @auth_provider.setter  # noqa
 *     def auth_provider(self, value):             # <<<<<<<<<<<<<<
 *         if not value:
 *             self._auth_provider = value
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_3auth_provider(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_3auth_provider = {"auth_provider", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_3auth_provider, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_3auth_provider(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("auth_provider (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("auth_provider", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "auth_provider") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("auth_provider", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.auth_provider", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_2auth_provider(__pyx_self, __pyx_v_self, __pyx_v_value);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_2auth_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("auth_provider", 0);

  /* "cassandra/cluster.py":297
 *     @auth_provider.setter  # noqa
 *     def auth_provider(self, value):
 *         if not value:             # <<<<<<<<<<<<<<
 *             self._auth_provider = value
 *             return
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":298
 *     def auth_provider(self, value):
 *         if not value:
 *             self._auth_provider = value             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_auth_provider, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "cassandra/cluster.py":299
 *         if not value:
 *             self._auth_provider = value
 *             return             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":301
 *             return
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._auth_provider_callable = value.new_authenticator
 *         except AttributeError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "cassandra/cluster.py":302
 * 
 *         try:
 *             self._auth_provider_callable = value.new_authenticator             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             if self.protocol_version > 1:
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_new_authenticator); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_auth_provider_callable, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "cassandra/cluster.py":303
 *         try:
 *             self._auth_provider_callable = value.new_authenticator
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             if self.protocol_version > 1:
 *                 raise TypeError("auth_provider must implement the cassandra.auth.AuthProvider "
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("cassandra.cluster.Cluster.auth_provider", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_9);

      /* "cassandra/cluster.py":304
 *             self._auth_provider_callable = value.new_authenticator
 *         except AttributeError:
 *             if self.protocol_version > 1:             # <<<<<<<<<<<<<<
 *                 raise TypeError("auth_provider must implement the cassandra.auth.AuthProvider "
 *                                 "interface when protocol_version >= 2")
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyObject_RichCompare(__pyx_t_10, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (__pyx_t_2) {

        /* "cassandra/cluster.py":305
 *         except AttributeError:
 *             if self.protocol_version > 1:
 *                 raise TypeError("auth_provider must implement the cassandra.auth.AuthProvider "             # <<<<<<<<<<<<<<
 *                                 "interface when protocol_version >= 2")
 *             elif not callable(value):
 */
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_Raise(__pyx_t_11, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      }

      /* "cassandra/cluster.py":307
 *                 raise TypeError("auth_provider must implement the cassandra.auth.AuthProvider "
 *                                 "interface when protocol_version >= 2")
 *             elif not callable(value):             # <<<<<<<<<<<<<<
 *                 raise TypeError("auth_provider must be callable when protocol_version == 1")
 *             self._auth_provider_callable = value
 */
      __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_value); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
      if (__pyx_t_1) {

        /* "cassandra/cluster.py":308
 *                                 "interface when protocol_version >= 2")
 *             elif not callable(value):
 *                 raise TypeError("auth_provider must be callable when protocol_version == 1")             # <<<<<<<<<<<<<<
 *             self._auth_provider_callable = value
 * 
 */
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_Raise(__pyx_t_11, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      }

      /* "cassandra/cluster.py":309
 *             elif not callable(value):
 *                 raise TypeError("auth_provider must be callable when protocol_version == 1")
 *             self._auth_provider_callable = value             # <<<<<<<<<<<<<<
 * 
 *         self._auth_provider = value
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_auth_provider_callable, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L11_try_end:;
  }

  /* "cassandra/cluster.py":311
 *             self._auth_provider_callable = value
 * 
 *         self._auth_provider = value             # <<<<<<<<<<<<<<
 * 
 *     load_balancing_policy = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_auth_provider, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":296
 * 
 *     @auth_provider.setter  # noqa
 *     def auth_provider(self, value):             # <<<<<<<<<<<<<<
 *         if not value:
 *             self._auth_provider = value
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.auth_provider", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":498
 *     _listener_lock = None
 * 
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *                  contact_points=["127.0.0.1"],
 *                  port=9042,
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_96__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__defaults__", 0);
  __Pyx_XDECREF(__pyx_r);

  /* "cassandra/cluster.py":511
 *                  ssl_options=None,
 *                  sockopts=None,
 *                  cql_version=None,             # <<<<<<<<<<<<<<
 *                  protocol_version=4,
 *                  executor_threads=2,
 */
  __pyx_t_1 = PyTuple_New(21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_contact_points);
  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_contact_points);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_contact_points);
  __Pyx_INCREF(((PyObject *)__pyx_int_9042));
  __Pyx_GIVEREF(((PyObject *)__pyx_int_9042));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_int_9042));
  __Pyx_INCREF(((PyObject *)Py_True));
  __Pyx_GIVEREF(((PyObject *)Py_True));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)Py_True));
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 5, ((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 6, ((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 7, ((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_False));
  __Pyx_GIVEREF(((PyObject *)Py_False));
  PyTuple_SET_ITEM(__pyx_t_1, 8, ((PyObject *)Py_False));
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 9, ((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 10, ((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 11, ((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 12, ((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)__pyx_int_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_int_4));
  PyTuple_SET_ITEM(__pyx_t_1, 13, ((PyObject *)__pyx_int_4));
  __Pyx_INCREF(((PyObject *)__pyx_int_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_int_2));
  PyTuple_SET_ITEM(__pyx_t_1, 14, ((PyObject *)__pyx_int_2));
  __Pyx_INCREF(((PyObject *)__pyx_int_10));
  __Pyx_GIVEREF(((PyObject *)__pyx_int_10));
  PyTuple_SET_ITEM(__pyx_t_1, 15, ((PyObject *)__pyx_int_10));
  __Pyx_INCREF(((PyObject*)__pyx_float_2_0));
  __Pyx_GIVEREF(((PyObject*)__pyx_float_2_0));
  PyTuple_SET_ITEM(__pyx_t_1, 16, ((PyObject*)__pyx_float_2_0));
  __Pyx_INCREF(((PyObject *)__pyx_int_30));
  __Pyx_GIVEREF(((PyObject *)__pyx_int_30));
  PyTuple_SET_ITEM(__pyx_t_1, 17, ((PyObject *)__pyx_int_30));
  __Pyx_INCREF(((PyObject *)__pyx_int_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_int_2));
  PyTuple_SET_ITEM(__pyx_t_1, 18, ((PyObject *)__pyx_int_2));
  __Pyx_INCREF(((PyObject *)__pyx_int_10));
  __Pyx_GIVEREF(((PyObject *)__pyx_int_10));
  PyTuple_SET_ITEM(__pyx_t_1, 19, ((PyObject *)__pyx_int_10));
  __Pyx_INCREF(((PyObject *)__pyx_int_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_int_5));
  PyTuple_SET_ITEM(__pyx_t_1, 20, ((PyObject *)__pyx_int_5));

  /* "cassandra/cluster.py":498
 *     _listener_lock = None
 * 
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *                  contact_points=["127.0.0.1"],
 *                  port=9042,
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_5__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_4__init__[] = "\n        Any of the mutable Cluster attributes may be set as keyword arguments\n        to the constructor.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_5__init__ = {"__init__", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_5__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_4__init__};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_5__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_contact_points = 0;
  PyObject *__pyx_v_port = 0;
  PyObject *__pyx_v_compression = 0;
  PyObject *__pyx_v_auth_provider = 0;
  PyObject *__pyx_v_load_balancing_policy = 0;
  PyObject *__pyx_v_reconnection_policy = 0;
  PyObject *__pyx_v_default_retry_policy = 0;
  PyObject *__pyx_v_conviction_policy_factory = 0;
  PyObject *__pyx_v_metrics_enabled = 0;
  PyObject *__pyx_v_connection_class = 0;
  PyObject *__pyx_v_ssl_options = 0;
  PyObject *__pyx_v_sockopts = 0;
  PyObject *__pyx_v_cql_version = 0;
  PyObject *__pyx_v_protocol_version = 0;
  PyObject *__pyx_v_executor_threads = 0;
  PyObject *__pyx_v_max_schema_agreement_wait = 0;
  PyObject *__pyx_v_control_connection_timeout = 0;
  PyObject *__pyx_v_idle_heartbeat_interval = 0;
  PyObject *__pyx_v_schema_event_refresh_window = 0;
  PyObject *__pyx_v_topology_event_refresh_window = 0;
  PyObject *__pyx_v_connect_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_contact_points,&__pyx_n_s_port,&__pyx_n_s_compression,&__pyx_n_s_auth_provider_2,&__pyx_n_s_load_balancing_policy,&__pyx_n_s_reconnection_policy,&__pyx_n_s_default_retry_policy,&__pyx_n_s_conviction_policy_factory,&__pyx_n_s_metrics_enabled,&__pyx_n_s_connection_class,&__pyx_n_s_ssl_options,&__pyx_n_s_sockopts,&__pyx_n_s_cql_version,&__pyx_n_s_protocol_version,&__pyx_n_s_executor_threads,&__pyx_n_s_max_schema_agreement_wait,&__pyx_n_s_control_connection_timeout,&__pyx_n_s_idle_heartbeat_interval,&__pyx_n_s_schema_event_refresh_window,&__pyx_n_s_topology_event_refresh_window,&__pyx_n_s_connect_timeout,0};
    PyObject* values[22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
    values[1] = __pyx_dynamic_args->__pyx_arg_contact_points;
    values[2] = ((PyObject *)((PyObject *)__pyx_int_9042));
    values[3] = ((PyObject *)((PyObject *)Py_True));
    values[4] = ((PyObject *)((PyObject *)Py_None));
    values[5] = ((PyObject *)((PyObject *)Py_None));
    values[6] = ((PyObject *)((PyObject *)Py_None));
    values[7] = ((PyObject *)((PyObject *)Py_None));
    values[8] = ((PyObject *)((PyObject *)Py_None));
    values[9] = ((PyObject *)((PyObject *)Py_False));
    values[10] = ((PyObject *)((PyObject *)Py_None));
    values[11] = ((PyObject *)((PyObject *)Py_None));
    values[12] = ((PyObject *)((PyObject *)Py_None));
    values[13] = ((PyObject *)((PyObject *)Py_None));
    values[14] = ((PyObject *)((PyObject *)__pyx_int_4));
    values[15] = ((PyObject *)((PyObject *)__pyx_int_2));
    values[16] = ((PyObject *)((PyObject *)__pyx_int_10));
    values[17] = ((PyObject *)((PyObject*)__pyx_float_2_0));
    values[18] = ((PyObject *)((PyObject *)__pyx_int_30));
    values[19] = ((PyObject *)((PyObject *)__pyx_int_2));
    values[20] = ((PyObject *)((PyObject *)__pyx_int_10));
    values[21] = ((PyObject *)((PyObject *)__pyx_int_5));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
        case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
        case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_contact_points);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_port);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_compression);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_auth_provider_2);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_load_balancing_policy);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reconnection_policy);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default_retry_policy);
          if (value) { values[7] = value; kw_args--; }
        }
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_conviction_policy_factory);
          if (value) { values[8] = value; kw_args--; }
        }
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_metrics_enabled);
          if (value) { values[9] = value; kw_args--; }
        }
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_connection_class);
          if (value) { values[10] = value; kw_args--; }
        }
        case 11:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ssl_options);
          if (value) { values[11] = value; kw_args--; }
        }
        case 12:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sockopts);
          if (value) { values[12] = value; kw_args--; }
        }
        case 13:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cql_version);
          if (value) { values[13] = value; kw_args--; }
        }
        case 14:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_protocol_version);
          if (value) { values[14] = value; kw_args--; }
        }
        case 15:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_executor_threads);
          if (value) { values[15] = value; kw_args--; }
        }
        case 16:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_schema_agreement_wait);
          if (value) { values[16] = value; kw_args--; }
        }
        case 17:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_control_connection_timeout);
          if (value) { values[17] = value; kw_args--; }
        }
        case 18:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_idle_heartbeat_interval);
          if (value) { values[18] = value; kw_args--; }
        }
        case 19:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_schema_event_refresh_window);
          if (value) { values[19] = value; kw_args--; }
        }
        case 20:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_topology_event_refresh_window);
          if (value) { values[20] = value; kw_args--; }
        }
        case 21:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_connect_timeout);
          if (value) { values[21] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
        case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
        case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_contact_points = values[1];
    __pyx_v_port = values[2];
    __pyx_v_compression = values[3];
    __pyx_v_auth_provider = values[4];
    __pyx_v_load_balancing_policy = values[5];
    __pyx_v_reconnection_policy = values[6];
    __pyx_v_default_retry_policy = values[7];
    __pyx_v_conviction_policy_factory = values[8];
    __pyx_v_metrics_enabled = values[9];
    __pyx_v_connection_class = values[10];
    __pyx_v_ssl_options = values[11];
    __pyx_v_sockopts = values[12];
    __pyx_v_cql_version = values[13];
    __pyx_v_protocol_version = values[14];
    __pyx_v_executor_threads = values[15];
    __pyx_v_max_schema_agreement_wait = values[16];
    __pyx_v_control_connection_timeout = values[17];
    __pyx_v_idle_heartbeat_interval = values[18];
    __pyx_v_schema_event_refresh_window = values[19];
    __pyx_v_topology_event_refresh_window = values[20];
    __pyx_v_connect_timeout = values[21];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 22, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_4__init__(__pyx_self, __pyx_v_self, __pyx_v_contact_points, __pyx_v_port, __pyx_v_compression, __pyx_v_auth_provider, __pyx_v_load_balancing_policy, __pyx_v_reconnection_policy, __pyx_v_default_retry_policy, __pyx_v_conviction_policy_factory, __pyx_v_metrics_enabled, __pyx_v_connection_class, __pyx_v_ssl_options, __pyx_v_sockopts, __pyx_v_cql_version, __pyx_v_protocol_version, __pyx_v_executor_threads, __pyx_v_max_schema_agreement_wait, __pyx_v_control_connection_timeout, __pyx_v_idle_heartbeat_interval, __pyx_v_schema_event_refresh_window, __pyx_v_topology_event_refresh_window, __pyx_v_connect_timeout);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_4__init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_contact_points, PyObject *__pyx_v_port, PyObject *__pyx_v_compression, PyObject *__pyx_v_auth_provider, PyObject *__pyx_v_load_balancing_policy, PyObject *__pyx_v_reconnection_policy, PyObject *__pyx_v_default_retry_policy, PyObject *__pyx_v_conviction_policy_factory, PyObject *__pyx_v_metrics_enabled, PyObject *__pyx_v_connection_class, PyObject *__pyx_v_ssl_options, PyObject *__pyx_v_sockopts, PyObject *__pyx_v_cql_version, PyObject *__pyx_v_protocol_version, PyObject *__pyx_v_executor_threads, PyObject *__pyx_v_max_schema_agreement_wait, PyObject *__pyx_v_control_connection_timeout, PyObject *__pyx_v_idle_heartbeat_interval, PyObject *__pyx_v_schema_event_refresh_window, PyObject *__pyx_v_topology_event_refresh_window, PyObject *__pyx_v_connect_timeout) {
  PyObject *__pyx_v_Metrics = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cassandra/cluster.py":524
 *         to the constructor.
 *         """
 *         if contact_points is not None:             # <<<<<<<<<<<<<<
 *             if isinstance(contact_points, six.string_types):
 *                 raise TypeError("contact_points should not be a string, it should be a sequence (e.g. list) of strings")
 */
  __pyx_t_1 = (__pyx_v_contact_points != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":525
 *         """
 *         if contact_points is not None:
 *             if isinstance(contact_points, six.string_types):             # <<<<<<<<<<<<<<
 *                 raise TypeError("contact_points should not be a string, it should be a sequence (e.g. list) of strings")
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_six); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_string_types); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = PyObject_IsInstance(__pyx_v_contact_points, __pyx_t_4); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "cassandra/cluster.py":526
 *         if contact_points is not None:
 *             if isinstance(contact_points, six.string_types):
 *                 raise TypeError("contact_points should not be a string, it should be a sequence (e.g. list) of strings")             # <<<<<<<<<<<<<<
 * 
 *             self.contact_points = contact_points
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cassandra/cluster.py":528
 *                 raise TypeError("contact_points should not be a string, it should be a sequence (e.g. list) of strings")
 * 
 *             self.contact_points = contact_points             # <<<<<<<<<<<<<<
 * 
 *         self.port = port
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_contact_points, __pyx_v_contact_points) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":530
 *             self.contact_points = contact_points
 * 
 *         self.port = port             # <<<<<<<<<<<<<<
 *         self.compression = compression
 *         self.protocol_version = protocol_version
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_port, __pyx_v_port) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":531
 * 
 *         self.port = port
 *         self.compression = compression             # <<<<<<<<<<<<<<
 *         self.protocol_version = protocol_version
 *         self.auth_provider = auth_provider
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_compression, __pyx_v_compression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":532
 *         self.port = port
 *         self.compression = compression
 *         self.protocol_version = protocol_version             # <<<<<<<<<<<<<<
 *         self.auth_provider = auth_provider
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version, __pyx_v_protocol_version) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":533
 *         self.compression = compression
 *         self.protocol_version = protocol_version
 *         self.auth_provider = auth_provider             # <<<<<<<<<<<<<<
 * 
 *         if load_balancing_policy is not None:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_auth_provider_2, __pyx_v_auth_provider) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":535
 *         self.auth_provider = auth_provider
 * 
 *         if load_balancing_policy is not None:             # <<<<<<<<<<<<<<
 *             if isinstance(load_balancing_policy, type):
 *                 raise TypeError("load_balancing_policy should not be a class, it should be an instance of that class")
 */
  __pyx_t_1 = (__pyx_v_load_balancing_policy != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":536
 * 
 *         if load_balancing_policy is not None:
 *             if isinstance(load_balancing_policy, type):             # <<<<<<<<<<<<<<
 *                 raise TypeError("load_balancing_policy should not be a class, it should be an instance of that class")
 * 
 */
    __pyx_t_2 = PyType_Check(__pyx_v_load_balancing_policy); 
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "cassandra/cluster.py":537
 *         if load_balancing_policy is not None:
 *             if isinstance(load_balancing_policy, type):
 *                 raise TypeError("load_balancing_policy should not be a class, it should be an instance of that class")             # <<<<<<<<<<<<<<
 * 
 *             self.load_balancing_policy = load_balancing_policy
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cassandra/cluster.py":539
 *                 raise TypeError("load_balancing_policy should not be a class, it should be an instance of that class")
 * 
 *             self.load_balancing_policy = load_balancing_policy             # <<<<<<<<<<<<<<
 *         else:
 *             self.load_balancing_policy = default_lbp_factory()
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_load_balancing_policy, __pyx_v_load_balancing_policy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  /*else*/ {

    /* "cassandra/cluster.py":541
 *             self.load_balancing_policy = load_balancing_policy
 *         else:
 *             self.load_balancing_policy = default_lbp_factory()             # <<<<<<<<<<<<<<
 * 
 *         if reconnection_policy is not None:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_default_lbp_factory); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_load_balancing_policy, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L5:;

  /* "cassandra/cluster.py":543
 *             self.load_balancing_policy = default_lbp_factory()
 * 
 *         if reconnection_policy is not None:             # <<<<<<<<<<<<<<
 *             if isinstance(reconnection_policy, type):
 *                 raise TypeError("reconnection_policy should not be a class, it should be an instance of that class")
 */
  __pyx_t_1 = (__pyx_v_reconnection_policy != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":544
 * 
 *         if reconnection_policy is not None:
 *             if isinstance(reconnection_policy, type):             # <<<<<<<<<<<<<<
 *                 raise TypeError("reconnection_policy should not be a class, it should be an instance of that class")
 * 
 */
    __pyx_t_2 = PyType_Check(__pyx_v_reconnection_policy); 
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "cassandra/cluster.py":545
 *         if reconnection_policy is not None:
 *             if isinstance(reconnection_policy, type):
 *                 raise TypeError("reconnection_policy should not be a class, it should be an instance of that class")             # <<<<<<<<<<<<<<
 * 
 *             self.reconnection_policy = reconnection_policy
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cassandra/cluster.py":547
 *                 raise TypeError("reconnection_policy should not be a class, it should be an instance of that class")
 * 
 *             self.reconnection_policy = reconnection_policy             # <<<<<<<<<<<<<<
 * 
 *         if default_retry_policy is not None:
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_policy, __pyx_v_reconnection_policy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "cassandra/cluster.py":549
 *             self.reconnection_policy = reconnection_policy
 * 
 *         if default_retry_policy is not None:             # <<<<<<<<<<<<<<
 *             if isinstance(default_retry_policy, type):
 *                 raise TypeError("default_retry_policy should not be a class, it should be an instance of that class")
 */
  __pyx_t_1 = (__pyx_v_default_retry_policy != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":550
 * 
 *         if default_retry_policy is not None:
 *             if isinstance(default_retry_policy, type):             # <<<<<<<<<<<<<<
 *                 raise TypeError("default_retry_policy should not be a class, it should be an instance of that class")
 * 
 */
    __pyx_t_2 = PyType_Check(__pyx_v_default_retry_policy); 
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "cassandra/cluster.py":551
 *         if default_retry_policy is not None:
 *             if isinstance(default_retry_policy, type):
 *                 raise TypeError("default_retry_policy should not be a class, it should be an instance of that class")             # <<<<<<<<<<<<<<
 * 
 *             self.default_retry_policy = default_retry_policy
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cassandra/cluster.py":553
 *                 raise TypeError("default_retry_policy should not be a class, it should be an instance of that class")
 * 
 *             self.default_retry_policy = default_retry_policy             # <<<<<<<<<<<<<<
 * 
 *         if conviction_policy_factory is not None:
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_default_retry_policy, __pyx_v_default_retry_policy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "cassandra/cluster.py":555
 *             self.default_retry_policy = default_retry_policy
 * 
 *         if conviction_policy_factory is not None:             # <<<<<<<<<<<<<<
 *             if not callable(conviction_policy_factory):
 *                 raise ValueError("conviction_policy_factory must be callable")
 */
  __pyx_t_1 = (__pyx_v_conviction_policy_factory != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":556
 * 
 *         if conviction_policy_factory is not None:
 *             if not callable(conviction_policy_factory):             # <<<<<<<<<<<<<<
 *                 raise ValueError("conviction_policy_factory must be callable")
 *             self.conviction_policy_factory = conviction_policy_factory
 */
    __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_conviction_policy_factory); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
    if (__pyx_t_1) {

      /* "cassandra/cluster.py":557
 *         if conviction_policy_factory is not None:
 *             if not callable(conviction_policy_factory):
 *                 raise ValueError("conviction_policy_factory must be callable")             # <<<<<<<<<<<<<<
 *             self.conviction_policy_factory = conviction_policy_factory
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cassandra/cluster.py":558
 *             if not callable(conviction_policy_factory):
 *                 raise ValueError("conviction_policy_factory must be callable")
 *             self.conviction_policy_factory = conviction_policy_factory             # <<<<<<<<<<<<<<
 * 
 *         if connection_class is not None:
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_conviction_policy_factory, __pyx_v_conviction_policy_factory) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "cassandra/cluster.py":560
 *             self.conviction_policy_factory = conviction_policy_factory
 * 
 *         if connection_class is not None:             # <<<<<<<<<<<<<<
 *             self.connection_class = connection_class
 * 
 */
  __pyx_t_1 = (__pyx_v_connection_class != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":561
 * 
 *         if connection_class is not None:
 *             self.connection_class = connection_class             # <<<<<<<<<<<<<<
 * 
 *         self.metrics_enabled = metrics_enabled
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_connection_class, __pyx_v_connection_class) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "cassandra/cluster.py":563
 *             self.connection_class = connection_class
 * 
 *         self.metrics_enabled = metrics_enabled             # <<<<<<<<<<<<<<
 *         self.ssl_options = ssl_options
 *         self.sockopts = sockopts
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_metrics_enabled, __pyx_v_metrics_enabled) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":564
 * 
 *         self.metrics_enabled = metrics_enabled
 *         self.ssl_options = ssl_options             # <<<<<<<<<<<<<<
 *         self.sockopts = sockopts
 *         self.cql_version = cql_version
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ssl_options, __pyx_v_ssl_options) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":565
 *         self.metrics_enabled = metrics_enabled
 *         self.ssl_options = ssl_options
 *         self.sockopts = sockopts             # <<<<<<<<<<<<<<
 *         self.cql_version = cql_version
 *         self.max_schema_agreement_wait = max_schema_agreement_wait
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sockopts, __pyx_v_sockopts) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":566
 *         self.ssl_options = ssl_options
 *         self.sockopts = sockopts
 *         self.cql_version = cql_version             # <<<<<<<<<<<<<<
 *         self.max_schema_agreement_wait = max_schema_agreement_wait
 *         self.control_connection_timeout = control_connection_timeout
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cql_version, __pyx_v_cql_version) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":567
 *         self.sockopts = sockopts
 *         self.cql_version = cql_version
 *         self.max_schema_agreement_wait = max_schema_agreement_wait             # <<<<<<<<<<<<<<
 *         self.control_connection_timeout = control_connection_timeout
 *         self.idle_heartbeat_interval = idle_heartbeat_interval
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_max_schema_agreement_wait, __pyx_v_max_schema_agreement_wait) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":568
 *         self.cql_version = cql_version
 *         self.max_schema_agreement_wait = max_schema_agreement_wait
 *         self.control_connection_timeout = control_connection_timeout             # <<<<<<<<<<<<<<
 *         self.idle_heartbeat_interval = idle_heartbeat_interval
 *         self.schema_event_refresh_window = schema_event_refresh_window
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_control_connection_timeout, __pyx_v_control_connection_timeout) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":569
 *         self.max_schema_agreement_wait = max_schema_agreement_wait
 *         self.control_connection_timeout = control_connection_timeout
 *         self.idle_heartbeat_interval = idle_heartbeat_interval             # <<<<<<<<<<<<<<
 *         self.schema_event_refresh_window = schema_event_refresh_window
 *         self.topology_event_refresh_window = topology_event_refresh_window
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_idle_heartbeat_interval, __pyx_v_idle_heartbeat_interval) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":570
 *         self.control_connection_timeout = control_connection_timeout
 *         self.idle_heartbeat_interval = idle_heartbeat_interval
 *         self.schema_event_refresh_window = schema_event_refresh_window             # <<<<<<<<<<<<<<
 *         self.topology_event_refresh_window = topology_event_refresh_window
 *         self.connect_timeout = connect_timeout
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_schema_event_refresh_window, __pyx_v_schema_event_refresh_window) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":571
 *         self.idle_heartbeat_interval = idle_heartbeat_interval
 *         self.schema_event_refresh_window = schema_event_refresh_window
 *         self.topology_event_refresh_window = topology_event_refresh_window             # <<<<<<<<<<<<<<
 *         self.connect_timeout = connect_timeout
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_topology_event_refresh_window, __pyx_v_topology_event_refresh_window) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":572
 *         self.schema_event_refresh_window = schema_event_refresh_window
 *         self.topology_event_refresh_window = topology_event_refresh_window
 *         self.connect_timeout = connect_timeout             # <<<<<<<<<<<<<<
 * 
 *         self._listeners = set()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_connect_timeout, __pyx_v_connect_timeout) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":574
 *         self.connect_timeout = connect_timeout
 * 
 *         self._listeners = set()             # <<<<<<<<<<<<<<
 *         self._listener_lock = Lock()
 * 
 */
  __pyx_t_4 = PySet_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_listeners, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":575
 * 
 *         self._listeners = set()
 *         self._listener_lock = Lock()             # <<<<<<<<<<<<<<
 * 
 *         # let Session objects be GC'ed (and shutdown) when the user no longer
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Lock); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_listener_lock, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":579
 *         # let Session objects be GC'ed (and shutdown) when the user no longer
 *         # holds a reference.
 *         self.sessions = WeakSet()             # <<<<<<<<<<<<<<
 *         self.metadata = Metadata()
 *         self.control_connection = None
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_WeakSet); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sessions, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":580
 *         # holds a reference.
 *         self.sessions = WeakSet()
 *         self.metadata = Metadata()             # <<<<<<<<<<<<<<
 *         self.control_connection = None
 *         self._prepared_statements = WeakValueDictionary()
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Metadata); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_metadata, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":581
 *         self.sessions = WeakSet()
 *         self.metadata = Metadata()
 *         self.control_connection = None             # <<<<<<<<<<<<<<
 *         self._prepared_statements = WeakValueDictionary()
 *         self._prepared_statement_lock = Lock()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_control_connection, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":582
 *         self.metadata = Metadata()
 *         self.control_connection = None
 *         self._prepared_statements = WeakValueDictionary()             # <<<<<<<<<<<<<<
 *         self._prepared_statement_lock = Lock()
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_WeakValueDictionary); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_prepared_statements, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":583
 *         self.control_connection = None
 *         self._prepared_statements = WeakValueDictionary()
 *         self._prepared_statement_lock = Lock()             # <<<<<<<<<<<<<<
 * 
 *         self._user_types = defaultdict(dict)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Lock); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_prepared_statement_lock, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":585
 *         self._prepared_statement_lock = Lock()
 * 
 *         self._user_types = defaultdict(dict)             # <<<<<<<<<<<<<<
 * 
 *         self._min_requests_per_connection = {
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)((PyObject*)(&PyDict_Type)))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_INCREF(((PyObject *)((PyObject*)(&PyDict_Type))));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyDict_Type))));
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, ((PyObject *)((PyObject*)(&PyDict_Type))));
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_user_types, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":587
 *         self._user_types = defaultdict(dict)
 * 
 *         self._min_requests_per_connection = {             # <<<<<<<<<<<<<<
 *             HostDistance.LOCAL: DEFAULT_MIN_REQUESTS,
 *             HostDistance.REMOTE: DEFAULT_MIN_REQUESTS
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "cassandra/cluster.py":588
 * 
 *         self._min_requests_per_connection = {
 *             HostDistance.LOCAL: DEFAULT_MIN_REQUESTS,             # <<<<<<<<<<<<<<
 *             HostDistance.REMOTE: DEFAULT_MIN_REQUESTS
 *         }
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostDistance); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_LOCAL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_MIN_REQUESTS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_6, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":589
 *         self._min_requests_per_connection = {
 *             HostDistance.LOCAL: DEFAULT_MIN_REQUESTS,
 *             HostDistance.REMOTE: DEFAULT_MIN_REQUESTS             # <<<<<<<<<<<<<<
 *         }
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostDistance); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_REMOTE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":590
 *             HostDistance.LOCAL: DEFAULT_MIN_REQUESTS,
 *             HostDistance.REMOTE: DEFAULT_MIN_REQUESTS
 *         }             # <<<<<<<<<<<<<<
 * 
 *         self._max_requests_per_connection = {
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_MIN_REQUESTS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_6, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":587
 *         self._user_types = defaultdict(dict)
 * 
 *         self._min_requests_per_connection = {             # <<<<<<<<<<<<<<
 *             HostDistance.LOCAL: DEFAULT_MIN_REQUESTS,
 *             HostDistance.REMOTE: DEFAULT_MIN_REQUESTS
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_min_requests_per_connection, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":592
 *         }
 * 
 *         self._max_requests_per_connection = {             # <<<<<<<<<<<<<<
 *             HostDistance.LOCAL: DEFAULT_MAX_REQUESTS,
 *             HostDistance.REMOTE: DEFAULT_MAX_REQUESTS
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "cassandra/cluster.py":593
 * 
 *         self._max_requests_per_connection = {
 *             HostDistance.LOCAL: DEFAULT_MAX_REQUESTS,             # <<<<<<<<<<<<<<
 *             HostDistance.REMOTE: DEFAULT_MAX_REQUESTS
 *         }
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostDistance); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_LOCAL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_MAX_REQUESTS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_6, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":594
 *         self._max_requests_per_connection = {
 *             HostDistance.LOCAL: DEFAULT_MAX_REQUESTS,
 *             HostDistance.REMOTE: DEFAULT_MAX_REQUESTS             # <<<<<<<<<<<<<<
 *         }
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostDistance); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_REMOTE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":595
 *             HostDistance.LOCAL: DEFAULT_MAX_REQUESTS,
 *             HostDistance.REMOTE: DEFAULT_MAX_REQUESTS
 *         }             # <<<<<<<<<<<<<<
 * 
 *         self._core_connections_per_host = {
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_MAX_REQUESTS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_6, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":592
 *         }
 * 
 *         self._max_requests_per_connection = {             # <<<<<<<<<<<<<<
 *             HostDistance.LOCAL: DEFAULT_MAX_REQUESTS,
 *             HostDistance.REMOTE: DEFAULT_MAX_REQUESTS
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_max_requests_per_connection, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":597
 *         }
 * 
 *         self._core_connections_per_host = {             # <<<<<<<<<<<<<<
 *             HostDistance.LOCAL: DEFAULT_MIN_CONNECTIONS_PER_LOCAL_HOST,
 *             HostDistance.REMOTE: DEFAULT_MIN_CONNECTIONS_PER_REMOTE_HOST
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "cassandra/cluster.py":598
 * 
 *         self._core_connections_per_host = {
 *             HostDistance.LOCAL: DEFAULT_MIN_CONNECTIONS_PER_LOCAL_HOST,             # <<<<<<<<<<<<<<
 *             HostDistance.REMOTE: DEFAULT_MIN_CONNECTIONS_PER_REMOTE_HOST
 *         }
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostDistance); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_LOCAL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_MIN_CONNECTIONS_PER_LOCA); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_6, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":599
 *         self._core_connections_per_host = {
 *             HostDistance.LOCAL: DEFAULT_MIN_CONNECTIONS_PER_LOCAL_HOST,
 *             HostDistance.REMOTE: DEFAULT_MIN_CONNECTIONS_PER_REMOTE_HOST             # <<<<<<<<<<<<<<
 *         }
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostDistance); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_REMOTE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":600
 *             HostDistance.LOCAL: DEFAULT_MIN_CONNECTIONS_PER_LOCAL_HOST,
 *             HostDistance.REMOTE: DEFAULT_MIN_CONNECTIONS_PER_REMOTE_HOST
 *         }             # <<<<<<<<<<<<<<
 * 
 *         self._max_connections_per_host = {
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_MIN_CONNECTIONS_PER_REMO); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_6, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":597
 *         }
 * 
 *         self._core_connections_per_host = {             # <<<<<<<<<<<<<<
 *             HostDistance.LOCAL: DEFAULT_MIN_CONNECTIONS_PER_LOCAL_HOST,
 *             HostDistance.REMOTE: DEFAULT_MIN_CONNECTIONS_PER_REMOTE_HOST
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_core_connections_per_host, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":602
 *         }
 * 
 *         self._max_connections_per_host = {             # <<<<<<<<<<<<<<
 *             HostDistance.LOCAL: DEFAULT_MAX_CONNECTIONS_PER_LOCAL_HOST,
 *             HostDistance.REMOTE: DEFAULT_MAX_CONNECTIONS_PER_REMOTE_HOST
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "cassandra/cluster.py":603
 * 
 *         self._max_connections_per_host = {
 *             HostDistance.LOCAL: DEFAULT_MAX_CONNECTIONS_PER_LOCAL_HOST,             # <<<<<<<<<<<<<<
 *             HostDistance.REMOTE: DEFAULT_MAX_CONNECTIONS_PER_REMOTE_HOST
 *         }
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostDistance); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_LOCAL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_MAX_CONNECTIONS_PER_LOCA); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_6, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":604
 *         self._max_connections_per_host = {
 *             HostDistance.LOCAL: DEFAULT_MAX_CONNECTIONS_PER_LOCAL_HOST,
 *             HostDistance.REMOTE: DEFAULT_MAX_CONNECTIONS_PER_REMOTE_HOST             # <<<<<<<<<<<<<<
 *         }
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostDistance); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_REMOTE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":605
 *             HostDistance.LOCAL: DEFAULT_MAX_CONNECTIONS_PER_LOCAL_HOST,
 *             HostDistance.REMOTE: DEFAULT_MAX_CONNECTIONS_PER_REMOTE_HOST
 *         }             # <<<<<<<<<<<<<<
 * 
 *         self.executor = ThreadPoolExecutor(max_workers=executor_threads)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_MAX_CONNECTIONS_PER_REMO); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_6, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":602
 *         }
 * 
 *         self._max_connections_per_host = {             # <<<<<<<<<<<<<<
 *             HostDistance.LOCAL: DEFAULT_MAX_CONNECTIONS_PER_LOCAL_HOST,
 *             HostDistance.REMOTE: DEFAULT_MAX_CONNECTIONS_PER_REMOTE_HOST
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_max_connections_per_host, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":607
 *         }
 * 
 *         self.executor = ThreadPoolExecutor(max_workers=executor_threads)             # <<<<<<<<<<<<<<
 *         self.scheduler = _Scheduler(self.executor)
 * 
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ThreadPoolExecutor); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_max_workers, __pyx_v_executor_threads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_executor, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "cassandra/cluster.py":608
 * 
 *         self.executor = ThreadPoolExecutor(max_workers=executor_threads)
 *         self.scheduler = _Scheduler(self.executor)             # <<<<<<<<<<<<<<
 * 
 *         self._lock = RLock()
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Scheduler); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_executor); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_scheduler, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "cassandra/cluster.py":610
 *         self.scheduler = _Scheduler(self.executor)
 * 
 *         self._lock = RLock()             # <<<<<<<<<<<<<<
 * 
 *         if self.metrics_enabled:
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_RLock); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_7) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else {
    __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_lock, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "cassandra/cluster.py":612
 *         self._lock = RLock()
 * 
 *         if self.metrics_enabled:             # <<<<<<<<<<<<<<
 *             from cassandra.metrics import Metrics
 *             self.metrics = Metrics(weakref.proxy(self))
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_enabled); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":613
 * 
 *         if self.metrics_enabled:
 *             from cassandra.metrics import Metrics             # <<<<<<<<<<<<<<
 *             self.metrics = Metrics(weakref.proxy(self))
 * 
 */
    __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_n_s_Metrics);
    __Pyx_GIVEREF(__pyx_n_s_Metrics);
    PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_Metrics);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_cassandra_metrics, __pyx_t_6, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Metrics); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_v_Metrics = __pyx_t_6;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cassandra/cluster.py":614
 *         if self.metrics_enabled:
 *             from cassandra.metrics import Metrics
 *             self.metrics = Metrics(weakref.proxy(self))             # <<<<<<<<<<<<<<
 * 
 *         self.control_connection = ControlConnection(
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_weakref); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_proxy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_self); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_self);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_INCREF(__pyx_v_Metrics);
    __pyx_t_4 = __pyx_v_Metrics; __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_metrics, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L14;
  }
  __pyx_L14:;

  /* "cassandra/cluster.py":616
 *             self.metrics = Metrics(weakref.proxy(self))
 * 
 *         self.control_connection = ControlConnection(             # <<<<<<<<<<<<<<
 *             self, self.control_connection_timeout,
 *             self.schema_event_refresh_window, self.topology_event_refresh_window)
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ControlConnection); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "cassandra/cluster.py":617
 * 
 *         self.control_connection = ControlConnection(
 *             self, self.control_connection_timeout,             # <<<<<<<<<<<<<<
 *             self.schema_event_refresh_window, self.topology_event_refresh_window)
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection_timeout); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "cassandra/cluster.py":618
 *         self.control_connection = ControlConnection(
 *             self, self.control_connection_timeout,
 *             self.schema_event_refresh_window, self.topology_event_refresh_window)             # <<<<<<<<<<<<<<
 * 
 *     def register_user_type(self, keyspace, user_type, klass):
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_schema_event_refresh_window); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_topology_event_refresh_window); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_9 = 1;
    }
  }
  __pyx_t_10 = PyTuple_New(4+__pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (__pyx_t_8) {
    __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
  }
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_t_5);
  __pyx_t_7 = 0;
  __pyx_t_6 = 0;
  __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":616
 *             self.metrics = Metrics(weakref.proxy(self))
 * 
 *         self.control_connection = ControlConnection(             # <<<<<<<<<<<<<<
 *             self, self.control_connection_timeout,
 *             self.schema_event_refresh_window, self.topology_event_refresh_window)
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_control_connection, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":498
 *     _listener_lock = None
 * 
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *                  contact_points=["127.0.0.1"],
 *                  port=9042,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Metrics);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":620
 *             self.schema_event_refresh_window, self.topology_event_refresh_window)
 * 
 *     def register_user_type(self, keyspace, user_type, klass):             # <<<<<<<<<<<<<<
 *         """
 *         Registers a class to use to represent a particular user-defined type.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_7register_user_type(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_6register_user_type[] = "\n        Registers a class to use to represent a particular user-defined type.\n        Query parameters for this user-defined type will be assumed to be\n        instances of `klass`.  Result sets for this user-defined type will\n        be instances of `klass`.  If no class is registered for a user-defined\n        type, a namedtuple will be used for result sets, and non-prepared\n        statements may not encode parameters for this type correctly.\n\n        `keyspace` is the name of the keyspace that the UDT is defined in.\n\n        `user_type` is the string name of the UDT to register the mapping\n        for.\n\n        `klass` should be a class with attributes whose names match the\n        fields of the user-defined type.  The constructor must accepts kwargs\n        for each of the fields in the UDT.\n\n        This method should only be called after the type has been created\n        within Cassandra.\n\n        Example::\n\n            cluster = Cluster(protocol_version=3)\n            session = cluster.connect()\n            session.set_keyspace('mykeyspace')\n            session.execute(\"CREATE TYPE address (street text, zipcode int)\")\n            session.execute(\"CREATE TABLE users (id int PRIMARY KEY, location address)\")\n\n            # create a class to map to the \"address\" UDT\n            class Address(object):\n\n                def __init__(self, street, zipcode):\n                    self.street = street\n                    self.zipcode = zipcode\n\n            cluster.register_user_type('mykeyspace', 'address', Address)\n\n            # insert a row using an instance of Address\n            session.execute(\"INSERT INTO users (id, location) VALUES (%s, %s)\",\n                            (0, Address(\"123 Main St.\", 78723)))\n\n            # results will include Address instances\n            results = session.execute(\"SELECT * FROM users\")\n            row = results[0]\n            print row.id, row.location.street, row.location"".zipcode\n\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_7register_user_type = {"register_user_type", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_7register_user_type, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_6register_user_type};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_7register_user_type(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keyspace = 0;
  PyObject *__pyx_v_user_type = 0;
  PyObject *__pyx_v_klass = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("register_user_type (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_keyspace,&__pyx_n_s_user_type,&__pyx_n_s_klass,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("register_user_type", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_user_type)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("register_user_type", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_klass)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("register_user_type", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "register_user_type") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_keyspace = values[1];
    __pyx_v_user_type = values[2];
    __pyx_v_klass = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("register_user_type", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.register_user_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_6register_user_type(__pyx_self, __pyx_v_self, __pyx_v_keyspace, __pyx_v_user_type, __pyx_v_klass);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_6register_user_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_user_type, PyObject *__pyx_v_klass) {
  PyObject *__pyx_v_session = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_user_type", 0);

  /* "cassandra/cluster.py":668
 * 
 *         """
 *         if self.protocol_version < 3:             # <<<<<<<<<<<<<<
 *             log.warning("User Type serialization is only supported in native protocol version 3+ (%d in use). "
 *                         "CQL encoding for simple statements will still work, but named tuples will "
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":669
 *         """
 *         if self.protocol_version < 3:
 *             log.warning("User Type serialization is only supported in native protocol version 3+ (%d in use). "             # <<<<<<<<<<<<<<
 *                         "CQL encoding for simple statements will still work, but named tuples will "
 *                         "be returned when reading type %s.%s.", self.protocol_version, keyspace, user_type)
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_warning); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":671
 *             log.warning("User Type serialization is only supported in native protocol version 3+ (%d in use). "
 *                         "CQL encoding for simple statements will still work, but named tuples will "
 *                         "be returned when reading type %s.%s.", self.protocol_version, keyspace, user_type)             # <<<<<<<<<<<<<<
 * 
 *         self._user_types[keyspace][user_type] = klass
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_User_Type_serialization_is_only);
    __Pyx_GIVEREF(__pyx_kp_s_User_Type_serialization_is_only);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_User_Type_serialization_is_only);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_keyspace);
    __Pyx_INCREF(__pyx_v_user_type);
    __Pyx_GIVEREF(__pyx_v_user_type);
    PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_6, __pyx_v_user_type);
    __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":673
 *                         "be returned when reading type %s.%s.", self.protocol_version, keyspace, user_type)
 * 
 *         self._user_types[keyspace][user_type] = klass             # <<<<<<<<<<<<<<
 *         for session in self.sessions:
 *             session.user_type_registered(keyspace, user_type, klass)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_user_types); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetItem(__pyx_t_2, __pyx_v_keyspace); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_v_user_type, __pyx_v_klass) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":674
 * 
 *         self._user_types[keyspace][user_type] = klass
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.user_type_registered(keyspace, user_type, klass)
 *         UserType.evict_udt_class(keyspace, user_type)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sessions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_8(__pyx_t_2);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_session, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":675
 *         self._user_types[keyspace][user_type] = klass
 *         for session in self.sessions:
 *             session.user_type_registered(keyspace, user_type, klass)             # <<<<<<<<<<<<<<
 *         UserType.evict_udt_class(keyspace, user_type)
 * 
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_user_type_registered); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    __pyx_t_5 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_v_keyspace);
    __Pyx_INCREF(__pyx_v_user_type);
    __Pyx_GIVEREF(__pyx_v_user_type);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_v_user_type);
    __Pyx_INCREF(__pyx_v_klass);
    __Pyx_GIVEREF(__pyx_v_klass);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_9, __pyx_v_klass);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":674
 * 
 *         self._user_types[keyspace][user_type] = klass
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.user_type_registered(keyspace, user_type, klass)
 *         UserType.evict_udt_class(keyspace, user_type)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":676
 *         for session in self.sessions:
 *             session.user_type_registered(keyspace, user_type, klass)
 *         UserType.evict_udt_class(keyspace, user_type)             # <<<<<<<<<<<<<<
 * 
 *     def get_min_requests_per_connection(self, host_distance):
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_UserType); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_evict_udt_class); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_v_keyspace);
  __Pyx_GIVEREF(__pyx_v_keyspace);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_keyspace);
  __Pyx_INCREF(__pyx_v_user_type);
  __Pyx_GIVEREF(__pyx_v_user_type);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_user_type);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":620
 *             self.schema_event_refresh_window, self.topology_event_refresh_window)
 * 
 *     def register_user_type(self, keyspace, user_type, klass):             # <<<<<<<<<<<<<<
 *         """
 *         Registers a class to use to represent a particular user-defined type.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.register_user_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_session);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":678
 *         UserType.evict_udt_class(keyspace, user_type)
 * 
 *     def get_min_requests_per_connection(self, host_distance):             # <<<<<<<<<<<<<<
 *         return self._min_requests_per_connection[host_distance]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_9get_min_requests_per_connection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_9get_min_requests_per_connection = {"get_min_requests_per_connection", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_9get_min_requests_per_connection, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_9get_min_requests_per_connection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host_distance = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_min_requests_per_connection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host_distance,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host_distance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_min_requests_per_connection", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_min_requests_per_connection") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host_distance = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_min_requests_per_connection", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.get_min_requests_per_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_8get_min_requests_per_connection(__pyx_self, __pyx_v_self, __pyx_v_host_distance);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_8get_min_requests_per_connection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_min_requests_per_connection", 0);

  /* "cassandra/cluster.py":679
 * 
 *     def get_min_requests_per_connection(self, host_distance):
 *         return self._min_requests_per_connection[host_distance]             # <<<<<<<<<<<<<<
 * 
 *     def set_min_requests_per_connection(self, host_distance, min_requests):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_min_requests_per_connection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_host_distance); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":678
 *         UserType.evict_udt_class(keyspace, user_type)
 * 
 *     def get_min_requests_per_connection(self, host_distance):             # <<<<<<<<<<<<<<
 *         return self._min_requests_per_connection[host_distance]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.get_min_requests_per_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":681
 *         return self._min_requests_per_connection[host_distance]
 * 
 *     def set_min_requests_per_connection(self, host_distance, min_requests):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a threshold for concurrent requests per connection, below which
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_11set_min_requests_per_connection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_10set_min_requests_per_connection[] = "\n        Sets a threshold for concurrent requests per connection, below which\n        connections will be considered for disposal (down to core connections;\n        see :meth:`~Cluster.set_core_connections_per_host`).\n\n        Pertains to connection pool management in protocol versions {1,2}.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_11set_min_requests_per_connection = {"set_min_requests_per_connection", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_11set_min_requests_per_connection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_10set_min_requests_per_connection};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_11set_min_requests_per_connection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host_distance = 0;
  PyObject *__pyx_v_min_requests = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_min_requests_per_connection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host_distance,&__pyx_n_s_min_requests,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host_distance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_min_requests_per_connection", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min_requests)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_min_requests_per_connection", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_min_requests_per_connection") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_host_distance = values[1];
    __pyx_v_min_requests = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_min_requests_per_connection", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.set_min_requests_per_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_10set_min_requests_per_connection(__pyx_self, __pyx_v_self, __pyx_v_host_distance, __pyx_v_min_requests);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_10set_min_requests_per_connection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance, PyObject *__pyx_v_min_requests) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_min_requests_per_connection", 0);

  /* "cassandra/cluster.py":689
 *         Pertains to connection pool management in protocol versions {1,2}.
 *         """
 *         if self.protocol_version >= 3:             # <<<<<<<<<<<<<<
 *             raise UnsupportedOperation(
 *                 "Cluster.set_min_requests_per_connection() only has an effect "
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":690
 *         """
 *         if self.protocol_version >= 3:
 *             raise UnsupportedOperation(             # <<<<<<<<<<<<<<
 *                 "Cluster.set_min_requests_per_connection() only has an effect "
 *                 "when using protocol_version 1 or 2.")
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_UnsupportedOperation); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":693
 *                 "Cluster.set_min_requests_per_connection() only has an effect "
 *                 "when using protocol_version 1 or 2.")
 *         self._min_requests_per_connection[host_distance] = min_requests             # <<<<<<<<<<<<<<
 * 
 *     def get_max_requests_per_connection(self, host_distance):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_min_requests_per_connection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_host_distance, __pyx_v_min_requests) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":681
 *         return self._min_requests_per_connection[host_distance]
 * 
 *     def set_min_requests_per_connection(self, host_distance, min_requests):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a threshold for concurrent requests per connection, below which
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.set_min_requests_per_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":695
 *         self._min_requests_per_connection[host_distance] = min_requests
 * 
 *     def get_max_requests_per_connection(self, host_distance):             # <<<<<<<<<<<<<<
 *         return self._max_requests_per_connection[host_distance]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_13get_max_requests_per_connection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_13get_max_requests_per_connection = {"get_max_requests_per_connection", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_13get_max_requests_per_connection, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_13get_max_requests_per_connection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host_distance = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_max_requests_per_connection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host_distance,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host_distance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_max_requests_per_connection", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_max_requests_per_connection") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host_distance = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_max_requests_per_connection", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.get_max_requests_per_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_12get_max_requests_per_connection(__pyx_self, __pyx_v_self, __pyx_v_host_distance);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_12get_max_requests_per_connection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_max_requests_per_connection", 0);

  /* "cassandra/cluster.py":696
 * 
 *     def get_max_requests_per_connection(self, host_distance):
 *         return self._max_requests_per_connection[host_distance]             # <<<<<<<<<<<<<<
 * 
 *     def set_max_requests_per_connection(self, host_distance, max_requests):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_requests_per_connection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_host_distance); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":695
 *         self._min_requests_per_connection[host_distance] = min_requests
 * 
 *     def get_max_requests_per_connection(self, host_distance):             # <<<<<<<<<<<<<<
 *         return self._max_requests_per_connection[host_distance]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.get_max_requests_per_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":698
 *         return self._max_requests_per_connection[host_distance]
 * 
 *     def set_max_requests_per_connection(self, host_distance, max_requests):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a threshold for concurrent requests per connection, above which new
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_15set_max_requests_per_connection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_14set_max_requests_per_connection[] = "\n        Sets a threshold for concurrent requests per connection, above which new\n        connections will be created to a host (up to max connections;\n        see :meth:`~Cluster.set_max_connections_per_host`).\n\n        Pertains to connection pool management in protocol versions {1,2}.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_15set_max_requests_per_connection = {"set_max_requests_per_connection", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_15set_max_requests_per_connection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_14set_max_requests_per_connection};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_15set_max_requests_per_connection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host_distance = 0;
  PyObject *__pyx_v_max_requests = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_max_requests_per_connection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host_distance,&__pyx_n_s_max_requests,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host_distance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_max_requests_per_connection", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_requests)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_max_requests_per_connection", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_max_requests_per_connection") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_host_distance = values[1];
    __pyx_v_max_requests = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_max_requests_per_connection", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.set_max_requests_per_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_14set_max_requests_per_connection(__pyx_self, __pyx_v_self, __pyx_v_host_distance, __pyx_v_max_requests);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_14set_max_requests_per_connection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance, PyObject *__pyx_v_max_requests) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_max_requests_per_connection", 0);

  /* "cassandra/cluster.py":706
 *         Pertains to connection pool management in protocol versions {1,2}.
 *         """
 *         if self.protocol_version >= 3:             # <<<<<<<<<<<<<<
 *             raise UnsupportedOperation(
 *                 "Cluster.set_max_requests_per_connection() only has an effect "
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":707
 *         """
 *         if self.protocol_version >= 3:
 *             raise UnsupportedOperation(             # <<<<<<<<<<<<<<
 *                 "Cluster.set_max_requests_per_connection() only has an effect "
 *                 "when using protocol_version 1 or 2.")
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_UnsupportedOperation); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":710
 *                 "Cluster.set_max_requests_per_connection() only has an effect "
 *                 "when using protocol_version 1 or 2.")
 *         self._max_requests_per_connection[host_distance] = max_requests             # <<<<<<<<<<<<<<
 * 
 *     def get_core_connections_per_host(self, host_distance):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_requests_per_connection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_host_distance, __pyx_v_max_requests) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":698
 *         return self._max_requests_per_connection[host_distance]
 * 
 *     def set_max_requests_per_connection(self, host_distance, max_requests):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a threshold for concurrent requests per connection, above which new
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.set_max_requests_per_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":712
 *         self._max_requests_per_connection[host_distance] = max_requests
 * 
 *     def get_core_connections_per_host(self, host_distance):             # <<<<<<<<<<<<<<
 *         """
 *         Gets the minimum number of connections per Session that will be opened
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_17get_core_connections_per_host(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_16get_core_connections_per_host[] = "\n        Gets the minimum number of connections per Session that will be opened\n        for each host with :class:`~.HostDistance` equal to `host_distance`.\n        The default is 2 for :attr:`~HostDistance.LOCAL` and 1 for\n        :attr:`~HostDistance.REMOTE`.\n\n        This property is ignored if :attr:`~.Cluster.protocol_version` is\n        3 or higher.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_17get_core_connections_per_host = {"get_core_connections_per_host", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_17get_core_connections_per_host, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_16get_core_connections_per_host};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_17get_core_connections_per_host(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host_distance = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_core_connections_per_host (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host_distance,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host_distance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_core_connections_per_host", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_core_connections_per_host") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host_distance = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_core_connections_per_host", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.get_core_connections_per_host", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_16get_core_connections_per_host(__pyx_self, __pyx_v_self, __pyx_v_host_distance);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_16get_core_connections_per_host(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_core_connections_per_host", 0);

  /* "cassandra/cluster.py":722
 *         3 or higher.
 *         """
 *         return self._core_connections_per_host[host_distance]             # <<<<<<<<<<<<<<
 * 
 *     def set_core_connections_per_host(self, host_distance, core_connections):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_core_connections_per_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_host_distance); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":712
 *         self._max_requests_per_connection[host_distance] = max_requests
 * 
 *     def get_core_connections_per_host(self, host_distance):             # <<<<<<<<<<<<<<
 *         """
 *         Gets the minimum number of connections per Session that will be opened
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.get_core_connections_per_host", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":724
 *         return self._core_connections_per_host[host_distance]
 * 
 *     def set_core_connections_per_host(self, host_distance, core_connections):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the minimum number of connections per Session that will be opened
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_19set_core_connections_per_host(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_18set_core_connections_per_host[] = "\n        Sets the minimum number of connections per Session that will be opened\n        for each host with :class:`~.HostDistance` equal to `host_distance`.\n        The default is 2 for :attr:`~HostDistance.LOCAL` and 1 for\n        :attr:`~HostDistance.REMOTE`.\n\n        Protocol version 1 and 2 are limited in the number of concurrent\n        requests they can send per connection. The driver implements connection\n        pooling to support higher levels of concurrency.\n\n        If :attr:`~.Cluster.protocol_version` is set to 3 or higher, this\n        is not supported (there is always one connection per host, unless\n        the host is remote and :attr:`connect_to_remote_hosts` is :const:`False`)\n        and using this will result in an :exc:`~.UnsupporteOperation`.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_19set_core_connections_per_host = {"set_core_connections_per_host", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_19set_core_connections_per_host, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_18set_core_connections_per_host};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_19set_core_connections_per_host(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host_distance = 0;
  PyObject *__pyx_v_core_connections = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_core_connections_per_host (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host_distance,&__pyx_n_s_core_connections,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host_distance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_core_connections_per_host", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_core_connections)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_core_connections_per_host", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_core_connections_per_host") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_host_distance = values[1];
    __pyx_v_core_connections = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_core_connections_per_host", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.set_core_connections_per_host", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_18set_core_connections_per_host(__pyx_self, __pyx_v_self, __pyx_v_host_distance, __pyx_v_core_connections);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_18set_core_connections_per_host(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance, PyObject *__pyx_v_core_connections) {
  PyObject *__pyx_v_old = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_core_connections_per_host", 0);

  /* "cassandra/cluster.py":740
 *         and using this will result in an :exc:`~.UnsupporteOperation`.
 *         """
 *         if self.protocol_version >= 3:             # <<<<<<<<<<<<<<
 *             raise UnsupportedOperation(
 *                 "Cluster.set_core_connections_per_host() only has an effect "
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":741
 *         """
 *         if self.protocol_version >= 3:
 *             raise UnsupportedOperation(             # <<<<<<<<<<<<<<
 *                 "Cluster.set_core_connections_per_host() only has an effect "
 *                 "when using protocol_version 1 or 2.")
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_UnsupportedOperation); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":744
 *                 "Cluster.set_core_connections_per_host() only has an effect "
 *                 "when using protocol_version 1 or 2.")
 *         old = self._core_connections_per_host[host_distance]             # <<<<<<<<<<<<<<
 *         self._core_connections_per_host[host_distance] = core_connections
 *         if old < core_connections:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_core_connections_per_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_host_distance); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_old = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":745
 *                 "when using protocol_version 1 or 2.")
 *         old = self._core_connections_per_host[host_distance]
 *         self._core_connections_per_host[host_distance] = core_connections             # <<<<<<<<<<<<<<
 *         if old < core_connections:
 *             self._ensure_core_connections()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_core_connections_per_host); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_v_host_distance, __pyx_v_core_connections) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":746
 *         old = self._core_connections_per_host[host_distance]
 *         self._core_connections_per_host[host_distance] = core_connections
 *         if old < core_connections:             # <<<<<<<<<<<<<<
 *             self._ensure_core_connections()
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_old, __pyx_v_core_connections, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":747
 *         self._core_connections_per_host[host_distance] = core_connections
 *         if old < core_connections:
 *             self._ensure_core_connections()             # <<<<<<<<<<<<<<
 * 
 *     def get_max_connections_per_host(self, host_distance):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ensure_core_connections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cassandra/cluster.py":724
 *         return self._core_connections_per_host[host_distance]
 * 
 *     def set_core_connections_per_host(self, host_distance, core_connections):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the minimum number of connections per Session that will be opened
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.set_core_connections_per_host", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_old);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":749
 *             self._ensure_core_connections()
 * 
 *     def get_max_connections_per_host(self, host_distance):             # <<<<<<<<<<<<<<
 *         """
 *         Gets the maximum number of connections per Session that will be opened
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_21get_max_connections_per_host(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_20get_max_connections_per_host[] = "\n        Gets the maximum number of connections per Session that will be opened\n        for each host with :class:`~.HostDistance` equal to `host_distance`.\n        The default is 8 for :attr:`~HostDistance.LOCAL` and 2 for\n        :attr:`~HostDistance.REMOTE`.\n\n        This property is ignored if :attr:`~.Cluster.protocol_version` is\n        3 or higher.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_21get_max_connections_per_host = {"get_max_connections_per_host", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_21get_max_connections_per_host, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_20get_max_connections_per_host};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_21get_max_connections_per_host(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host_distance = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_max_connections_per_host (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host_distance,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host_distance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_max_connections_per_host", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_max_connections_per_host") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host_distance = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_max_connections_per_host", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.get_max_connections_per_host", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_20get_max_connections_per_host(__pyx_self, __pyx_v_self, __pyx_v_host_distance);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_20get_max_connections_per_host(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_max_connections_per_host", 0);

  /* "cassandra/cluster.py":759
 *         3 or higher.
 *         """
 *         return self._max_connections_per_host[host_distance]             # <<<<<<<<<<<<<<
 * 
 *     def set_max_connections_per_host(self, host_distance, max_connections):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_connections_per_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_host_distance); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":749
 *             self._ensure_core_connections()
 * 
 *     def get_max_connections_per_host(self, host_distance):             # <<<<<<<<<<<<<<
 *         """
 *         Gets the maximum number of connections per Session that will be opened
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.get_max_connections_per_host", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":761
 *         return self._max_connections_per_host[host_distance]
 * 
 *     def set_max_connections_per_host(self, host_distance, max_connections):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the maximum number of connections per Session that will be opened
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_23set_max_connections_per_host(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_22set_max_connections_per_host[] = "\n        Sets the maximum number of connections per Session that will be opened\n        for each host with :class:`~.HostDistance` equal to `host_distance`.\n        The default is 2 for :attr:`~HostDistance.LOCAL` and 1 for\n        :attr:`~HostDistance.REMOTE`.\n\n        If :attr:`~.Cluster.protocol_version` is set to 3 or higher, this\n        is not supported (there is always one connection per host, unless\n        the host is remote and :attr:`connect_to_remote_hosts` is :const:`False`)\n        and using this will result in an :exc:`~.UnsupporteOperation`.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_23set_max_connections_per_host = {"set_max_connections_per_host", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_23set_max_connections_per_host, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_22set_max_connections_per_host};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_23set_max_connections_per_host(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host_distance = 0;
  PyObject *__pyx_v_max_connections = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_max_connections_per_host (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host_distance,&__pyx_n_s_max_connections,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host_distance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_max_connections_per_host", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_connections)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_max_connections_per_host", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_max_connections_per_host") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_host_distance = values[1];
    __pyx_v_max_connections = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_max_connections_per_host", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.set_max_connections_per_host", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_22set_max_connections_per_host(__pyx_self, __pyx_v_self, __pyx_v_host_distance, __pyx_v_max_connections);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_22set_max_connections_per_host(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_distance, PyObject *__pyx_v_max_connections) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_max_connections_per_host", 0);

  /* "cassandra/cluster.py":773
 *         and using this will result in an :exc:`~.UnsupporteOperation`.
 *         """
 *         if self.protocol_version >= 3:             # <<<<<<<<<<<<<<
 *             raise UnsupportedOperation(
 *                 "Cluster.set_max_connections_per_host() only has an effect "
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":774
 *         """
 *         if self.protocol_version >= 3:
 *             raise UnsupportedOperation(             # <<<<<<<<<<<<<<
 *                 "Cluster.set_max_connections_per_host() only has an effect "
 *                 "when using protocol_version 1 or 2.")
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_UnsupportedOperation); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":777
 *                 "Cluster.set_max_connections_per_host() only has an effect "
 *                 "when using protocol_version 1 or 2.")
 *         self._max_connections_per_host[host_distance] = max_connections             # <<<<<<<<<<<<<<
 * 
 *     def connection_factory(self, address, *args, **kwargs):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_connections_per_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_host_distance, __pyx_v_max_connections) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":761
 *         return self._max_connections_per_host[host_distance]
 * 
 *     def set_max_connections_per_host(self, host_distance, max_connections):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the maximum number of connections per Session that will be opened
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.set_max_connections_per_host", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":779
 *         self._max_connections_per_host[host_distance] = max_connections
 * 
 *     def connection_factory(self, address, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Called to create a new connection with proper configuration.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_25connection_factory(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_24connection_factory[] = "\n        Called to create a new connection with proper configuration.\n        Intended for internal use only.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_25connection_factory = {"connection_factory", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_25connection_factory, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_24connection_factory};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_25connection_factory(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_address = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_factory (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_address,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_address)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("connection_factory", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "connection_factory") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_address = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("connection_factory", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.connection_factory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_24connection_factory(__pyx_self, __pyx_v_self, __pyx_v_address, __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_24connection_factory(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_address, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connection_factory", 0);
  __Pyx_INCREF(__pyx_v_kwargs);

  /* "cassandra/cluster.py":784
 *         Intended for internal use only.
 *         """
 *         kwargs = self._make_connection_kwargs(address, kwargs)             # <<<<<<<<<<<<<<
 *         return self.connection_class.factory(address, self.connect_timeout, *args, **kwargs)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_make_connection_kwargs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_v_address);
  __Pyx_GIVEREF(__pyx_v_address);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_address);
  __Pyx_INCREF(__pyx_v_kwargs);
  __Pyx_GIVEREF(__pyx_v_kwargs);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_kwargs);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_kwargs, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":785
 *         """
 *         kwargs = self._make_connection_kwargs(address, kwargs)
 *         return self.connection_class.factory(address, self.connect_timeout, *args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def _make_connection_factory(self, host, *args, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_factory); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connect_timeout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_address);
  __Pyx_GIVEREF(__pyx_v_address);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_address);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_v_kwargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (likely(PyDict_Check(__pyx_v_kwargs))) {
    __pyx_t_1 = __pyx_v_kwargs;
    __Pyx_INCREF(__pyx_t_1);
  } else {
    __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":779
 *         self._max_connections_per_host[host_distance] = max_connections
 * 
 *     def connection_factory(self, address, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Called to create a new connection with proper configuration.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.connection_factory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":787
 *         return self.connection_class.factory(address, self.connect_timeout, *args, **kwargs)
 * 
 *     def _make_connection_factory(self, host, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         kwargs = self._make_connection_kwargs(host.address, kwargs)
 *         return partial(self.connection_class.factory, host.address, self.connect_timeout, *args, **kwargs)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_27_make_connection_factory(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_27_make_connection_factory = {"_make_connection_factory", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_27_make_connection_factory, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_27_make_connection_factory(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_make_connection_factory (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_make_connection_factory", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "_make_connection_factory") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_make_connection_factory", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("cassandra.cluster.Cluster._make_connection_factory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_26_make_connection_factory(__pyx_self, __pyx_v_self, __pyx_v_host, __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_26_make_connection_factory(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_make_connection_factory", 0);
  __Pyx_INCREF(__pyx_v_kwargs);

  /* "cassandra/cluster.py":788
 * 
 *     def _make_connection_factory(self, host, *args, **kwargs):
 *         kwargs = self._make_connection_kwargs(host.address, kwargs)             # <<<<<<<<<<<<<<
 *         return partial(self.connection_class.factory, host.address, self.connect_timeout, *args, **kwargs)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_make_connection_kwargs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_address); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
  __Pyx_INCREF(__pyx_v_kwargs);
  __Pyx_GIVEREF(__pyx_v_kwargs);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs);
  __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_kwargs, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":789
 *     def _make_connection_factory(self, host, *args, **kwargs):
 *         kwargs = self._make_connection_kwargs(host.address, kwargs)
 *         return partial(self.connection_class.factory, host.address, self.connect_timeout, *args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def _make_connection_kwargs(self, address, kwargs_dict):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_partial); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_class); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_factory); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_address); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connect_timeout); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __pyx_t_6 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(__pyx_v_kwargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (likely(PyDict_Check(__pyx_v_kwargs))) {
    __pyx_t_3 = __pyx_v_kwargs;
    __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":787
 *         return self.connection_class.factory(address, self.connect_timeout, *args, **kwargs)
 * 
 *     def _make_connection_factory(self, host, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         kwargs = self._make_connection_kwargs(host.address, kwargs)
 *         return partial(self.connection_class.factory, host.address, self.connect_timeout, *args, **kwargs)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.Cluster._make_connection_factory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":791
 *         return partial(self.connection_class.factory, host.address, self.connect_timeout, *args, **kwargs)
 * 
 *     def _make_connection_kwargs(self, address, kwargs_dict):             # <<<<<<<<<<<<<<
 *         if self._auth_provider_callable:
 *             kwargs_dict.setdefault('authenticator', self._auth_provider_callable(address))
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_29_make_connection_kwargs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_29_make_connection_kwargs = {"_make_connection_kwargs", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_29_make_connection_kwargs, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_29_make_connection_kwargs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_address = 0;
  PyObject *__pyx_v_kwargs_dict = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_make_connection_kwargs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_address,&__pyx_n_s_kwargs_dict,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_address)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_make_connection_kwargs", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs_dict)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_make_connection_kwargs", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_make_connection_kwargs") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_address = values[1];
    __pyx_v_kwargs_dict = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_make_connection_kwargs", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster._make_connection_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_28_make_connection_kwargs(__pyx_self, __pyx_v_self, __pyx_v_address, __pyx_v_kwargs_dict);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_28_make_connection_kwargs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_address, PyObject *__pyx_v_kwargs_dict) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_make_connection_kwargs", 0);

  /* "cassandra/cluster.py":792
 * 
 *     def _make_connection_kwargs(self, address, kwargs_dict):
 *         if self._auth_provider_callable:             # <<<<<<<<<<<<<<
 *             kwargs_dict.setdefault('authenticator', self._auth_provider_callable(address))
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_auth_provider_callable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":793
 *     def _make_connection_kwargs(self, address, kwargs_dict):
 *         if self._auth_provider_callable:
 *             kwargs_dict.setdefault('authenticator', self._auth_provider_callable(address))             # <<<<<<<<<<<<<<
 * 
 *         kwargs_dict.setdefault('port', self.port)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_kwargs_dict, __pyx_n_s_setdefault); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_auth_provider_callable); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_address); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_v_address);
      __Pyx_GIVEREF(__pyx_v_address);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_address);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_8 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_n_s_authenticator);
    __Pyx_GIVEREF(__pyx_n_s_authenticator);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_n_s_authenticator);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":795
 *             kwargs_dict.setdefault('authenticator', self._auth_provider_callable(address))
 * 
 *         kwargs_dict.setdefault('port', self.port)             # <<<<<<<<<<<<<<
 *         kwargs_dict.setdefault('compression', self.compression)
 *         kwargs_dict.setdefault('sockopts', self.sockopts)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_kwargs_dict, __pyx_n_s_setdefault); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_port); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_n_s_port);
  __Pyx_GIVEREF(__pyx_n_s_port);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_n_s_port);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":796
 * 
 *         kwargs_dict.setdefault('port', self.port)
 *         kwargs_dict.setdefault('compression', self.compression)             # <<<<<<<<<<<<<<
 *         kwargs_dict.setdefault('sockopts', self.sockopts)
 *         kwargs_dict.setdefault('ssl_options', self.ssl_options)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_kwargs_dict, __pyx_n_s_setdefault); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_compression); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_t_7) {
    __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
  }
  __Pyx_INCREF(__pyx_n_s_compression);
  __Pyx_GIVEREF(__pyx_n_s_compression);
  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_n_s_compression);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":797
 *         kwargs_dict.setdefault('port', self.port)
 *         kwargs_dict.setdefault('compression', self.compression)
 *         kwargs_dict.setdefault('sockopts', self.sockopts)             # <<<<<<<<<<<<<<
 *         kwargs_dict.setdefault('ssl_options', self.ssl_options)
 *         kwargs_dict.setdefault('cql_version', self.cql_version)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_kwargs_dict, __pyx_n_s_setdefault); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sockopts); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_n_s_sockopts);
  __Pyx_GIVEREF(__pyx_n_s_sockopts);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_n_s_sockopts);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":798
 *         kwargs_dict.setdefault('compression', self.compression)
 *         kwargs_dict.setdefault('sockopts', self.sockopts)
 *         kwargs_dict.setdefault('ssl_options', self.ssl_options)             # <<<<<<<<<<<<<<
 *         kwargs_dict.setdefault('cql_version', self.cql_version)
 *         kwargs_dict.setdefault('protocol_version', self.protocol_version)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_kwargs_dict, __pyx_n_s_setdefault); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ssl_options); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_n_s_ssl_options);
  __Pyx_GIVEREF(__pyx_n_s_ssl_options);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_n_s_ssl_options);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":799
 *         kwargs_dict.setdefault('sockopts', self.sockopts)
 *         kwargs_dict.setdefault('ssl_options', self.ssl_options)
 *         kwargs_dict.setdefault('cql_version', self.cql_version)             # <<<<<<<<<<<<<<
 *         kwargs_dict.setdefault('protocol_version', self.protocol_version)
 *         kwargs_dict.setdefault('user_type_map', self._user_types)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_kwargs_dict, __pyx_n_s_setdefault); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cql_version); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_t_7) {
    __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
  }
  __Pyx_INCREF(__pyx_n_s_cql_version);
  __Pyx_GIVEREF(__pyx_n_s_cql_version);
  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_n_s_cql_version);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":800
 *         kwargs_dict.setdefault('ssl_options', self.ssl_options)
 *         kwargs_dict.setdefault('cql_version', self.cql_version)
 *         kwargs_dict.setdefault('protocol_version', self.protocol_version)             # <<<<<<<<<<<<<<
 *         kwargs_dict.setdefault('user_type_map', self._user_types)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_kwargs_dict, __pyx_n_s_setdefault); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_n_s_protocol_version);
  __Pyx_GIVEREF(__pyx_n_s_protocol_version);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_n_s_protocol_version);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":801
 *         kwargs_dict.setdefault('cql_version', self.cql_version)
 *         kwargs_dict.setdefault('protocol_version', self.protocol_version)
 *         kwargs_dict.setdefault('user_type_map', self._user_types)             # <<<<<<<<<<<<<<
 * 
 *         return kwargs_dict
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_kwargs_dict, __pyx_n_s_setdefault); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_user_types); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_n_s_user_type_map);
  __Pyx_GIVEREF(__pyx_n_s_user_type_map);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_n_s_user_type_map);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":803
 *         kwargs_dict.setdefault('user_type_map', self._user_types)
 * 
 *         return kwargs_dict             # <<<<<<<<<<<<<<
 * 
 *     def protocol_downgrade(self, host_addr, previous_version):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_kwargs_dict);
  __pyx_r = __pyx_v_kwargs_dict;
  goto __pyx_L0;

  /* "cassandra/cluster.py":791
 *         return partial(self.connection_class.factory, host.address, self.connect_timeout, *args, **kwargs)
 * 
 *     def _make_connection_kwargs(self, address, kwargs_dict):             # <<<<<<<<<<<<<<
 *         if self._auth_provider_callable:
 *             kwargs_dict.setdefault('authenticator', self._auth_provider_callable(address))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.Cluster._make_connection_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":805
 *         return kwargs_dict
 * 
 *     def protocol_downgrade(self, host_addr, previous_version):             # <<<<<<<<<<<<<<
 *         new_version = previous_version - 1
 *         if new_version < self.protocol_version:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_31protocol_downgrade(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_31protocol_downgrade = {"protocol_downgrade", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_31protocol_downgrade, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_31protocol_downgrade(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host_addr = 0;
  PyObject *__pyx_v_previous_version = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("protocol_downgrade (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host_addr,&__pyx_n_s_previous_version,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host_addr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("protocol_downgrade", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_previous_version)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("protocol_downgrade", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "protocol_downgrade") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_host_addr = values[1];
    __pyx_v_previous_version = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("protocol_downgrade", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.protocol_downgrade", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_30protocol_downgrade(__pyx_self, __pyx_v_self, __pyx_v_host_addr, __pyx_v_previous_version);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_30protocol_downgrade(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host_addr, PyObject *__pyx_v_previous_version) {
  PyObject *__pyx_v_new_version = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("protocol_downgrade", 0);

  /* "cassandra/cluster.py":806
 * 
 *     def protocol_downgrade(self, host_addr, previous_version):
 *         new_version = previous_version - 1             # <<<<<<<<<<<<<<
 *         if new_version < self.protocol_version:
 *             if new_version >= MIN_SUPPORTED_VERSION:
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_previous_version, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_new_version = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":807
 *     def protocol_downgrade(self, host_addr, previous_version):
 *         new_version = previous_version - 1
 *         if new_version < self.protocol_version:             # <<<<<<<<<<<<<<
 *             if new_version >= MIN_SUPPORTED_VERSION:
 *                 log.warning("Downgrading core protocol version from %d to %d for %s", self.protocol_version, new_version, host_addr)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_new_version, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":808
 *         new_version = previous_version - 1
 *         if new_version < self.protocol_version:
 *             if new_version >= MIN_SUPPORTED_VERSION:             # <<<<<<<<<<<<<<
 *                 log.warning("Downgrading core protocol version from %d to %d for %s", self.protocol_version, new_version, host_addr)
 *                 self.protocol_version = new_version
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_MIN_SUPPORTED_VERSION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_new_version, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "cassandra/cluster.py":809
 *         if new_version < self.protocol_version:
 *             if new_version >= MIN_SUPPORTED_VERSION:
 *                 log.warning("Downgrading core protocol version from %d to %d for %s", self.protocol_version, new_version, host_addr)             # <<<<<<<<<<<<<<
 *                 self.protocol_version = new_version
 *             else:
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_warning); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      __pyx_t_7 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_Downgrading_core_protocol_versio);
      __Pyx_GIVEREF(__pyx_kp_s_Downgrading_core_protocol_versio);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Downgrading_core_protocol_versio);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
      __Pyx_INCREF(__pyx_v_new_version);
      __Pyx_GIVEREF(__pyx_v_new_version);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_new_version);
      __Pyx_INCREF(__pyx_v_host_addr);
      __Pyx_GIVEREF(__pyx_v_host_addr);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_6, __pyx_v_host_addr);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "cassandra/cluster.py":810
 *             if new_version >= MIN_SUPPORTED_VERSION:
 *                 log.warning("Downgrading core protocol version from %d to %d for %s", self.protocol_version, new_version, host_addr)
 *                 self.protocol_version = new_version             # <<<<<<<<<<<<<<
 *             else:
 *                 raise Exception("Cannot downgrade protocol version (%d) below minimum supported version: %d" % (new_version, MIN_SUPPORTED_VERSION))
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version, __pyx_v_new_version) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    /*else*/ {

      /* "cassandra/cluster.py":812
 *                 self.protocol_version = new_version
 *             else:
 *                 raise Exception("Cannot downgrade protocol version (%d) below minimum supported version: %d" % (new_version, MIN_SUPPORTED_VERSION))             # <<<<<<<<<<<<<<
 * 
 *     def connect(self, keyspace=None):
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_MIN_SUPPORTED_VERSION); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_new_version);
      __Pyx_GIVEREF(__pyx_v_new_version);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_new_version);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Cannot_downgrade_protocol_versio, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":805
 *         return kwargs_dict
 * 
 *     def protocol_downgrade(self, host_addr, previous_version):             # <<<<<<<<<<<<<<
 *         new_version = previous_version - 1
 *         if new_version < self.protocol_version:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.protocol_downgrade", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_new_version);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":814
 *                 raise Exception("Cannot downgrade protocol version (%d) below minimum supported version: %d" % (new_version, MIN_SUPPORTED_VERSION))
 * 
 *     def connect(self, keyspace=None):             # <<<<<<<<<<<<<<
 *         """
 *         Creates and returns a new :class:`~.Session` object.  If `keyspace`
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_33connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_32connect[] = "\n        Creates and returns a new :class:`~.Session` object.  If `keyspace`\n        is specified, that keyspace will be the default keyspace for\n        operations on the ``Session``.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_33connect = {"connect", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_33connect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_32connect};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_33connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keyspace = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_keyspace,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "connect") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_keyspace = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("connect", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_32connect(__pyx_self, __pyx_v_self, __pyx_v_keyspace);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_32connect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace) {
  PyObject *__pyx_v_address = NULL;
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_new = NULL;
  PyObject *__pyx_v_listener = NULL;
  PyObject *__pyx_v_session = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *(*__pyx_t_15)(PyObject *);
  PyObject *(*__pyx_t_16)(PyObject *);
  Py_ssize_t __pyx_t_17;
  PyObject *(*__pyx_t_18)(PyObject *);
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  int __pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connect", 0);

  /* "cassandra/cluster.py":820
 *         operations on the ``Session``.
 *         """
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self.is_shutdown:
 *                 raise Exception("Cluster is already shut down")
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cassandra/cluster.py":821
 *         """
 *         with self._lock:
 *             if self.is_shutdown:             # <<<<<<<<<<<<<<
 *                 raise Exception("Cluster is already shut down")
 * 
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_9) {

            /* "cassandra/cluster.py":822
 *         with self._lock:
 *             if self.is_shutdown:
 *                 raise Exception("Cluster is already shut down")             # <<<<<<<<<<<<<<
 * 
 *             if not self._is_setup:
 */
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_Raise(__pyx_t_1, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          }

          /* "cassandra/cluster.py":824
 *                 raise Exception("Cluster is already shut down")
 * 
 *             if not self._is_setup:             # <<<<<<<<<<<<<<
 *                 log.debug("Connecting to cluster, contact points: %s; protocol version: %s",
 *                           self.contact_points, self.protocol_version)
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_setup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_10 = ((!__pyx_t_9) != 0);
          if (__pyx_t_10) {

            /* "cassandra/cluster.py":825
 * 
 *             if not self._is_setup:
 *                 log.debug("Connecting to cluster, contact points: %s; protocol version: %s",             # <<<<<<<<<<<<<<
 *                           self.contact_points, self.protocol_version)
 *                 self.connection_class.initialize_reactor()
 */
            __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "cassandra/cluster.py":826
 *             if not self._is_setup:
 *                 log.debug("Connecting to cluster, contact points: %s; protocol version: %s",
 *                           self.contact_points, self.protocol_version)             # <<<<<<<<<<<<<<
 *                 self.connection_class.initialize_reactor()
 *                 atexit.register(partial(_shutdown_cluster, self))
 */
            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_contact_points); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_11 = NULL;
            __pyx_t_12 = 0;
            if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4);
              if (likely(__pyx_t_11)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                __Pyx_INCREF(__pyx_t_11);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_4, function);
                __pyx_t_12 = 1;
              }
            }
            __pyx_t_13 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_13);
            if (__pyx_t_11) {
              __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
            }
            __Pyx_INCREF(__pyx_kp_s_Connecting_to_cluster_contact_po);
            __Pyx_GIVEREF(__pyx_kp_s_Connecting_to_cluster_contact_po);
            PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_kp_s_Connecting_to_cluster_contact_po);
            __Pyx_GIVEREF(__pyx_t_3);
            PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_5);
            PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_12, __pyx_t_5);
            __pyx_t_3 = 0;
            __pyx_t_5 = 0;
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "cassandra/cluster.py":827
 *                 log.debug("Connecting to cluster, contact points: %s; protocol version: %s",
 *                           self.contact_points, self.protocol_version)
 *                 self.connection_class.initialize_reactor()             # <<<<<<<<<<<<<<
 *                 atexit.register(partial(_shutdown_cluster, self))
 *                 for address in self.contact_points:
 */
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_class); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_initialize_reactor); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_4 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_13))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_13);
              if (likely(__pyx_t_4)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_13, function);
              }
            }
            if (__pyx_t_4) {
              __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            } else {
              __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            }
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "cassandra/cluster.py":828
 *                           self.contact_points, self.protocol_version)
 *                 self.connection_class.initialize_reactor()
 *                 atexit.register(partial(_shutdown_cluster, self))             # <<<<<<<<<<<<<<
 *                 for address in self.contact_points:
 *                     host, new = self.add_host(address, signal=False)
 */
            __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_atexit); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_register); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_partial); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_shutdown_cluster); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_11 = NULL;
            __pyx_t_12 = 0;
            if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
              __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5);
              if (likely(__pyx_t_11)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
                __Pyx_INCREF(__pyx_t_11);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_5, function);
                __pyx_t_12 = 1;
              }
            }
            __pyx_t_14 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_14);
            if (__pyx_t_11) {
              __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_11); __pyx_t_11 = NULL;
            }
            __Pyx_GIVEREF(__pyx_t_3);
            PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_12, __pyx_t_3);
            __Pyx_INCREF(__pyx_v_self);
            __Pyx_GIVEREF(__pyx_v_self);
            PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_12, __pyx_v_self);
            __pyx_t_3 = 0;
            __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_14, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __pyx_t_5 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
              if (likely(__pyx_t_5)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                __Pyx_INCREF(__pyx_t_5);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_4, function);
              }
            }
            if (!__pyx_t_5) {
              __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_GOTREF(__pyx_t_1);
            } else {
              __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5); __pyx_t_5 = NULL;
              __Pyx_GIVEREF(__pyx_t_13);
              PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_13);
              __pyx_t_13 = 0;
              __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            }
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "cassandra/cluster.py":829
 *                 self.connection_class.initialize_reactor()
 *                 atexit.register(partial(_shutdown_cluster, self))
 *                 for address in self.contact_points:             # <<<<<<<<<<<<<<
 *                     host, new = self.add_host(address, signal=False)
 *                     if new:
 */
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_contact_points); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_1);
            if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
              __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_12 = 0;
              __pyx_t_15 = NULL;
            } else {
              __pyx_t_12 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_15 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            for (;;) {
              if (likely(!__pyx_t_15)) {
                if (likely(PyList_CheckExact(__pyx_t_4))) {
                  if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_4)) break;
                  #if CYTHON_COMPILING_IN_CPYTHON
                  __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  #else
                  __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  __Pyx_GOTREF(__pyx_t_1);
                  #endif
                } else {
                  if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
                  #if CYTHON_COMPILING_IN_CPYTHON
                  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  #else
                  __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  __Pyx_GOTREF(__pyx_t_1);
                  #endif
                }
              } else {
                __pyx_t_1 = __pyx_t_15(__pyx_t_4);
                if (unlikely(!__pyx_t_1)) {
                  PyObject* exc_type = PyErr_Occurred();
                  if (exc_type) {
                    if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                    else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  }
                  break;
                }
                __Pyx_GOTREF(__pyx_t_1);
              }
              __Pyx_XDECREF_SET(__pyx_v_address, __pyx_t_1);
              __pyx_t_1 = 0;

              /* "cassandra/cluster.py":830
 *                 atexit.register(partial(_shutdown_cluster, self))
 *                 for address in self.contact_points:
 *                     host, new = self.add_host(address, signal=False)             # <<<<<<<<<<<<<<
 *                     if new:
 *                         host.set_up()
 */
              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_add_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_INCREF(__pyx_v_address);
              __Pyx_GIVEREF(__pyx_v_address);
              PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_address);
              __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_13);
              if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_signal, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
                PyObject* sequence = __pyx_t_5;
                #if CYTHON_COMPILING_IN_CPYTHON
                Py_ssize_t size = Py_SIZE(sequence);
                #else
                Py_ssize_t size = PySequence_Size(sequence);
                #endif
                if (unlikely(size != 2)) {
                  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
                  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                }
                #if CYTHON_COMPILING_IN_CPYTHON
                if (likely(PyTuple_CheckExact(sequence))) {
                  __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0); 
                  __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
                } else {
                  __pyx_t_13 = PyList_GET_ITEM(sequence, 0); 
                  __pyx_t_14 = PyList_GET_ITEM(sequence, 1); 
                }
                __Pyx_INCREF(__pyx_t_13);
                __Pyx_INCREF(__pyx_t_14);
                #else
                __pyx_t_13 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __Pyx_GOTREF(__pyx_t_13);
                __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __Pyx_GOTREF(__pyx_t_14);
                #endif
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              } else {
                Py_ssize_t index = -1;
                __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                __pyx_t_16 = Py_TYPE(__pyx_t_1)->tp_iternext;
                index = 0; __pyx_t_13 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_13)) goto __pyx_L19_unpacking_failed;
                __Pyx_GOTREF(__pyx_t_13);
                index = 1; __pyx_t_14 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_14)) goto __pyx_L19_unpacking_failed;
                __Pyx_GOTREF(__pyx_t_14);
                if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __pyx_t_16 = NULL;
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                goto __pyx_L20_unpacking_done;
                __pyx_L19_unpacking_failed:;
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                __pyx_t_16 = NULL;
                if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __pyx_L20_unpacking_done:;
              }
              __Pyx_XDECREF_SET(__pyx_v_host, __pyx_t_13);
              __pyx_t_13 = 0;
              __Pyx_XDECREF_SET(__pyx_v_new, __pyx_t_14);
              __pyx_t_14 = 0;

              /* "cassandra/cluster.py":831
 *                 for address in self.contact_points:
 *                     host, new = self.add_host(address, signal=False)
 *                     if new:             # <<<<<<<<<<<<<<
 *                         host.set_up()
 *                         for listener in self.listeners:
 */
              __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_new); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              if (__pyx_t_10) {

                /* "cassandra/cluster.py":832
 *                     host, new = self.add_host(address, signal=False)
 *                     if new:
 *                         host.set_up()             # <<<<<<<<<<<<<<
 *                         for listener in self.listeners:
 *                             listener.on_add(host)
 */
                __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_set_up); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __Pyx_GOTREF(__pyx_t_14);
                __pyx_t_13 = NULL;
                if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
                  __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
                  if (likely(__pyx_t_13)) {
                    PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
                    __Pyx_INCREF(__pyx_t_13);
                    __Pyx_INCREF(function);
                    __Pyx_DECREF_SET(__pyx_t_14, function);
                  }
                }
                if (__pyx_t_13) {
                  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                } else {
                  __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                }
                __Pyx_GOTREF(__pyx_t_5);
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

                /* "cassandra/cluster.py":833
 *                     if new:
 *                         host.set_up()
 *                         for listener in self.listeners:             # <<<<<<<<<<<<<<
 *                             listener.on_add(host)
 * 
 */
                __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_listeners_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __Pyx_GOTREF(__pyx_t_5);
                if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
                  __pyx_t_14 = __pyx_t_5; __Pyx_INCREF(__pyx_t_14); __pyx_t_17 = 0;
                  __pyx_t_18 = NULL;
                } else {
                  __pyx_t_17 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  __Pyx_GOTREF(__pyx_t_14);
                  __pyx_t_18 = Py_TYPE(__pyx_t_14)->tp_iternext; if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                }
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                for (;;) {
                  if (likely(!__pyx_t_18)) {
                    if (likely(PyList_CheckExact(__pyx_t_14))) {
                      if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_14)) break;
                      #if CYTHON_COMPILING_IN_CPYTHON
                      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_17); __Pyx_INCREF(__pyx_t_5); __pyx_t_17++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                      #else
                      __pyx_t_5 = PySequence_ITEM(__pyx_t_14, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                      __Pyx_GOTREF(__pyx_t_5);
                      #endif
                    } else {
                      if (__pyx_t_17 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
                      #if CYTHON_COMPILING_IN_CPYTHON
                      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_17); __Pyx_INCREF(__pyx_t_5); __pyx_t_17++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                      #else
                      __pyx_t_5 = PySequence_ITEM(__pyx_t_14, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                      __Pyx_GOTREF(__pyx_t_5);
                      #endif
                    }
                  } else {
                    __pyx_t_5 = __pyx_t_18(__pyx_t_14);
                    if (unlikely(!__pyx_t_5)) {
                      PyObject* exc_type = PyErr_Occurred();
                      if (exc_type) {
                        if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                        else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                      }
                      break;
                    }
                    __Pyx_GOTREF(__pyx_t_5);
                  }
                  __Pyx_XDECREF_SET(__pyx_v_listener, __pyx_t_5);
                  __pyx_t_5 = 0;

                  /* "cassandra/cluster.py":834
 *                         host.set_up()
 *                         for listener in self.listeners:
 *                             listener.on_add(host)             # <<<<<<<<<<<<<<
 * 
 *                 self.load_balancing_policy.populate(
 */
                  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_listener, __pyx_n_s_on_add); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  __Pyx_GOTREF(__pyx_t_13);
                  __pyx_t_1 = NULL;
                  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_13))) {
                    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_13);
                    if (likely(__pyx_t_1)) {
                      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
                      __Pyx_INCREF(__pyx_t_1);
                      __Pyx_INCREF(function);
                      __Pyx_DECREF_SET(__pyx_t_13, function);
                    }
                  }
                  if (!__pyx_t_1) {
                    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_host); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                    __Pyx_GOTREF(__pyx_t_5);
                  } else {
                    __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                    __Pyx_GOTREF(__pyx_t_3);
                    __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
                    __Pyx_INCREF(__pyx_v_host);
                    __Pyx_GIVEREF(__pyx_v_host);
                    PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_host);
                    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                    __Pyx_GOTREF(__pyx_t_5);
                    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                  }
                  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

                  /* "cassandra/cluster.py":833
 *                     if new:
 *                         host.set_up()
 *                         for listener in self.listeners:             # <<<<<<<<<<<<<<
 *                             listener.on_add(host)
 * 
 */
                }
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                goto __pyx_L21;
              }
              __pyx_L21:;

              /* "cassandra/cluster.py":829
 *                 self.connection_class.initialize_reactor()
 *                 atexit.register(partial(_shutdown_cluster, self))
 *                 for address in self.contact_points:             # <<<<<<<<<<<<<<
 *                     host, new = self.add_host(address, signal=False)
 *                     if new:
 */
            }
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

            /* "cassandra/cluster.py":836
 *                             listener.on_add(host)
 * 
 *                 self.load_balancing_policy.populate(             # <<<<<<<<<<<<<<
 *                     weakref.proxy(self), self.metadata.all_hosts())
 * 
 */
            __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_load_balancing_policy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_populate); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

            /* "cassandra/cluster.py":837
 * 
 *                 self.load_balancing_policy.populate(
 *                     weakref.proxy(self), self.metadata.all_hosts())             # <<<<<<<<<<<<<<
 * 
 *                 try:
 */
            __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_weakref); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_proxy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __pyx_t_13 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
              __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_3);
              if (likely(__pyx_t_13)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                __Pyx_INCREF(__pyx_t_13);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_3, function);
              }
            }
            if (!__pyx_t_13) {
              __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_14);
            } else {
              __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_13); __pyx_t_13 = NULL;
              __Pyx_INCREF(__pyx_v_self);
              __Pyx_GIVEREF(__pyx_v_self);
              PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_self);
              __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            }
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metadata); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_all_hosts); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_t_1 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_13))) {
              __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_13);
              if (likely(__pyx_t_1)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
                __Pyx_INCREF(__pyx_t_1);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_13, function);
              }
            }
            if (__pyx_t_1) {
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            } else {
              __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            }
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __pyx_t_13 = NULL;
            __pyx_t_12 = 0;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
              __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_5);
              if (likely(__pyx_t_13)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
                __Pyx_INCREF(__pyx_t_13);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_5, function);
                __pyx_t_12 = 1;
              }
            }
            __pyx_t_1 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_1);
            if (__pyx_t_13) {
              __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_13); __pyx_t_13 = NULL;
            }
            __Pyx_GIVEREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_12, __pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_3);
            PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_12, __pyx_t_3);
            __pyx_t_14 = 0;
            __pyx_t_3 = 0;
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

            /* "cassandra/cluster.py":839
 *                     weakref.proxy(self), self.metadata.all_hosts())
 * 
 *                 try:             # <<<<<<<<<<<<<<
 *                     self.control_connection.connect()
 *                     log.debug("Control connection created")
 */
            {
              __Pyx_ExceptionSave(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
              __Pyx_XGOTREF(__pyx_t_19);
              __Pyx_XGOTREF(__pyx_t_20);
              __Pyx_XGOTREF(__pyx_t_21);
              /*try:*/ {

                /* "cassandra/cluster.py":840
 * 
 *                 try:
 *                     self.control_connection.connect()             # <<<<<<<<<<<<<<
 *                     log.debug("Control connection created")
 *                 except Exception:
 */
                __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
                __Pyx_GOTREF(__pyx_t_5);
                __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_connect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                __pyx_t_5 = NULL;
                if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
                  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
                  if (likely(__pyx_t_5)) {
                    PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
                    __Pyx_INCREF(__pyx_t_5);
                    __Pyx_INCREF(function);
                    __Pyx_DECREF_SET(__pyx_t_1, function);
                  }
                }
                if (__pyx_t_5) {
                  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
                  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                } else {
                  __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
                }
                __Pyx_GOTREF(__pyx_t_4);
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

                /* "cassandra/cluster.py":841
 *                 try:
 *                     self.control_connection.connect()
 *                     log.debug("Control connection created")             # <<<<<<<<<<<<<<
 *                 except Exception:
 *                     log.exception("Control connection failed to connect, "
 */
                __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
                __Pyx_GOTREF(__pyx_t_4);
                __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
                __Pyx_GOTREF(__pyx_t_4);
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              }
              __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
              __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
              __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
              goto __pyx_L31_try_end;
              __pyx_L24_error:;
              __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

              /* "cassandra/cluster.py":842
 *                     self.control_connection.connect()
 *                     log.debug("Control connection created")
 *                 except Exception:             # <<<<<<<<<<<<<<
 *                     log.exception("Control connection failed to connect, "
 *                                   "shutting down Cluster:")
 */
              __pyx_t_22 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
              if (__pyx_t_22) {
                __Pyx_AddTraceback("cassandra.cluster.Cluster.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
                if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
                __Pyx_GOTREF(__pyx_t_4);
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_GOTREF(__pyx_t_5);

                /* "cassandra/cluster.py":843
 *                     log.debug("Control connection created")
 *                 except Exception:
 *                     log.exception("Control connection failed to connect, "             # <<<<<<<<<<<<<<
 *                                   "shutting down Cluster:")
 *                     self.shutdown()
 */
                __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
                __Pyx_GOTREF(__pyx_t_3);
                __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exception); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
                __Pyx_GOTREF(__pyx_t_14);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

                /* "cassandra/cluster.py":845
 *                     log.exception("Control connection failed to connect, "
 *                                   "shutting down Cluster:")
 *                     self.shutdown()             # <<<<<<<<<<<<<<
 *                     raise
 * 
 */
                __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shutdown); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
                __Pyx_GOTREF(__pyx_t_14);
                __pyx_t_13 = NULL;
                if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
                  __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
                  if (likely(__pyx_t_13)) {
                    PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
                    __Pyx_INCREF(__pyx_t_13);
                    __Pyx_INCREF(function);
                    __Pyx_DECREF_SET(__pyx_t_14, function);
                  }
                }
                if (__pyx_t_13) {
                  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
                  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                } else {
                  __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
                }
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

                /* "cassandra/cluster.py":846
 *                                   "shutting down Cluster:")
 *                     self.shutdown()
 *                     raise             # <<<<<<<<<<<<<<
 * 
 *                 self.load_balancing_policy.check_supported()
 */
                __Pyx_GIVEREF(__pyx_t_4);
                __Pyx_GIVEREF(__pyx_t_1);
                __Pyx_XGIVEREF(__pyx_t_5);
                __Pyx_ErrRestore(__pyx_t_4, __pyx_t_1, __pyx_t_5);
                __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_5 = 0; 
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
              }
              goto __pyx_L26_except_error;
              __pyx_L26_except_error:;
              __Pyx_XGIVEREF(__pyx_t_19);
              __Pyx_XGIVEREF(__pyx_t_20);
              __Pyx_XGIVEREF(__pyx_t_21);
              __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
              goto __pyx_L7_error;
              __pyx_L31_try_end:;
            }

            /* "cassandra/cluster.py":848
 *                     raise
 * 
 *                 self.load_balancing_policy.check_supported()             # <<<<<<<<<<<<<<
 * 
 *                 if self.idle_heartbeat_interval:
 */
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_load_balancing_policy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_check_supported); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_t_1 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
              if (likely(__pyx_t_1)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                __Pyx_INCREF(__pyx_t_1);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_4, function);
              }
            }
            if (__pyx_t_1) {
              __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            } else {
              __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            }
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

            /* "cassandra/cluster.py":850
 *                 self.load_balancing_policy.check_supported()
 * 
 *                 if self.idle_heartbeat_interval:             # <<<<<<<<<<<<<<
 *                     self._idle_heartbeat = ConnectionHeartbeat(self.idle_heartbeat_interval, self.get_connection_holders)
 *                 self._is_setup = True
 */
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idle_heartbeat_interval); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (__pyx_t_10) {

              /* "cassandra/cluster.py":851
 * 
 *                 if self.idle_heartbeat_interval:
 *                     self._idle_heartbeat = ConnectionHeartbeat(self.idle_heartbeat_interval, self.get_connection_holders)             # <<<<<<<<<<<<<<
 *                 self._is_setup = True
 * 
 */
              __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConnectionHeartbeat); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idle_heartbeat_interval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_connection_holders); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_14 = NULL;
              __pyx_t_12 = 0;
              if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
                __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_4);
                if (likely(__pyx_t_14)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                  __Pyx_INCREF(__pyx_t_14);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_4, function);
                  __pyx_t_12 = 1;
                }
              }
              __pyx_t_13 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_13);
              if (__pyx_t_14) {
                __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14); __pyx_t_14 = NULL;
              }
              __Pyx_GIVEREF(__pyx_t_1);
              PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_t_1);
              __Pyx_GIVEREF(__pyx_t_3);
              PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_t_3);
              __pyx_t_1 = 0;
              __pyx_t_3 = 0;
              __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_13, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_idle_heartbeat, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              goto __pyx_L34;
            }
            __pyx_L34:;

            /* "cassandra/cluster.py":852
 *                 if self.idle_heartbeat_interval:
 *                     self._idle_heartbeat = ConnectionHeartbeat(self.idle_heartbeat_interval, self.get_connection_holders)
 *                 self._is_setup = True             # <<<<<<<<<<<<<<
 * 
 *         session = self._new_session()
 */
            if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_is_setup, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            goto __pyx_L16;
          }
          __pyx_L16:;
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "cassandra/cluster.py":820
 *         operations on the ``Session``.
 *         """
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self.is_shutdown:
 *                 raise Exception("Cluster is already shut down")
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.Cluster.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_3 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_4, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_21);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_21);
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_9 = ((!(__pyx_t_10 != 0)) != 0);
          if (__pyx_t_9) {
            __Pyx_GIVEREF(__pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_4);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_ErrRestore(__pyx_t_5, __pyx_t_4, __pyx_t_13);
            __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_13 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__20, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L38;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L38:;
  }

  /* "cassandra/cluster.py":854
 *                 self._is_setup = True
 * 
 *         session = self._new_session()             # <<<<<<<<<<<<<<
 *         if keyspace:
 *             session.set_keyspace(keyspace)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_new_session); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_13 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_session = __pyx_t_13;
  __pyx_t_13 = 0;

  /* "cassandra/cluster.py":855
 * 
 *         session = self._new_session()
 *         if keyspace:             # <<<<<<<<<<<<<<
 *             session.set_keyspace(keyspace)
 *         return session
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_keyspace); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_9) {

    /* "cassandra/cluster.py":856
 *         session = self._new_session()
 *         if keyspace:
 *             session.set_keyspace(keyspace)             # <<<<<<<<<<<<<<
 *         return session
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_set_keyspace); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_keyspace); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_keyspace);
      __Pyx_GIVEREF(__pyx_v_keyspace);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_keyspace);
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    goto __pyx_L39;
  }
  __pyx_L39:;

  /* "cassandra/cluster.py":857
 *         if keyspace:
 *             session.set_keyspace(keyspace)
 *         return session             # <<<<<<<<<<<<<<
 * 
 *     def get_connection_holders(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_session);
  __pyx_r = __pyx_v_session;
  goto __pyx_L0;

  /* "cassandra/cluster.py":814
 *                 raise Exception("Cannot downgrade protocol version (%d) below minimum supported version: %d" % (new_version, MIN_SUPPORTED_VERSION))
 * 
 *     def connect(self, keyspace=None):             # <<<<<<<<<<<<<<
 *         """
 *         Creates and returns a new :class:`~.Session` object.  If `keyspace`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_address);
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_new);
  __Pyx_XDECREF(__pyx_v_listener);
  __Pyx_XDECREF(__pyx_v_session);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":859
 *         return session
 * 
 *     def get_connection_holders(self):             # <<<<<<<<<<<<<<
 *         holders = []
 *         for s in self.sessions:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_35get_connection_holders(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_35get_connection_holders = {"get_connection_holders", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_35get_connection_holders, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_35get_connection_holders(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_connection_holders (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_34get_connection_holders(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_34get_connection_holders(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_holders = NULL;
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_connection_holders", 0);

  /* "cassandra/cluster.py":860
 * 
 *     def get_connection_holders(self):
 *         holders = []             # <<<<<<<<<<<<<<
 *         for s in self.sessions:
 *             holders.extend(s.get_pools())
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_holders = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":861
 *     def get_connection_holders(self):
 *         holders = []
 *         for s in self.sessions:             # <<<<<<<<<<<<<<
 *             holders.extend(s.get_pools())
 *         holders.append(self.control_connection)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sessions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":862
 *         holders = []
 *         for s in self.sessions:
 *             holders.extend(s.get_pools())             # <<<<<<<<<<<<<<
 *         holders.append(self.control_connection)
 *         return holders
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_get_pools); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyList_Extend(__pyx_v_holders, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":861
 *     def get_connection_holders(self):
 *         holders = []
 *         for s in self.sessions:             # <<<<<<<<<<<<<<
 *             holders.extend(s.get_pools())
 *         holders.append(self.control_connection)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":863
 *         for s in self.sessions:
 *             holders.extend(s.get_pools())
 *         holders.append(self.control_connection)             # <<<<<<<<<<<<<<
 *         return holders
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_holders, __pyx_t_2); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":864
 *             holders.extend(s.get_pools())
 *         holders.append(self.control_connection)
 *         return holders             # <<<<<<<<<<<<<<
 * 
 *     def shutdown(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_holders);
  __pyx_r = __pyx_v_holders;
  goto __pyx_L0;

  /* "cassandra/cluster.py":859
 *         return session
 * 
 *     def get_connection_holders(self):             # <<<<<<<<<<<<<<
 *         holders = []
 *         for s in self.sessions:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.get_connection_holders", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_holders);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":866
 *         return holders
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         """
 *         Closes all sessions and connection associated with this Cluster.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_37shutdown(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_36shutdown[] = "\n        Closes all sessions and connection associated with this Cluster.\n        To ensure all connections are properly closed, **you should always\n        call shutdown() on a Cluster instance when you are done with it**.\n\n        Once shutdown, a Cluster should not be used for any purpose.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_37shutdown = {"shutdown", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_37shutdown, METH_O, __pyx_doc_9cassandra_7cluster_7Cluster_36shutdown};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_37shutdown(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shutdown (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_36shutdown(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_36shutdown(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_session = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shutdown", 0);

  /* "cassandra/cluster.py":874
 *         Once shutdown, a Cluster should not be used for any purpose.
 *         """
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self.is_shutdown:
 *                 return
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cassandra/cluster.py":875
 *         """
 *         with self._lock:
 *             if self.is_shutdown:             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_9) {

            /* "cassandra/cluster.py":876
 *         with self._lock:
 *             if self.is_shutdown:
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 self.is_shutdown = True
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            goto __pyx_L11_try_return;
          }
          /*else*/ {

            /* "cassandra/cluster.py":878
 *                 return
 *             else:
 *                 self.is_shutdown = True             # <<<<<<<<<<<<<<
 * 
 *         if self._idle_heartbeat:
 */
            if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          }
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":874
 *         Once shutdown, a Cluster should not be used for any purpose.
 *         """
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self.is_shutdown:
 *                 return
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.Cluster.shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (__pyx_t_9 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_11 = ((!(__pyx_t_9 != 0)) != 0);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_4);
            __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L4_return;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__21, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_8 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_2) {
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__22, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __pyx_r = __pyx_t_8;
        __pyx_t_8 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L19;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L19:;
  }

  /* "cassandra/cluster.py":880
 *                 self.is_shutdown = True
 * 
 *         if self._idle_heartbeat:             # <<<<<<<<<<<<<<
 *             self._idle_heartbeat.stop()
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idle_heartbeat); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_11) {

    /* "cassandra/cluster.py":881
 * 
 *         if self._idle_heartbeat:
 *             self._idle_heartbeat.stop()             # <<<<<<<<<<<<<<
 * 
 *         self.scheduler.shutdown()
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_idle_heartbeat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_stop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L20;
  }
  __pyx_L20:;

  /* "cassandra/cluster.py":883
 *             self._idle_heartbeat.stop()
 * 
 *         self.scheduler.shutdown()             # <<<<<<<<<<<<<<
 * 
 *         self.control_connection.shutdown()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scheduler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_shutdown); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":885
 *         self.scheduler.shutdown()
 * 
 *         self.control_connection.shutdown()             # <<<<<<<<<<<<<<
 * 
 *         for session in self.sessions:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_shutdown); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":887
 *         self.control_connection.shutdown()
 * 
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.shutdown()
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sessions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0;
    __pyx_t_13 = NULL;
  } else {
    __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_13 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_13)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_13(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_session, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":888
 * 
 *         for session in self.sessions:
 *             session.shutdown()             # <<<<<<<<<<<<<<
 * 
 *         self.executor.shutdown()
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_shutdown); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":887
 *         self.control_connection.shutdown()
 * 
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.shutdown()
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":890
 *             session.shutdown()
 * 
 *         self.executor.shutdown()             # <<<<<<<<<<<<<<
 * 
 *     def _new_session(self):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_executor); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_shutdown); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":866
 *         return holders
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         """
 *         Closes all sessions and connection associated with this Cluster.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_session);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":892
 *         self.executor.shutdown()
 * 
 *     def _new_session(self):             # <<<<<<<<<<<<<<
 *         session = Session(self, self.metadata.all_hosts())
 *         for keyspace, type_map in six.iteritems(self._user_types):
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_39_new_session(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_39_new_session = {"_new_session", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_39_new_session, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_39_new_session(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_new_session (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_38_new_session(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_38_new_session(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_session = NULL;
  PyObject *__pyx_v_keyspace = NULL;
  PyObject *__pyx_v_type_map = NULL;
  PyObject *__pyx_v_udt_name = NULL;
  PyObject *__pyx_v_klass = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *(*__pyx_t_8)(PyObject *);
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_new_session", 0);

  /* "cassandra/cluster.py":893
 * 
 *     def _new_session(self):
 *         session = Session(self, self.metadata.all_hosts())             # <<<<<<<<<<<<<<
 *         for keyspace, type_map in six.iteritems(self._user_types):
 *             for udt_name, klass in six.iteritems(type_map):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Session); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metadata); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_all_hosts); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_session = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":894
 *     def _new_session(self):
 *         session = Session(self, self.metadata.all_hosts())
 *         for keyspace, type_map in six.iteritems(self._user_types):             # <<<<<<<<<<<<<<
 *             for udt_name, klass in six.iteritems(type_map):
 *                 session.user_type_registered(keyspace, udt_name, klass)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_six); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_iteritems); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_user_types); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_7(__pyx_t_4);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_keyspace, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_type_map, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":895
 *         session = Session(self, self.metadata.all_hosts())
 *         for keyspace, type_map in six.iteritems(self._user_types):
 *             for udt_name, klass in six.iteritems(type_map):             # <<<<<<<<<<<<<<
 *                 session.user_type_registered(keyspace, udt_name, klass)
 *         self.sessions.add(session)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_six); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_iteritems); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_type_map); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_type_map);
      __Pyx_GIVEREF(__pyx_v_type_map);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_type_map);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_10)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_10(__pyx_t_5);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        #else
        __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_8 = Py_TYPE(__pyx_t_11)->tp_iternext;
        index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_3)) goto __pyx_L9_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_2)) goto __pyx_L9_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L10_unpacking_done;
        __pyx_L9_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L10_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_udt_name, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_klass, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "cassandra/cluster.py":896
 *         for keyspace, type_map in six.iteritems(self._user_types):
 *             for udt_name, klass in six.iteritems(type_map):
 *                 session.user_type_registered(keyspace, udt_name, klass)             # <<<<<<<<<<<<<<
 *         self.sessions.add(session)
 *         return session
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_user_type_registered); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      __pyx_t_12 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_12 = 1;
        }
      }
      __pyx_t_11 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_v_keyspace);
      __Pyx_GIVEREF(__pyx_v_keyspace);
      PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_12, __pyx_v_keyspace);
      __Pyx_INCREF(__pyx_v_udt_name);
      __Pyx_GIVEREF(__pyx_v_udt_name);
      PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_12, __pyx_v_udt_name);
      __Pyx_INCREF(__pyx_v_klass);
      __Pyx_GIVEREF(__pyx_v_klass);
      PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_12, __pyx_v_klass);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "cassandra/cluster.py":895
 *         session = Session(self, self.metadata.all_hosts())
 *         for keyspace, type_map in six.iteritems(self._user_types):
 *             for udt_name, klass in six.iteritems(type_map):             # <<<<<<<<<<<<<<
 *                 session.user_type_registered(keyspace, udt_name, klass)
 *         self.sessions.add(session)
 */
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":894
 *     def _new_session(self):
 *         session = Session(self, self.metadata.all_hosts())
 *         for keyspace, type_map in six.iteritems(self._user_types):             # <<<<<<<<<<<<<<
 *             for udt_name, klass in six.iteritems(type_map):
 *                 session.user_type_registered(keyspace, udt_name, klass)
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":897
 *             for udt_name, klass in six.iteritems(type_map):
 *                 session.user_type_registered(keyspace, udt_name, klass)
 *         self.sessions.add(session)             # <<<<<<<<<<<<<<
 *         return session
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sessions); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_add); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_session); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_v_session);
    __Pyx_GIVEREF(__pyx_v_session);
    PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_session);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":898
 *                 session.user_type_registered(keyspace, udt_name, klass)
 *         self.sessions.add(session)
 *         return session             # <<<<<<<<<<<<<<
 * 
 *     def _cleanup_failed_on_up_handling(self, host):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_session);
  __pyx_r = __pyx_v_session;
  goto __pyx_L0;

  /* "cassandra/cluster.py":892
 *         self.executor.shutdown()
 * 
 *     def _new_session(self):             # <<<<<<<<<<<<<<
 *         session = Session(self, self.metadata.all_hosts())
 *         for keyspace, type_map in six.iteritems(self._user_types):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("cassandra.cluster.Cluster._new_session", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_session);
  __Pyx_XDECREF(__pyx_v_keyspace);
  __Pyx_XDECREF(__pyx_v_type_map);
  __Pyx_XDECREF(__pyx_v_udt_name);
  __Pyx_XDECREF(__pyx_v_klass);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":900
 *         return session
 * 
 *     def _cleanup_failed_on_up_handling(self, host):             # <<<<<<<<<<<<<<
 *         self.load_balancing_policy.on_down(host)
 *         self.control_connection.on_down(host)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_41_cleanup_failed_on_up_handling(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_41_cleanup_failed_on_up_handling = {"_cleanup_failed_on_up_handling", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_41_cleanup_failed_on_up_handling, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_41_cleanup_failed_on_up_handling(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_cleanup_failed_on_up_handling (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_cleanup_failed_on_up_handling", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_cleanup_failed_on_up_handling") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_cleanup_failed_on_up_handling", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster._cleanup_failed_on_up_handling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_40_cleanup_failed_on_up_handling(__pyx_self, __pyx_v_self, __pyx_v_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_40_cleanup_failed_on_up_handling(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host) {
  PyObject *__pyx_v_session = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_cleanup_failed_on_up_handling", 0);

  /* "cassandra/cluster.py":901
 * 
 *     def _cleanup_failed_on_up_handling(self, host):
 *         self.load_balancing_policy.on_down(host)             # <<<<<<<<<<<<<<
 *         self.control_connection.on_down(host)
 *         for session in self.sessions:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_load_balancing_policy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_on_down); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_host);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":902
 *     def _cleanup_failed_on_up_handling(self, host):
 *         self.load_balancing_policy.on_down(host)
 *         self.control_connection.on_down(host)             # <<<<<<<<<<<<<<
 *         for session in self.sessions:
 *             session.remove_pool(host)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_on_down); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_host);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":903
 *         self.load_balancing_policy.on_down(host)
 *         self.control_connection.on_down(host)
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.remove_pool(host)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sessions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_session, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":904
 *         self.control_connection.on_down(host)
 *         for session in self.sessions:
 *             session.remove_pool(host)             # <<<<<<<<<<<<<<
 * 
 *         self._start_reconnector(host, is_host_addition=False)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_remove_pool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_host);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":903
 *         self.load_balancing_policy.on_down(host)
 *         self.control_connection.on_down(host)
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.remove_pool(host)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":906
 *             session.remove_pool(host)
 * 
 *         self._start_reconnector(host, is_host_addition=False)             # <<<<<<<<<<<<<<
 * 
 *     def _on_up_future_completed(self, host, futures, results, lock, finished_future):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_start_reconnector); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_host);
  __Pyx_GIVEREF(__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_host);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_is_host_addition, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "cassandra/cluster.py":900
 *         return session
 * 
 *     def _cleanup_failed_on_up_handling(self, host):             # <<<<<<<<<<<<<<
 *         self.load_balancing_policy.on_down(host)
 *         self.control_connection.on_down(host)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.Cluster._cleanup_failed_on_up_handling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_session);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":908
 *         self._start_reconnector(host, is_host_addition=False)
 * 
 *     def _on_up_future_completed(self, host, futures, results, lock, finished_future):             # <<<<<<<<<<<<<<
 *         with lock:
 *             futures.discard(finished_future)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_43_on_up_future_completed(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_43_on_up_future_completed = {"_on_up_future_completed", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_43_on_up_future_completed, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_43_on_up_future_completed(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_futures = 0;
  PyObject *__pyx_v_results = 0;
  PyObject *__pyx_v_lock = 0;
  PyObject *__pyx_v_finished_future = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_up_future_completed (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,&__pyx_n_s_futures,&__pyx_n_s_results,&__pyx_n_s_lock_2,&__pyx_n_s_finished_future,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_on_up_future_completed", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_futures)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_on_up_future_completed", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_results)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_on_up_future_completed", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lock_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_on_up_future_completed", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_finished_future)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_on_up_future_completed", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_on_up_future_completed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
    __pyx_v_futures = values[2];
    __pyx_v_results = values[3];
    __pyx_v_lock = values[4];
    __pyx_v_finished_future = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_on_up_future_completed", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster._on_up_future_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_42_on_up_future_completed(__pyx_self, __pyx_v_self, __pyx_v_host, __pyx_v_futures, __pyx_v_results, __pyx_v_lock, __pyx_v_finished_future);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_42_on_up_future_completed(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_futures, PyObject *__pyx_v_results, PyObject *__pyx_v_lock, PyObject *__pyx_v_finished_future) {
  PyObject *__pyx_v_exc = NULL;
  PyObject *__pyx_v_listener = NULL;
  PyObject *__pyx_v_session = NULL;
  PyObject *__pyx_v_f = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  PyObject *(*__pyx_t_17)(PyObject *);
  PyObject *__pyx_t_18 = NULL;
  int __pyx_t_19;
  char const *__pyx_t_20;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_on_up_future_completed", 0);

  /* "cassandra/cluster.py":909
 * 
 *     def _on_up_future_completed(self, host, futures, results, lock, finished_future):
 *         with lock:             # <<<<<<<<<<<<<<
 *             futures.discard(finished_future)
 * 
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_v_lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_v_lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        /*try:*/ {

          /* "cassandra/cluster.py":910
 *     def _on_up_future_completed(self, host, futures, results, lock, finished_future):
 *         with lock:
 *             futures.discard(finished_future)             # <<<<<<<<<<<<<<
 * 
 *             try:
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_futures, __pyx_n_s_discard); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
            if (likely(__pyx_t_4)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_3, function);
            }
          }
          if (!__pyx_t_4) {
            __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_finished_future); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_2);
          } else {
            __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
            __Pyx_INCREF(__pyx_v_finished_future);
            __Pyx_GIVEREF(__pyx_v_finished_future);
            PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_finished_future);
            __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          }
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "cassandra/cluster.py":912
 *             futures.discard(finished_future)
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 results.append(finished_future.result())
 *             except Exception as exc:
 */
          {
            __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_9);
            __Pyx_XGOTREF(__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_11);
            /*try:*/ {

              /* "cassandra/cluster.py":913
 * 
 *             try:
 *                 results.append(finished_future.result())             # <<<<<<<<<<<<<<
 *             except Exception as exc:
 *                 results.append(exc)
 */
              __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_finished_future, __pyx_n_s_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_8 = NULL;
              if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
                __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
                if (likely(__pyx_t_8)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                  __Pyx_INCREF(__pyx_t_8);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_3, function);
                }
              }
              if (__pyx_t_8) {
                __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              } else {
                __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
              }
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __pyx_t_12 = __Pyx_PyObject_Append(__pyx_v_results, __pyx_t_2); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            }
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            goto __pyx_L22_try_end;
            __pyx_L15_error:;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

            /* "cassandra/cluster.py":914
 *             try:
 *                 results.append(finished_future.result())
 *             except Exception as exc:             # <<<<<<<<<<<<<<
 *                 results.append(exc)
 * 
 */
            __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
            if (__pyx_t_13) {
              __Pyx_AddTraceback("cassandra.cluster.Cluster._on_up_future_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_INCREF(__pyx_t_3);
              __pyx_v_exc = __pyx_t_3;

              /* "cassandra/cluster.py":915
 *                 results.append(finished_future.result())
 *             except Exception as exc:
 *                 results.append(exc)             # <<<<<<<<<<<<<<
 * 
 *             if futures:
 */
              __pyx_t_12 = __Pyx_PyObject_Append(__pyx_v_results, __pyx_v_exc); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              goto __pyx_L16_exception_handled;
            }
            goto __pyx_L17_except_error;
            __pyx_L17_except_error:;
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
            goto __pyx_L7_error;
            __pyx_L16_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
            __pyx_L22_try_end:;
          }

          /* "cassandra/cluster.py":917
 *                 results.append(exc)
 * 
 *             if futures:             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
          __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_futures); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          if (__pyx_t_14) {

            /* "cassandra/cluster.py":918
 * 
 *             if futures:
 *                 return             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            goto __pyx_L11_try_return;
          }
        }
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "cassandra/cluster.py":909
 * 
 *     def _on_up_future_completed(self, host, futures, results, lock, finished_future):
 *         with lock:             # <<<<<<<<<<<<<<
 *             futures.discard(finished_future)
 * 
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.Cluster._on_up_future_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = PyTuple_Pack(3, __pyx_t_8, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_15 = ((!(__pyx_t_14 != 0)) != 0);
          if (__pyx_t_15) {
            __Pyx_GIVEREF(__pyx_t_8);
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_XGIVEREF(__pyx_t_2);
            __Pyx_ErrRestore(__pyx_t_8, __pyx_t_3, __pyx_t_2);
            __pyx_t_8 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L4_return;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_1) {
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__23, NULL);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_7 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_1) {
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__24, NULL);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L29;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L1_error;
    __pyx_L29:;
  }

  /* "cassandra/cluster.py":920
 *                 return
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             # all futures have completed at this point
 *             for exc in [f for f in results if isinstance(f, Exception)]:
 */
  /*try:*/ {

    /* "cassandra/cluster.py":922
 *         try:
 *             # all futures have completed at this point
 *             for exc in [f for f in results if isinstance(f, Exception)]:             # <<<<<<<<<<<<<<
 *                 log.error("Unexpected failure while marking node %s up:", host, exc_info=exc)
 *                 self._cleanup_failed_on_up_handling(host)
 */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_v_results)) || PyTuple_CheckExact(__pyx_v_results)) {
      __pyx_t_3 = __pyx_v_results; __Pyx_INCREF(__pyx_t_3); __pyx_t_16 = 0;
      __pyx_t_17 = NULL;
    } else {
      __pyx_t_16 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_results); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_17 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
    }
    for (;;) {
      if (likely(!__pyx_t_17)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_16); __Pyx_INCREF(__pyx_t_8); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_16); __Pyx_INCREF(__pyx_t_8); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_17(__pyx_t_3);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_15 = PyObject_IsInstance(__pyx_v_f, __pyx_builtin_Exception); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __pyx_t_14 = (__pyx_t_15 != 0);
      if (__pyx_t_14) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_v_f))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
        goto __pyx_L37;
      }
      __pyx_L37:;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_16); __Pyx_INCREF(__pyx_t_2); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_exc, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "cassandra/cluster.py":923
 *             # all futures have completed at this point
 *             for exc in [f for f in results if isinstance(f, Exception)]:
 *                 log.error("Unexpected failure while marking node %s up:", host, exc_info=exc)             # <<<<<<<<<<<<<<
 *                 self._cleanup_failed_on_up_handling(host)
 *                 return
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_kp_s_Unexpected_failure_while_marking);
      __Pyx_GIVEREF(__pyx_kp_s_Unexpected_failure_while_marking);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_Unexpected_failure_while_marking);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_host);
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_exc_info, __pyx_v_exc) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_18);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

      /* "cassandra/cluster.py":924
 *             for exc in [f for f in results if isinstance(f, Exception)]:
 *                 log.error("Unexpected failure while marking node %s up:", host, exc_info=exc)
 *                 self._cleanup_failed_on_up_handling(host)             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cleanup_failed_on_up_handling); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_18 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_host); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
        __Pyx_GOTREF(__pyx_t_18);
      } else {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_host);
        __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
        __Pyx_GOTREF(__pyx_t_18);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

      /* "cassandra/cluster.py":925
 *                 log.error("Unexpected failure while marking node %s up:", host, exc_info=exc)
 *                 self._cleanup_failed_on_up_handling(host)
 *                 return             # <<<<<<<<<<<<<<
 * 
 *             if not all(results):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L30_return;

      /* "cassandra/cluster.py":922
 *         try:
 *             # all futures have completed at this point
 *             for exc in [f for f in results if isinstance(f, Exception)]:             # <<<<<<<<<<<<<<
 *                 log.error("Unexpected failure while marking node %s up:", host, exc_info=exc)
 *                 self._cleanup_failed_on_up_handling(host)
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cassandra/cluster.py":927
 *                 return
 * 
 *             if not all(results):             # <<<<<<<<<<<<<<
 *                 log.debug("Connection pool could not be created, not marking node %s up", host)
 *                 self._cleanup_failed_on_up_handling(host)
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_results);
    __Pyx_GIVEREF(__pyx_v_results);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_results);
    __pyx_t_18 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_3, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
    __Pyx_GOTREF(__pyx_t_18);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    __pyx_t_15 = ((!__pyx_t_14) != 0);
    if (__pyx_t_15) {

      /* "cassandra/cluster.py":928
 * 
 *             if not all(results):
 *                 log.debug("Connection pool could not be created, not marking node %s up", host)             # <<<<<<<<<<<<<<
 *                 self._cleanup_failed_on_up_handling(host)
 *                 return
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      __pyx_t_16 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_16 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_Connection_pool_could_not_be_cre);
      __Pyx_GIVEREF(__pyx_kp_s_Connection_pool_could_not_be_cre);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_16, __pyx_kp_s_Connection_pool_could_not_be_cre);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_16, __pyx_v_host);
      __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_18);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

      /* "cassandra/cluster.py":929
 *             if not all(results):
 *                 log.debug("Connection pool could not be created, not marking node %s up", host)
 *                 self._cleanup_failed_on_up_handling(host)             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cleanup_failed_on_up_handling); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_8) {
        __pyx_t_18 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_host); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
        __Pyx_GOTREF(__pyx_t_18);
      } else {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_host);
        __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
        __Pyx_GOTREF(__pyx_t_18);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

      /* "cassandra/cluster.py":930
 *                 log.debug("Connection pool could not be created, not marking node %s up", host)
 *                 self._cleanup_failed_on_up_handling(host)
 *                 return             # <<<<<<<<<<<<<<
 * 
 *             log.info("Connection pools established for node %s", host)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L30_return;
    }

    /* "cassandra/cluster.py":932
 *                 return
 * 
 *             log.info("Connection pools established for node %s", host)             # <<<<<<<<<<<<<<
 *             # mark the host as up and notify all listeners
 *             host.set_up()
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_16 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_16 = 1;
      }
    }
    __pyx_t_8 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Connection_pools_established_for);
    __Pyx_GIVEREF(__pyx_kp_s_Connection_pools_established_for);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_16, __pyx_kp_s_Connection_pools_established_for);
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_16, __pyx_v_host);
    __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
    __Pyx_GOTREF(__pyx_t_18);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

    /* "cassandra/cluster.py":934
 *             log.info("Connection pools established for node %s", host)
 *             # mark the host as up and notify all listeners
 *             host.set_up()             # <<<<<<<<<<<<<<
 *             for listener in self.listeners:
 *                 listener.on_up(host)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_set_up); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_8) {
      __pyx_t_18 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else {
      __pyx_t_18 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
    }
    __Pyx_GOTREF(__pyx_t_18);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

    /* "cassandra/cluster.py":935
 *             # mark the host as up and notify all listeners
 *             host.set_up()
 *             for listener in self.listeners:             # <<<<<<<<<<<<<<
 *                 listener.on_up(host)
 *         finally:
 */
    __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_listeners_2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
    __Pyx_GOTREF(__pyx_t_18);
    if (likely(PyList_CheckExact(__pyx_t_18)) || PyTuple_CheckExact(__pyx_t_18)) {
      __pyx_t_3 = __pyx_t_18; __Pyx_INCREF(__pyx_t_3); __pyx_t_16 = 0;
      __pyx_t_17 = NULL;
    } else {
      __pyx_t_16 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_18); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_17 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
    }
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    for (;;) {
      if (likely(!__pyx_t_17)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_18 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_16); __Pyx_INCREF(__pyx_t_18); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
          #else
          __pyx_t_18 = PySequence_ITEM(__pyx_t_3, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
          __Pyx_GOTREF(__pyx_t_18);
          #endif
        } else {
          if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_18 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_16); __Pyx_INCREF(__pyx_t_18); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
          #else
          __pyx_t_18 = PySequence_ITEM(__pyx_t_3, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
          __Pyx_GOTREF(__pyx_t_18);
          #endif
        }
      } else {
        __pyx_t_18 = __pyx_t_17(__pyx_t_3);
        if (unlikely(!__pyx_t_18)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_18);
      }
      __Pyx_XDECREF_SET(__pyx_v_listener, __pyx_t_18);
      __pyx_t_18 = 0;

      /* "cassandra/cluster.py":936
 *             host.set_up()
 *             for listener in self.listeners:
 *                 listener.on_up(host)             # <<<<<<<<<<<<<<
 *         finally:
 *             with host.lock:
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_listener, __pyx_n_s_on_up); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      if (!__pyx_t_4) {
        __pyx_t_18 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_host); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
        __Pyx_GOTREF(__pyx_t_18);
      } else {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_host);
        __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
        __Pyx_GOTREF(__pyx_t_18);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

      /* "cassandra/cluster.py":935
 *             # mark the host as up and notify all listeners
 *             host.set_up()
 *             for listener in self.listeners:             # <<<<<<<<<<<<<<
 *                 listener.on_up(host)
 *         finally:
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }

  /* "cassandra/cluster.py":938
 *                 listener.on_up(host)
 *         finally:
 *             with host.lock:             # <<<<<<<<<<<<<<
 *                 host._currently_handling_node_up = False
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      /*with:*/ {
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_lock_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (__pyx_t_2) {
          __pyx_t_18 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else {
          __pyx_t_18 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
        }
        __Pyx_GOTREF(__pyx_t_18);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        /*try:*/ {
          {
            __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
            __Pyx_XGOTREF(__pyx_t_7);
            __Pyx_XGOTREF(__pyx_t_6);
            __Pyx_XGOTREF(__pyx_t_5);
            /*try:*/ {

              /* "cassandra/cluster.py":939
 *         finally:
 *             with host.lock:
 *                 host._currently_handling_node_up = False             # <<<<<<<<<<<<<<
 * 
 *         # see if there are any pools to add or remove now that the host is marked up
 */
              if (__Pyx_PyObject_SetAttrStr(__pyx_v_host, __pyx_n_s_currently_handling_node_up, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L45_error;}
            }
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            goto __pyx_L52_try_end;
            __pyx_L45_error:;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "cassandra/cluster.py":938
 *                 listener.on_up(host)
 *         finally:
 *             with host.lock:             # <<<<<<<<<<<<<<
 *                 host._currently_handling_node_up = False
 * 
 */
            /*except:*/ {
              __Pyx_AddTraceback("cassandra.cluster.Cluster._on_up_future_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_18, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L47_except_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_GOTREF(__pyx_t_18);
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_2 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_18, __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L47_except_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L47_except_error;}
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              if (__pyx_t_15 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L47_except_error;}
              __pyx_t_14 = ((!(__pyx_t_15 != 0)) != 0);
              if (__pyx_t_14) {
                __Pyx_GIVEREF(__pyx_t_3);
                __Pyx_GIVEREF(__pyx_t_18);
                __Pyx_XGIVEREF(__pyx_t_8);
                __Pyx_ErrRestore(__pyx_t_3, __pyx_t_18, __pyx_t_8);
                __pyx_t_3 = 0; __pyx_t_18 = 0; __pyx_t_8 = 0; 
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L47_except_error;}
              }
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              goto __pyx_L46_exception_handled;
            }
            __pyx_L47_except_error:;
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_6);
            __Pyx_XGIVEREF(__pyx_t_5);
            __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_5);
            goto __pyx_L1_error;
            __pyx_L46_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_6);
            __Pyx_XGIVEREF(__pyx_t_5);
            __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_5);
            __pyx_L52_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_1) {
              __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__25, NULL);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            }
            goto __pyx_L44;
          }
          __pyx_L44:;
        }
        goto __pyx_L56;
        __pyx_L41_error:;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L1_error;
        __pyx_L56:;
      }
      goto __pyx_L32;
    }
    /*exception exit:*/{
      __pyx_L31_error:;
      __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_7, &__pyx_t_11, &__pyx_t_10);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0)) __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __pyx_t_13 = __pyx_lineno; __pyx_t_19 = __pyx_clineno; __pyx_t_20 = __pyx_filename;
      {
        /*with:*/ {
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_lock_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = __Pyx_PyObject_LookupSpecial(__pyx_t_8, __pyx_n_s_exit); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_8, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L59_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_2 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
            if (likely(__pyx_t_2)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
              __Pyx_INCREF(__pyx_t_2);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_3, function);
            }
          }
          if (__pyx_t_2) {
            __pyx_t_18 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L59_error;}
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          } else {
            __pyx_t_18 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L59_error;}
          }
          __Pyx_GOTREF(__pyx_t_18);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          /*try:*/ {
            {
              __Pyx_ExceptionSave(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
              __Pyx_XGOTREF(__pyx_t_21);
              __Pyx_XGOTREF(__pyx_t_22);
              __Pyx_XGOTREF(__pyx_t_23);
              /*try:*/ {

                /* "cassandra/cluster.py":939
 *         finally:
 *             with host.lock:
 *                 host._currently_handling_node_up = False             # <<<<<<<<<<<<<<
 * 
 *         # see if there are any pools to add or remove now that the host is marked up
 */
                if (__Pyx_PyObject_SetAttrStr(__pyx_v_host, __pyx_n_s_currently_handling_node_up, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L63_error;}
              }
              __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
              __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
              __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
              goto __pyx_L70_try_end;
              __pyx_L63_error:;
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
              __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

              /* "cassandra/cluster.py":938
 *                 listener.on_up(host)
 *         finally:
 *             with host.lock:             # <<<<<<<<<<<<<<
 *                 host._currently_handling_node_up = False
 * 
 */
              /*except:*/ {
                __Pyx_AddTraceback("cassandra.cluster.Cluster._on_up_future_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
                if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_18, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L65_except_error;}
                __Pyx_GOTREF(__pyx_t_8);
                __Pyx_GOTREF(__pyx_t_18);
                __Pyx_GOTREF(__pyx_t_3);
                __pyx_t_2 = PyTuple_Pack(3, __pyx_t_8, __pyx_t_18, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L65_except_error;}
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_t_24 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, NULL);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L65_except_error;}
                __Pyx_GOTREF(__pyx_t_24);
                __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_24);
                __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
                if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L65_except_error;}
                __pyx_t_15 = ((!(__pyx_t_14 != 0)) != 0);
                if (__pyx_t_15) {
                  __Pyx_GIVEREF(__pyx_t_8);
                  __Pyx_GIVEREF(__pyx_t_18);
                  __Pyx_XGIVEREF(__pyx_t_3);
                  __Pyx_ErrRestore(__pyx_t_8, __pyx_t_18, __pyx_t_3);
                  __pyx_t_8 = 0; __pyx_t_18 = 0; __pyx_t_3 = 0; 
                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L65_except_error;}
                }
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                goto __pyx_L64_exception_handled;
              }
              __pyx_L65_except_error:;
              __Pyx_XGIVEREF(__pyx_t_21);
              __Pyx_XGIVEREF(__pyx_t_22);
              __Pyx_XGIVEREF(__pyx_t_23);
              __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
              goto __pyx_L58_error;
              __pyx_L64_exception_handled:;
              __Pyx_XGIVEREF(__pyx_t_21);
              __Pyx_XGIVEREF(__pyx_t_22);
              __Pyx_XGIVEREF(__pyx_t_23);
              __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
              __pyx_L70_try_end:;
            }
          }
          /*finally:*/ {
            /*normal exit:*/{
              if (__pyx_t_9) {
                __pyx_t_23 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__26, NULL);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
                __Pyx_GOTREF(__pyx_t_23);
                __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
              }
              goto __pyx_L62;
            }
            __pyx_L62:;
          }
          goto __pyx_L74;
          __pyx_L59_error:;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L58_error;
          __pyx_L74:;
        }
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_11, __pyx_t_10);
      }
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_6);
      __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0;
      __pyx_lineno = __pyx_t_13; __pyx_clineno = __pyx_t_19; __pyx_filename = __pyx_t_20;
      goto __pyx_L1_error;
      __pyx_L58_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_11, __pyx_t_10);
      }
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L30_return: {
      __pyx_t_10 = __pyx_r;
      __pyx_r = 0;
      /*with:*/ {
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_lock_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_11 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_8 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L75_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (__pyx_t_2) {
          __pyx_t_18 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L75_error;}
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else {
          __pyx_t_18 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L75_error;}
        }
        __Pyx_GOTREF(__pyx_t_18);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        /*try:*/ {
          {
            __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
            __Pyx_XGOTREF(__pyx_t_7);
            __Pyx_XGOTREF(__pyx_t_6);
            __Pyx_XGOTREF(__pyx_t_5);
            /*try:*/ {

              /* "cassandra/cluster.py":939
 *         finally:
 *             with host.lock:
 *                 host._currently_handling_node_up = False             # <<<<<<<<<<<<<<
 * 
 *         # see if there are any pools to add or remove now that the host is marked up
 */
              if (__Pyx_PyObject_SetAttrStr(__pyx_v_host, __pyx_n_s_currently_handling_node_up, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L79_error;}
            }
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            goto __pyx_L86_try_end;
            __pyx_L79_error:;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "cassandra/cluster.py":938
 *                 listener.on_up(host)
 *         finally:
 *             with host.lock:             # <<<<<<<<<<<<<<
 *                 host._currently_handling_node_up = False
 * 
 */
            /*except:*/ {
              __Pyx_AddTraceback("cassandra.cluster.Cluster._on_up_future_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_18, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L81_except_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_GOTREF(__pyx_t_18);
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_2 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_18, __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L81_except_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_2, NULL);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L81_except_error;}
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              if (__pyx_t_15 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L81_except_error;}
              __pyx_t_14 = ((!(__pyx_t_15 != 0)) != 0);
              if (__pyx_t_14) {
                __Pyx_GIVEREF(__pyx_t_3);
                __Pyx_GIVEREF(__pyx_t_18);
                __Pyx_XGIVEREF(__pyx_t_8);
                __Pyx_ErrRestore(__pyx_t_3, __pyx_t_18, __pyx_t_8);
                __pyx_t_3 = 0; __pyx_t_18 = 0; __pyx_t_8 = 0; 
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L81_except_error;}
              }
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              goto __pyx_L80_exception_handled;
            }
            __pyx_L81_except_error:;
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_6);
            __Pyx_XGIVEREF(__pyx_t_5);
            __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_5);
            goto __pyx_L1_error;
            __pyx_L80_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_6);
            __Pyx_XGIVEREF(__pyx_t_5);
            __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_5);
            __pyx_L86_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_11) {
              __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__27, NULL);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            }
            goto __pyx_L78;
          }
          __pyx_L78:;
        }
        goto __pyx_L90;
        __pyx_L75_error:;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L1_error;
        __pyx_L90:;
      }
      __pyx_r = __pyx_t_10;
      __pyx_t_10 = 0;
      goto __pyx_L0;
    }
    __pyx_L32:;
  }

  /* "cassandra/cluster.py":942
 * 
 *         # see if there are any pools to add or remove now that the host is marked up
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.update_created_pools()
 * 
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sessions); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
    __pyx_t_18 = __pyx_t_8; __Pyx_INCREF(__pyx_t_18); __pyx_t_16 = 0;
    __pyx_t_17 = NULL;
  } else {
    __pyx_t_16 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_18);
    __pyx_t_17 = Py_TYPE(__pyx_t_18)->tp_iternext; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  for (;;) {
    if (likely(!__pyx_t_17)) {
      if (likely(PyList_CheckExact(__pyx_t_18))) {
        if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_18)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_16); __Pyx_INCREF(__pyx_t_8); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_18, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        #endif
      } else {
        if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_18)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_16); __Pyx_INCREF(__pyx_t_8); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_18, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        #endif
      }
    } else {
      __pyx_t_8 = __pyx_t_17(__pyx_t_18);
      if (unlikely(!__pyx_t_8)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_8);
    }
    __Pyx_XDECREF_SET(__pyx_v_session, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "cassandra/cluster.py":943
 *         # see if there are any pools to add or remove now that the host is marked up
 *         for session in self.sessions:
 *             session.update_created_pools()             # <<<<<<<<<<<<<<
 * 
 *     def on_up(self, host):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_update_created_pools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "cassandra/cluster.py":942
 * 
 *         # see if there are any pools to add or remove now that the host is marked up
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.update_created_pools()
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

  /* "cassandra/cluster.py":908
 *         self._start_reconnector(host, is_host_addition=False)
 * 
 *     def _on_up_future_completed(self, host, futures, results, lock, finished_future):             # <<<<<<<<<<<<<<
 *         with lock:
 *             futures.discard(finished_future)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_AddTraceback("cassandra.cluster.Cluster._on_up_future_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XDECREF(__pyx_v_listener);
  __Pyx_XDECREF(__pyx_v_session);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":945
 *             session.update_created_pools()
 * 
 *     def on_up(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Intended for internal use only.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_45on_up(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_44on_up[] = "\n        Intended for internal use only.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_45on_up = {"on_up", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_45on_up, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_44on_up};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_45on_up(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_up (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_up", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_up") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_up", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.on_up", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_44on_up(__pyx_self, __pyx_v_self, __pyx_v_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_44on_up(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host) {
  int __pyx_v_have_future;
  PyObject *__pyx_v_futures = NULL;
  PyObject *__pyx_v_reconnector = NULL;
  PyObject *__pyx_v_session = NULL;
  PyObject *__pyx_v_futures_lock = NULL;
  PyObject *__pyx_v_futures_results = NULL;
  PyObject *__pyx_v_callback = NULL;
  PyObject *__pyx_v_future = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_t_19;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_up", 0);

  /* "cassandra/cluster.py":949
 *         Intended for internal use only.
 *         """
 *         if self.is_shutdown:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":950
 *         """
 *         if self.is_shutdown:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         log.debug("Waiting to acquire lock for handling up status of node %s", host)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":952
 *             return
 * 
 *         log.debug("Waiting to acquire lock for handling up status of node %s", host)             # <<<<<<<<<<<<<<
 *         with host.lock:
 *             if host._currently_handling_node_up:
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_Waiting_to_acquire_lock_for_hand);
  __Pyx_GIVEREF(__pyx_kp_s_Waiting_to_acquire_lock_for_hand);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_s_Waiting_to_acquire_lock_for_hand);
  __Pyx_INCREF(__pyx_v_host);
  __Pyx_GIVEREF(__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_host);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":953
 * 
 *         log.debug("Waiting to acquire lock for handling up status of node %s", host)
 *         with host.lock:             # <<<<<<<<<<<<<<
 *             if host._currently_handling_node_up:
 *                 log.debug("Another thread is already handling up status of node %s", host)
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_lock_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {

          /* "cassandra/cluster.py":954
 *         log.debug("Waiting to acquire lock for handling up status of node %s", host)
 *         with host.lock:
 *             if host._currently_handling_node_up:             # <<<<<<<<<<<<<<
 *                 log.debug("Another thread is already handling up status of node %s", host)
 *                 return
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_currently_handling_node_up); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_2) {

            /* "cassandra/cluster.py":955
 *         with host.lock:
 *             if host._currently_handling_node_up:
 *                 log.debug("Another thread is already handling up status of node %s", host)             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
            __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_4 = NULL;
            __pyx_t_5 = 0;
            if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
              if (likely(__pyx_t_4)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_6, function);
                __pyx_t_5 = 1;
              }
            }
            __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_3);
            if (__pyx_t_4) {
              __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
            }
            __Pyx_INCREF(__pyx_kp_s_Another_thread_is_already_handli);
            __Pyx_GIVEREF(__pyx_kp_s_Another_thread_is_already_handli);
            PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_kp_s_Another_thread_is_already_handli);
            __Pyx_INCREF(__pyx_v_host);
            __Pyx_GIVEREF(__pyx_v_host);
            PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_v_host);
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "cassandra/cluster.py":956
 *             if host._currently_handling_node_up:
 *                 log.debug("Another thread is already handling up status of node %s", host)
 *                 return             # <<<<<<<<<<<<<<
 * 
 *             if host.is_up:
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            goto __pyx_L12_try_return;
          }

          /* "cassandra/cluster.py":958
 *                 return
 * 
 *             if host.is_up:             # <<<<<<<<<<<<<<
 *                 log.debug("Host %s was already marked up", host)
 *                 return
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_is_up); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_2) {

            /* "cassandra/cluster.py":959
 * 
 *             if host.is_up:
 *                 log.debug("Host %s was already marked up", host)             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
            __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_6 = NULL;
            __pyx_t_5 = 0;
            if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
              __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
              if (likely(__pyx_t_6)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                __Pyx_INCREF(__pyx_t_6);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_3, function);
                __pyx_t_5 = 1;
              }
            }
            __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_4);
            if (__pyx_t_6) {
              __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
            }
            __Pyx_INCREF(__pyx_kp_s_Host_s_was_already_marked_up);
            __Pyx_GIVEREF(__pyx_kp_s_Host_s_was_already_marked_up);
            PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_kp_s_Host_s_was_already_marked_up);
            __Pyx_INCREF(__pyx_v_host);
            __Pyx_GIVEREF(__pyx_v_host);
            PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_host);
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "cassandra/cluster.py":960
 *             if host.is_up:
 *                 log.debug("Host %s was already marked up", host)
 *                 return             # <<<<<<<<<<<<<<
 * 
 *             host._currently_handling_node_up = True
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            goto __pyx_L12_try_return;
          }

          /* "cassandra/cluster.py":962
 *                 return
 * 
 *             host._currently_handling_node_up = True             # <<<<<<<<<<<<<<
 *         log.debug("Starting to handle up status of node %s", host)
 * 
 */
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_host, __pyx_n_s_currently_handling_node_up, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        }
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L15_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":953
 * 
 *         log.debug("Waiting to acquire lock for handling up status of node %s", host)
 *         with host.lock:             # <<<<<<<<<<<<<<
 *             if host._currently_handling_node_up:
 *                 log.debug("Another thread is already handling up status of node %s", host)
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.Cluster.on_up", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_6 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (__pyx_t_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __pyx_t_12 = ((!(__pyx_t_2 != 0)) != 0);
          if (__pyx_t_12) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_4);
            __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L9_exception_handled;
        }
        __pyx_L10_except_error:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        goto __pyx_L1_error;
        __pyx_L12_try_return:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        goto __pyx_L5_return;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        __pyx_L15_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_7) {
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__28, NULL);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L5_return: {
        __pyx_t_10 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_7) {
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__29, NULL);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __pyx_r = __pyx_t_10;
        __pyx_t_10 = 0;
        goto __pyx_L0;
      }
      __pyx_L7:;
    }
    goto __pyx_L21;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L1_error;
    __pyx_L21:;
  }

  /* "cassandra/cluster.py":963
 * 
 *             host._currently_handling_node_up = True
 *         log.debug("Starting to handle up status of node %s", host)             # <<<<<<<<<<<<<<
 * 
 *         have_future = False
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_Starting_to_handle_up_status_of);
  __Pyx_GIVEREF(__pyx_kp_s_Starting_to_handle_up_status_of);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_s_Starting_to_handle_up_status_of);
  __Pyx_INCREF(__pyx_v_host);
  __Pyx_GIVEREF(__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_host);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":965
 *         log.debug("Starting to handle up status of node %s", host)
 * 
 *         have_future = False             # <<<<<<<<<<<<<<
 *         futures = set()
 *         try:
 */
  __pyx_v_have_future = 0;

  /* "cassandra/cluster.py":966
 * 
 *         have_future = False
 *         futures = set()             # <<<<<<<<<<<<<<
 *         try:
 *             log.info("Host %s may be up; will prepare queries and open connection pool", host)
 */
  __pyx_t_4 = PySet_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_futures = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "cassandra/cluster.py":967
 *         have_future = False
 *         futures = set()
 *         try:             # <<<<<<<<<<<<<<
 *             log.info("Host %s may be up; will prepare queries and open connection pool", host)
 * 
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_10, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "cassandra/cluster.py":968
 *         futures = set()
 *         try:
 *             log.info("Host %s may be up; will prepare queries and open connection pool", host)             # <<<<<<<<<<<<<<
 * 
 *             reconnector = host.get_and_set_reconnection_handler(None)
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_Host_s_may_be_up_will_prepare_qu);
      __Pyx_GIVEREF(__pyx_kp_s_Host_s_may_be_up_will_prepare_qu);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_kp_s_Host_s_may_be_up_will_prepare_qu);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_v_host);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cassandra/cluster.py":970
 *             log.info("Host %s may be up; will prepare queries and open connection pool", host)
 * 
 *             reconnector = host.get_and_set_reconnection_handler(None)             # <<<<<<<<<<<<<<
 *             if reconnector:
 *                 log.debug("Now that host %s is up, cancelling the reconnection handler", host)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_get_and_set_reconnection_handler); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_reconnector = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "cassandra/cluster.py":971
 * 
 *             reconnector = host.get_and_set_reconnection_handler(None)
 *             if reconnector:             # <<<<<<<<<<<<<<
 *                 log.debug("Now that host %s is up, cancelling the reconnection handler", host)
 *                 reconnector.cancel()
 */
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_reconnector); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      if (__pyx_t_12) {

        /* "cassandra/cluster.py":972
 *             reconnector = host.get_and_set_reconnection_handler(None)
 *             if reconnector:
 *                 log.debug("Now that host %s is up, cancelling the reconnection handler", host)             # <<<<<<<<<<<<<<
 *                 reconnector.cancel()
 * 
 */
        __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = NULL;
        __pyx_t_5 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_5 = 1;
          }
        }
        __pyx_t_1 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_1);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_s_Now_that_host_s_is_up_cancelling);
        __Pyx_GIVEREF(__pyx_kp_s_Now_that_host_s_is_up_cancelling);
        PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_5, __pyx_kp_s_Now_that_host_s_is_up_cancelling);
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_5, __pyx_v_host);
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "cassandra/cluster.py":973
 *             if reconnector:
 *                 log.debug("Now that host %s is up, cancelling the reconnection handler", host)
 *                 reconnector.cancel()             # <<<<<<<<<<<<<<
 * 
 *             self._prepare_all_queries(host)
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_reconnector, __pyx_n_s_cancel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_1) {
          __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else {
          __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        }
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L30;
      }
      __pyx_L30:;

      /* "cassandra/cluster.py":975
 *                 reconnector.cancel()
 * 
 *             self._prepare_all_queries(host)             # <<<<<<<<<<<<<<
 *             log.debug("Done preparing all queries for host %s, ", host)
 * 
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_prepare_all_queries); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_1) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_host); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_host);
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "cassandra/cluster.py":976
 * 
 *             self._prepare_all_queries(host)
 *             log.debug("Done preparing all queries for host %s, ", host)             # <<<<<<<<<<<<<<
 * 
 *             for session in self.sessions:
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_1 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_Done_preparing_all_queries_for_h);
      __Pyx_GIVEREF(__pyx_kp_s_Done_preparing_all_queries_for_h);
      PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_5, __pyx_kp_s_Done_preparing_all_queries_for_h);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_5, __pyx_v_host);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "cassandra/cluster.py":978
 *             log.debug("Done preparing all queries for host %s, ", host)
 * 
 *             for session in self.sessions:             # <<<<<<<<<<<<<<
 *                 session.remove_pool(host)
 * 
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sessions); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
        __pyx_t_4 = __pyx_t_6; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
        __pyx_t_13 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_13 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      for (;;) {
        if (likely(!__pyx_t_13)) {
          if (likely(PyList_CheckExact(__pyx_t_4))) {
            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            #else
            __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            __Pyx_GOTREF(__pyx_t_6);
            #endif
          } else {
            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            #else
            __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            __Pyx_GOTREF(__pyx_t_6);
            #endif
          }
        } else {
          __pyx_t_6 = __pyx_t_13(__pyx_t_4);
          if (unlikely(!__pyx_t_6)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_XDECREF_SET(__pyx_v_session, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "cassandra/cluster.py":979
 * 
 *             for session in self.sessions:
 *                 session.remove_pool(host)             # <<<<<<<<<<<<<<
 * 
 *             log.debug("Signalling to load balancing policy that host %s is up", host)
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_remove_pool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        if (!__pyx_t_3) {
          __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_host); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_6);
        } else {
          __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_3); __pyx_t_3 = NULL;
          __Pyx_INCREF(__pyx_v_host);
          __Pyx_GIVEREF(__pyx_v_host);
          PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_host);
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "cassandra/cluster.py":978
 *             log.debug("Done preparing all queries for host %s, ", host)
 * 
 *             for session in self.sessions:             # <<<<<<<<<<<<<<
 *                 session.remove_pool(host)
 * 
 */
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cassandra/cluster.py":981
 *                 session.remove_pool(host)
 * 
 *             log.debug("Signalling to load balancing policy that host %s is up", host)             # <<<<<<<<<<<<<<
 *             self.load_balancing_policy.on_up(host)
 * 
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_14 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_14);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_Signalling_to_load_balancing_pol);
      __Pyx_GIVEREF(__pyx_kp_s_Signalling_to_load_balancing_pol);
      PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_5, __pyx_kp_s_Signalling_to_load_balancing_pol);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_5, __pyx_v_host);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cassandra/cluster.py":982
 * 
 *             log.debug("Signalling to load balancing policy that host %s is up", host)
 *             self.load_balancing_policy.on_up(host)             # <<<<<<<<<<<<<<
 * 
 *             log.debug("Signalling to control connection that host %s is up", host)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_load_balancing_policy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_on_up); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
        }
      }
      if (!__pyx_t_1) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_host); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_host);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cassandra/cluster.py":984
 *             self.load_balancing_policy.on_up(host)
 * 
 *             log.debug("Signalling to control connection that host %s is up", host)             # <<<<<<<<<<<<<<
 *             self.control_connection.on_up(host)
 * 
 */
      __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_1 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (__pyx_t_14) {
        __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_14); __pyx_t_14 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_Signalling_to_control_connection);
      __Pyx_GIVEREF(__pyx_kp_s_Signalling_to_control_connection);
      PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_5, __pyx_kp_s_Signalling_to_control_connection);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_5, __pyx_v_host);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cassandra/cluster.py":985
 * 
 *             log.debug("Signalling to control connection that host %s is up", host)
 *             self.control_connection.on_up(host)             # <<<<<<<<<<<<<<
 * 
 *             log.debug("Attempting to open new connection pools for host %s", host)
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_on_up); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_host); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_host);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cassandra/cluster.py":987
 *             self.control_connection.on_up(host)
 * 
 *             log.debug("Attempting to open new connection pools for host %s", host)             # <<<<<<<<<<<<<<
 *             futures_lock = Lock()
 *             futures_results = []
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_Attempting_to_open_new_connectio);
      __Pyx_GIVEREF(__pyx_kp_s_Attempting_to_open_new_connectio);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_s_Attempting_to_open_new_connectio);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_host);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cassandra/cluster.py":988
 * 
 *             log.debug("Attempting to open new connection pools for host %s", host)
 *             futures_lock = Lock()             # <<<<<<<<<<<<<<
 *             futures_results = []
 *             callback = partial(self._on_up_future_completed, host, futures, futures_results, futures_lock)
 */
      __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_Lock); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
        }
      }
      if (__pyx_t_6) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      }
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_v_futures_lock = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "cassandra/cluster.py":989
 *             log.debug("Attempting to open new connection pools for host %s", host)
 *             futures_lock = Lock()
 *             futures_results = []             # <<<<<<<<<<<<<<
 *             callback = partial(self._on_up_future_completed, host, futures, futures_results, futures_lock)
 *             for session in self.sessions:
 */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_futures_results = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cassandra/cluster.py":990
 *             futures_lock = Lock()
 *             futures_results = []
 *             callback = partial(self._on_up_future_completed, host, futures, futures_results, futures_lock)             # <<<<<<<<<<<<<<
 *             for session in self.sessions:
 *                 future = session.add_or_renew_pool(host, is_host_addition=False)
 */
      __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_partial); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_up_future_completed); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_3 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_t_6);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_v_host);
      __Pyx_INCREF(__pyx_v_futures);
      __Pyx_GIVEREF(__pyx_v_futures);
      PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_5, __pyx_v_futures);
      __Pyx_INCREF(__pyx_v_futures_results);
      __Pyx_GIVEREF(__pyx_v_futures_results);
      PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_5, __pyx_v_futures_results);
      __Pyx_INCREF(__pyx_v_futures_lock);
      __Pyx_GIVEREF(__pyx_v_futures_lock);
      PyTuple_SET_ITEM(__pyx_t_3, 4+__pyx_t_5, __pyx_v_futures_lock);
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_v_callback = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "cassandra/cluster.py":991
 *             futures_results = []
 *             callback = partial(self._on_up_future_completed, host, futures, futures_results, futures_lock)
 *             for session in self.sessions:             # <<<<<<<<<<<<<<
 *                 future = session.add_or_renew_pool(host, is_host_addition=False)
 *                 if future is not None:
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sessions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
        __pyx_t_14 = __pyx_t_4; __Pyx_INCREF(__pyx_t_14); __pyx_t_5 = 0;
        __pyx_t_13 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_13 = Py_TYPE(__pyx_t_14)->tp_iternext; if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      for (;;) {
        if (likely(!__pyx_t_13)) {
          if (likely(PyList_CheckExact(__pyx_t_14))) {
            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_14)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_4 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            #else
            __pyx_t_4 = PySequence_ITEM(__pyx_t_14, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            __Pyx_GOTREF(__pyx_t_4);
            #endif
          } else {
            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            #else
            __pyx_t_4 = PySequence_ITEM(__pyx_t_14, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            __Pyx_GOTREF(__pyx_t_4);
            #endif
          }
        } else {
          __pyx_t_4 = __pyx_t_13(__pyx_t_14);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_XDECREF_SET(__pyx_v_session, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "cassandra/cluster.py":992
 *             callback = partial(self._on_up_future_completed, host, futures, futures_results, futures_lock)
 *             for session in self.sessions:
 *                 future = session.add_or_renew_pool(host, is_host_addition=False)             # <<<<<<<<<<<<<<
 *                 if future is not None:
 *                     have_future = True
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_add_or_renew_pool); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_host);
        __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_6);
        if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_is_host_addition, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF_SET(__pyx_v_future, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "cassandra/cluster.py":993
 *             for session in self.sessions:
 *                 future = session.add_or_renew_pool(host, is_host_addition=False)
 *                 if future is not None:             # <<<<<<<<<<<<<<
 *                     have_future = True
 *                     future.add_done_callback(callback)
 */
        __pyx_t_12 = (__pyx_v_future != Py_None);
        __pyx_t_2 = (__pyx_t_12 != 0);
        if (__pyx_t_2) {

          /* "cassandra/cluster.py":994
 *                 future = session.add_or_renew_pool(host, is_host_addition=False)
 *                 if future is not None:
 *                     have_future = True             # <<<<<<<<<<<<<<
 *                     future.add_done_callback(callback)
 *                     futures.add(future)
 */
          __pyx_v_have_future = 1;

          /* "cassandra/cluster.py":995
 *                 if future is not None:
 *                     have_future = True
 *                     future.add_done_callback(callback)             # <<<<<<<<<<<<<<
 *                     futures.add(future)
 *         except Exception:
 */
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_add_done_callback); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
            }
          }
          if (!__pyx_t_3) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_callback); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            __Pyx_GOTREF(__pyx_t_1);
          } else {
            __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
            __Pyx_INCREF(__pyx_v_callback);
            __Pyx_GIVEREF(__pyx_v_callback);
            PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_callback);
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "cassandra/cluster.py":996
 *                     have_future = True
 *                     future.add_done_callback(callback)
 *                     futures.add(future)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             log.exception("Unexpected failure handling node %s being marked up:", host)
 */
          __pyx_t_15 = PySet_Add(__pyx_v_futures, __pyx_v_future); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          goto __pyx_L35;
        }
        __pyx_L35:;

        /* "cassandra/cluster.py":991
 *             futures_results = []
 *             callback = partial(self._on_up_future_completed, host, futures, futures_results, futures_lock)
 *             for session in self.sessions:             # <<<<<<<<<<<<<<
 *                 future = session.add_or_renew_pool(host, is_host_addition=False)
 *                 if future is not None:
 */
      }
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    /*else:*/ {

      /* "cassandra/cluster.py":1008
 *             raise
 *         else:
 *             if not have_future:             # <<<<<<<<<<<<<<
 *                 with host.lock:
 *                     host._currently_handling_node_up = False
 */
      __pyx_t_2 = ((!(__pyx_v_have_future != 0)) != 0);
      if (__pyx_t_2) {

        /* "cassandra/cluster.py":1009
 *         else:
 *             if not have_future:
 *                 with host.lock:             # <<<<<<<<<<<<<<
 *                     host._currently_handling_node_up = False
 * 
 */
        /*with:*/ {
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_lock_2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_8 = __Pyx_PyObject_LookupSpecial(__pyx_t_14, __pyx_n_s_exit); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_14, __pyx_n_s_enter); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L37_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_4 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_4)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
            }
          }
          if (__pyx_t_4) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L37_error;}
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          } else {
            __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L37_error;}
          }
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          /*try:*/ {
            {
              __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_16, &__pyx_t_17);
              __Pyx_XGOTREF(__pyx_t_11);
              __Pyx_XGOTREF(__pyx_t_16);
              __Pyx_XGOTREF(__pyx_t_17);
              /*try:*/ {

                /* "cassandra/cluster.py":1010
 *             if not have_future:
 *                 with host.lock:
 *                     host._currently_handling_node_up = False             # <<<<<<<<<<<<<<
 * 
 *         # for testing purposes
 */
                if (__Pyx_PyObject_SetAttrStr(__pyx_v_host, __pyx_n_s_currently_handling_node_up, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L43_error;}
              }
              __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
              __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
              goto __pyx_L50_try_end;
              __pyx_L43_error:;
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;

              /* "cassandra/cluster.py":1009
 *         else:
 *             if not have_future:
 *                 with host.lock:             # <<<<<<<<<<<<<<
 *                     host._currently_handling_node_up = False
 * 
 */
              /*except:*/ {
                __Pyx_AddTraceback("cassandra.cluster.Cluster.on_up", __pyx_clineno, __pyx_lineno, __pyx_filename);
                if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_1, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L45_except_error;}
                __Pyx_GOTREF(__pyx_t_14);
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_GOTREF(__pyx_t_6);
                __pyx_t_4 = PyTuple_Pack(3, __pyx_t_14, __pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L45_except_error;}
                __Pyx_GOTREF(__pyx_t_4);
                __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, NULL);
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L45_except_error;}
                __Pyx_GOTREF(__pyx_t_18);
                __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_18);
                __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
                if (__pyx_t_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L45_except_error;}
                __pyx_t_12 = ((!(__pyx_t_2 != 0)) != 0);
                if (__pyx_t_12) {
                  __Pyx_GIVEREF(__pyx_t_14);
                  __Pyx_GIVEREF(__pyx_t_1);
                  __Pyx_XGIVEREF(__pyx_t_6);
                  __Pyx_ErrRestore(__pyx_t_14, __pyx_t_1, __pyx_t_6);
                  __pyx_t_14 = 0; __pyx_t_1 = 0; __pyx_t_6 = 0; 
                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L45_except_error;}
                }
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
                goto __pyx_L44_exception_handled;
              }
              __pyx_L45_except_error:;
              __Pyx_XGIVEREF(__pyx_t_11);
              __Pyx_XGIVEREF(__pyx_t_16);
              __Pyx_XGIVEREF(__pyx_t_17);
              __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_16, __pyx_t_17);
              goto __pyx_L24_except_error;
              __pyx_L44_exception_handled:;
              __Pyx_XGIVEREF(__pyx_t_11);
              __Pyx_XGIVEREF(__pyx_t_16);
              __Pyx_XGIVEREF(__pyx_t_17);
              __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_16, __pyx_t_17);
              __pyx_L50_try_end:;
            }
          }
          /*finally:*/ {
            /*normal exit:*/{
              if (__pyx_t_8) {
                __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__31, NULL);
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                __Pyx_GOTREF(__pyx_t_17);
                __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
              }
              goto __pyx_L42;
            }
            __pyx_L42:;
          }
          goto __pyx_L54;
          __pyx_L37_error:;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          goto __pyx_L24_except_error;
          __pyx_L54:;
        }
        goto __pyx_L36;
      }
      __pyx_L36:;
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L29_try_end;
    __pyx_L22_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "cassandra/cluster.py":997
 *                     future.add_done_callback(callback)
 *                     futures.add(future)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             log.exception("Unexpected failure handling node %s being marked up:", host)
 *             for future in futures:
 */
    __pyx_t_19 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_19) {
      __Pyx_AddTraceback("cassandra.cluster.Cluster.on_up", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_14);

      /* "cassandra/cluster.py":998
 *                     futures.add(future)
 *         except Exception:
 *             log.exception("Unexpected failure handling node %s being marked up:", host)             # <<<<<<<<<<<<<<
 *             for future in futures:
 *                 future.cancel()
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exception); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_20);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_20))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_20);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_20, function);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_21 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_21);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_Unexpected_failure_handling_node);
      __Pyx_GIVEREF(__pyx_kp_s_Unexpected_failure_handling_node);
      PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_5, __pyx_kp_s_Unexpected_failure_handling_node);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_5, __pyx_v_host);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_21, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cassandra/cluster.py":999
 *         except Exception:
 *             log.exception("Unexpected failure handling node %s being marked up:", host)
 *             for future in futures:             # <<<<<<<<<<<<<<
 *                 future.cancel()
 * 
 */
      __pyx_t_4 = PyObject_GetIter(__pyx_v_futures); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_13 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      for (;;) {
        {
          __pyx_t_20 = __pyx_t_13(__pyx_t_4);
          if (unlikely(!__pyx_t_20)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_20);
        }
        __Pyx_XDECREF_SET(__pyx_v_future, __pyx_t_20);
        __pyx_t_20 = 0;

        /* "cassandra/cluster.py":1000
 *             log.exception("Unexpected failure handling node %s being marked up:", host)
 *             for future in futures:
 *                 future.cancel()             # <<<<<<<<<<<<<<
 * 
 *             self._cleanup_failed_on_up_handling(host)
 */
        __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_cancel); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_21);
        __pyx_t_3 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_21))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_21);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_21, function);
          }
        }
        if (__pyx_t_3) {
          __pyx_t_20 = __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_t_3); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else {
          __pyx_t_20 = __Pyx_PyObject_CallNoArg(__pyx_t_21); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        }
        __Pyx_GOTREF(__pyx_t_20);
        __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;

        /* "cassandra/cluster.py":999
 *         except Exception:
 *             log.exception("Unexpected failure handling node %s being marked up:", host)
 *             for future in futures:             # <<<<<<<<<<<<<<
 *                 future.cancel()
 * 
 */
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cassandra/cluster.py":1002
 *                 future.cancel()
 * 
 *             self._cleanup_failed_on_up_handling(host)             # <<<<<<<<<<<<<<
 * 
 *             with host.lock:
 */
      __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cleanup_failed_on_up_handling); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_20);
      __pyx_t_21 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_20))) {
        __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_20);
        if (likely(__pyx_t_21)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
          __Pyx_INCREF(__pyx_t_21);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_20, function);
        }
      }
      if (!__pyx_t_21) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_v_host); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_21); __pyx_t_21 = NULL;
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_host);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cassandra/cluster.py":1004
 *             self._cleanup_failed_on_up_handling(host)
 * 
 *             with host.lock:             # <<<<<<<<<<<<<<
 *                 host._currently_handling_node_up = False
 *             raise
 */
      /*with:*/ {
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_lock_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_8 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_exit); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L59_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_21 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_21)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_21);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_21) {
          __pyx_t_20 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_21); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L59_error;}
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
        } else {
          __pyx_t_20 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L59_error;}
        }
        __Pyx_GOTREF(__pyx_t_20);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        /*try:*/ {
          {
            __Pyx_ExceptionSave(&__pyx_t_17, &__pyx_t_16, &__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_17);
            __Pyx_XGOTREF(__pyx_t_16);
            __Pyx_XGOTREF(__pyx_t_11);
            /*try:*/ {

              /* "cassandra/cluster.py":1005
 * 
 *             with host.lock:
 *                 host._currently_handling_node_up = False             # <<<<<<<<<<<<<<
 *             raise
 *         else:
 */
              if (__Pyx_PyObject_SetAttrStr(__pyx_v_host, __pyx_n_s_currently_handling_node_up, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L65_error;}
            }
            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
            __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            goto __pyx_L72_try_end;
            __pyx_L65_error:;
            __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

            /* "cassandra/cluster.py":1004
 *             self._cleanup_failed_on_up_handling(host)
 * 
 *             with host.lock:             # <<<<<<<<<<<<<<
 *                 host._currently_handling_node_up = False
 *             raise
 */
            /*except:*/ {
              __Pyx_AddTraceback("cassandra.cluster.Cluster.on_up", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_20, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L67_except_error;}
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_GOTREF(__pyx_t_20);
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_21 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_20, __pyx_t_3); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L67_except_error;}
              __Pyx_GOTREF(__pyx_t_21);
              __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_21, NULL);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
              if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L67_except_error;}
              __Pyx_GOTREF(__pyx_t_18);
              __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_18);
              __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
              if (__pyx_t_12 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L67_except_error;}
              __pyx_t_2 = ((!(__pyx_t_12 != 0)) != 0);
              if (__pyx_t_2) {
                __Pyx_GIVEREF(__pyx_t_4);
                __Pyx_GIVEREF(__pyx_t_20);
                __Pyx_XGIVEREF(__pyx_t_3);
                __Pyx_ErrRestore(__pyx_t_4, __pyx_t_20, __pyx_t_3);
                __pyx_t_4 = 0; __pyx_t_20 = 0; __pyx_t_3 = 0; 
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L67_except_error;}
              }
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              goto __pyx_L66_exception_handled;
            }
            __pyx_L67_except_error:;
            __Pyx_XGIVEREF(__pyx_t_17);
            __Pyx_XGIVEREF(__pyx_t_16);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_11);
            goto __pyx_L24_except_error;
            __pyx_L66_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_17);
            __Pyx_XGIVEREF(__pyx_t_16);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_11);
            __pyx_L72_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_8) {
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__32, NULL);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            }
            goto __pyx_L64;
          }
          __pyx_L64:;
        }
        goto __pyx_L76;
        __pyx_L59_error:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L24_except_error;
        __pyx_L76:;
      }

      /* "cassandra/cluster.py":1006
 *             with host.lock:
 *                 host._currently_handling_node_up = False
 *             raise             # <<<<<<<<<<<<<<
 *         else:
 *             if not have_future:
 */
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_1, __pyx_t_14);
      __pyx_t_6 = 0; __pyx_t_1 = 0; __pyx_t_14 = 0; 
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
    }
    goto __pyx_L24_except_error;
    __pyx_L24_except_error:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_10, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L29_try_end:;
  }

  /* "cassandra/cluster.py":1013
 * 
 *         # for testing purposes
 *         return futures             # <<<<<<<<<<<<<<
 * 
 *     def _start_reconnector(self, host, is_host_addition):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_futures);
  __pyx_r = __pyx_v_futures;
  goto __pyx_L0;

  /* "cassandra/cluster.py":945
 *             session.update_created_pools()
 * 
 *     def on_up(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Intended for internal use only.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.on_up", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_futures);
  __Pyx_XDECREF(__pyx_v_reconnector);
  __Pyx_XDECREF(__pyx_v_session);
  __Pyx_XDECREF(__pyx_v_futures_lock);
  __Pyx_XDECREF(__pyx_v_futures_results);
  __Pyx_XDECREF(__pyx_v_callback);
  __Pyx_XDECREF(__pyx_v_future);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1015
 *         return futures
 * 
 *     def _start_reconnector(self, host, is_host_addition):             # <<<<<<<<<<<<<<
 *         if self.load_balancing_policy.distance(host) == HostDistance.IGNORED:
 *             return
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_47_start_reconnector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_47_start_reconnector = {"_start_reconnector", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_47_start_reconnector, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_47_start_reconnector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_is_host_addition = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_start_reconnector (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,&__pyx_n_s_is_host_addition,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_start_reconnector", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_is_host_addition)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_start_reconnector", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_start_reconnector") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
    __pyx_v_is_host_addition = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_start_reconnector", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster._start_reconnector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_46_start_reconnector(__pyx_self, __pyx_v_self, __pyx_v_host, __pyx_v_is_host_addition);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_46_start_reconnector(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_is_host_addition) {
  PyObject *__pyx_v_schedule = NULL;
  PyObject *__pyx_v_conn_factory = NULL;
  PyObject *__pyx_v_reconnector = NULL;
  PyObject *__pyx_v_old_reconnector = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_start_reconnector", 0);

  /* "cassandra/cluster.py":1016
 * 
 *     def _start_reconnector(self, host, is_host_addition):
 *         if self.load_balancing_policy.distance(host) == HostDistance.IGNORED:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_load_balancing_policy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_distance); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_host);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostDistance); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_IGNORED); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":1017
 *     def _start_reconnector(self, host, is_host_addition):
 *         if self.load_balancing_policy.distance(host) == HostDistance.IGNORED:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         schedule = self.reconnection_policy.new_schedule()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":1019
 *             return
 * 
 *         schedule = self.reconnection_policy.new_schedule()             # <<<<<<<<<<<<<<
 * 
 *         # in order to not hold references to this Cluster open and prevent
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_policy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_new_schedule); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_schedule = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cassandra/cluster.py":1024
 *         # proper shutdown when the program ends, we'll just make a closure
 *         # of the current Cluster attributes to create new Connections with
 *         conn_factory = self._make_connection_factory(host)             # <<<<<<<<<<<<<<
 * 
 *         reconnector = _HostReconnectionHandler(
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_make_connection_factory); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_host); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_host);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_conn_factory = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cassandra/cluster.py":1026
 *         conn_factory = self._make_connection_factory(host)
 * 
 *         reconnector = _HostReconnectionHandler(             # <<<<<<<<<<<<<<
 *             host, conn_factory, is_host_addition, self.on_add, self.on_up,
 *             self.scheduler, schedule, host.get_and_set_reconnection_handler,
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostReconnectionHandler); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "cassandra/cluster.py":1027
 * 
 *         reconnector = _HostReconnectionHandler(
 *             host, conn_factory, is_host_addition, self.on_add, self.on_up,             # <<<<<<<<<<<<<<
 *             self.scheduler, schedule, host.get_and_set_reconnection_handler,
 *             new_handler=None)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_add); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_up); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "cassandra/cluster.py":1028
 *         reconnector = _HostReconnectionHandler(
 *             host, conn_factory, is_host_addition, self.on_add, self.on_up,
 *             self.scheduler, schedule, host.get_and_set_reconnection_handler,             # <<<<<<<<<<<<<<
 *             new_handler=None)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scheduler); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_get_and_set_reconnection_handler); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);

  /* "cassandra/cluster.py":1026
 *         conn_factory = self._make_connection_factory(host)
 * 
 *         reconnector = _HostReconnectionHandler(             # <<<<<<<<<<<<<<
 *             host, conn_factory, is_host_addition, self.on_add, self.on_up,
 *             self.scheduler, schedule, host.get_and_set_reconnection_handler,
 */
  __pyx_t_7 = PyTuple_New(8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_host);
  __Pyx_GIVEREF(__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_host);
  __Pyx_INCREF(__pyx_v_conn_factory);
  __Pyx_GIVEREF(__pyx_v_conn_factory);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_conn_factory);
  __Pyx_INCREF(__pyx_v_is_host_addition);
  __Pyx_GIVEREF(__pyx_v_is_host_addition);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_is_host_addition);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_schedule);
  __Pyx_GIVEREF(__pyx_v_schedule);
  PyTuple_SET_ITEM(__pyx_t_7, 6, __pyx_v_schedule);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_7, 7, __pyx_t_6);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);

  /* "cassandra/cluster.py":1029
 *             host, conn_factory, is_host_addition, self.on_add, self.on_up,
 *             self.scheduler, schedule, host.get_and_set_reconnection_handler,
 *             new_handler=None)             # <<<<<<<<<<<<<<
 * 
 *         old_reconnector = host.get_and_set_reconnection_handler(reconnector)
 */
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_new_handler, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1026
 *         conn_factory = self._make_connection_factory(host)
 * 
 *         reconnector = _HostReconnectionHandler(             # <<<<<<<<<<<<<<
 *             host, conn_factory, is_host_addition, self.on_add, self.on_up,
 *             self.scheduler, schedule, host.get_and_set_reconnection_handler,
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_reconnector = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cassandra/cluster.py":1031
 *             new_handler=None)
 * 
 *         old_reconnector = host.get_and_set_reconnection_handler(reconnector)             # <<<<<<<<<<<<<<
 *         if old_reconnector:
 *             log.debug("Old host reconnector found for %s, cancelling", host)
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_get_and_set_reconnection_handler); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_reconnector); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_v_reconnector);
    __Pyx_GIVEREF(__pyx_v_reconnector);
    PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_reconnector);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_old_reconnector = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cassandra/cluster.py":1032
 * 
 *         old_reconnector = host.get_and_set_reconnection_handler(reconnector)
 *         if old_reconnector:             # <<<<<<<<<<<<<<
 *             log.debug("Old host reconnector found for %s, cancelling", host)
 *             old_reconnector.cancel()
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_old_reconnector); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":1033
 *         old_reconnector = host.get_and_set_reconnection_handler(reconnector)
 *         if old_reconnector:
 *             log.debug("Old host reconnector found for %s, cancelling", host)             # <<<<<<<<<<<<<<
 *             old_reconnector.cancel()
 * 
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_8 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Old_host_reconnector_found_for_s);
    __Pyx_GIVEREF(__pyx_kp_s_Old_host_reconnector_found_for_s);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_kp_s_Old_host_reconnector_found_for_s);
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_v_host);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":1034
 *         if old_reconnector:
 *             log.debug("Old host reconnector found for %s, cancelling", host)
 *             old_reconnector.cancel()             # <<<<<<<<<<<<<<
 * 
 *         log.debug("Starting reconnector for host %s", host)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_old_reconnector, __pyx_n_s_cancel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_7) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cassandra/cluster.py":1036
 *             old_reconnector.cancel()
 * 
 *         log.debug("Starting reconnector for host %s", host)             # <<<<<<<<<<<<<<
 *         reconnector.start()
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_Starting_reconnector_for_host_s);
  __Pyx_GIVEREF(__pyx_kp_s_Starting_reconnector_for_host_s);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_kp_s_Starting_reconnector_for_host_s);
  __Pyx_INCREF(__pyx_v_host);
  __Pyx_GIVEREF(__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_v_host);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":1037
 * 
 *         log.debug("Starting reconnector for host %s", host)
 *         reconnector.start()             # <<<<<<<<<<<<<<
 * 
 *     @run_in_executor
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_reconnector, __pyx_n_s_start); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (__pyx_t_6) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":1015
 *         return futures
 * 
 *     def _start_reconnector(self, host, is_host_addition):             # <<<<<<<<<<<<<<
 *         if self.load_balancing_policy.distance(host) == HostDistance.IGNORED:
 *             return
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.Cluster._start_reconnector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_schedule);
  __Pyx_XDECREF(__pyx_v_conn_factory);
  __Pyx_XDECREF(__pyx_v_reconnector);
  __Pyx_XDECREF(__pyx_v_old_reconnector);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1040
 * 
 *     @run_in_executor
 *     def on_down(self, host, is_host_addition, expect_host_to_be_down=False):             # <<<<<<<<<<<<<<
 *         """
 *         Intended for internal use only.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_49on_down(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_48on_down[] = "\n        Intended for internal use only.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_49on_down = {"on_down", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_49on_down, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_48on_down};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_49on_down(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_is_host_addition = 0;
  PyObject *__pyx_v_expect_host_to_be_down = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_down (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,&__pyx_n_s_is_host_addition,&__pyx_n_s_expect_host_to_be_down,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_down", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_is_host_addition)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_down", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_expect_host_to_be_down);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_down") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
    __pyx_v_is_host_addition = values[2];
    __pyx_v_expect_host_to_be_down = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_down", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.on_down", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_48on_down(__pyx_self, __pyx_v_self, __pyx_v_host, __pyx_v_is_host_addition, __pyx_v_expect_host_to_be_down);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_48on_down(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_is_host_addition, PyObject *__pyx_v_expect_host_to_be_down) {
  PyObject *__pyx_v_session = NULL;
  PyObject *__pyx_v_listener = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  Py_ssize_t __pyx_t_13;
  PyObject *(*__pyx_t_14)(PyObject *);
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_down", 0);

  /* "cassandra/cluster.py":1044
 *         Intended for internal use only.
 *         """
 *         if self.is_shutdown:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":1045
 *         """
 *         if self.is_shutdown:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         with host.lock:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":1047
 *             return
 * 
 *         with host.lock:             # <<<<<<<<<<<<<<
 *             if (not host.is_up and not expect_host_to_be_down) or host.is_currently_reconnecting():
 *                 return
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_lock_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "cassandra/cluster.py":1048
 * 
 *         with host.lock:
 *             if (not host.is_up and not expect_host_to_be_down) or host.is_currently_reconnecting():             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_is_up); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_11 = ((!__pyx_t_10) != 0);
          if (!__pyx_t_11) {
            goto __pyx_L18_next_or;
          } else {
          }
          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_expect_host_to_be_down); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __pyx_t_10 = ((!__pyx_t_11) != 0);
          if (!__pyx_t_10) {
          } else {
            __pyx_t_2 = __pyx_t_10;
            goto __pyx_L17_bool_binop_done;
          }
          __pyx_L18_next_or:;
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_is_currently_reconnecting); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
            if (likely(__pyx_t_5)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_5);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_4, function);
            }
          }
          if (__pyx_t_5) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          } else {
            __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          }
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_2 = __pyx_t_10;
          __pyx_L17_bool_binop_done:;
          if (__pyx_t_2) {

            /* "cassandra/cluster.py":1049
 *         with host.lock:
 *             if (not host.is_up and not expect_host_to_be_down) or host.is_currently_reconnecting():
 *                 return             # <<<<<<<<<<<<<<
 * 
 *             host.set_down()
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            goto __pyx_L12_try_return;
          }

          /* "cassandra/cluster.py":1051
 *                 return
 * 
 *             host.set_down()             # <<<<<<<<<<<<<<
 * 
 *         log.warning("Host %s has been marked down", host)
 */
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_set_down); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
            if (likely(__pyx_t_5)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_5);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_4, function);
            }
          }
          if (__pyx_t_5) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          } else {
            __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          }
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L15_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":1047
 *             return
 * 
 *         with host.lock:             # <<<<<<<<<<<<<<
 *             if (not host.is_up and not expect_host_to_be_down) or host.is_currently_reconnecting():
 *                 return
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.Cluster.on_down", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_6 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (__pyx_t_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
          if (__pyx_t_10) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_4);
            __Pyx_XGIVEREF(__pyx_t_5);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_4, __pyx_t_5);
            __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L9_exception_handled;
        }
        __pyx_L10_except_error:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L12_try_return:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L5_return;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        __pyx_L15_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_3) {
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__33, NULL);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L5_return: {
        __pyx_t_9 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_3) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__34, NULL);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __pyx_r = __pyx_t_9;
        __pyx_t_9 = 0;
        goto __pyx_L0;
      }
      __pyx_L7:;
    }
    goto __pyx_L23;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L1_error;
    __pyx_L23:;
  }

  /* "cassandra/cluster.py":1053
 *             host.set_down()
 * 
 *         log.warning("Host %s has been marked down", host)             # <<<<<<<<<<<<<<
 * 
 *         self.load_balancing_policy.on_down(host)
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_warning); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_13 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_13 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_Host_s_has_been_marked_down);
  __Pyx_GIVEREF(__pyx_kp_s_Host_s_has_been_marked_down);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_13, __pyx_kp_s_Host_s_has_been_marked_down);
  __Pyx_INCREF(__pyx_v_host);
  __Pyx_GIVEREF(__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_13, __pyx_v_host);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cassandra/cluster.py":1055
 *         log.warning("Host %s has been marked down", host)
 * 
 *         self.load_balancing_policy.on_down(host)             # <<<<<<<<<<<<<<
 *         self.control_connection.on_down(host)
 *         for session in self.sessions:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_load_balancing_policy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_on_down); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_host); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_host);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cassandra/cluster.py":1056
 * 
 *         self.load_balancing_policy.on_down(host)
 *         self.control_connection.on_down(host)             # <<<<<<<<<<<<<<
 *         for session in self.sessions:
 *             session.on_down(host)
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_on_down); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_host); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_host);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cassandra/cluster.py":1057
 *         self.load_balancing_policy.on_down(host)
 *         self.control_connection.on_down(host)
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.on_down(host)
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sessions); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
    __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
  } else {
    __pyx_t_13 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_14 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  for (;;) {
    if (likely(!__pyx_t_14)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_5); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_5); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_14(__pyx_t_4);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_session, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "cassandra/cluster.py":1058
 *         self.control_connection.on_down(host)
 *         for session in self.sessions:
 *             session.on_down(host)             # <<<<<<<<<<<<<<
 * 
 *         for listener in self.listeners:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_on_down); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_host); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_host);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_15, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":1057
 *         self.load_balancing_policy.on_down(host)
 *         self.control_connection.on_down(host)
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.on_down(host)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":1060
 *             session.on_down(host)
 * 
 *         for listener in self.listeners:             # <<<<<<<<<<<<<<
 *             listener.on_down(host)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_listeners_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
  } else {
    __pyx_t_13 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_14 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_14)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_14(__pyx_t_5);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_listener, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":1061
 * 
 *         for listener in self.listeners:
 *             listener.on_down(host)             # <<<<<<<<<<<<<<
 * 
 *         self._start_reconnector(host, is_host_addition)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_listener, __pyx_n_s_on_down); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_15 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_15) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_host); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_15); __pyx_t_15 = NULL;
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_host);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":1060
 *             session.on_down(host)
 * 
 *         for listener in self.listeners:             # <<<<<<<<<<<<<<
 *             listener.on_down(host)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cassandra/cluster.py":1063
 *             listener.on_down(host)
 * 
 *         self._start_reconnector(host, is_host_addition)             # <<<<<<<<<<<<<<
 * 
 *     def on_add(self, host, refresh_nodes=True):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_start_reconnector); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = NULL;
  __pyx_t_13 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_13 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_1) {
    __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
  }
  __Pyx_INCREF(__pyx_v_host);
  __Pyx_GIVEREF(__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_13, __pyx_v_host);
  __Pyx_INCREF(__pyx_v_is_host_addition);
  __Pyx_GIVEREF(__pyx_v_is_host_addition);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_13, __pyx_v_is_host_addition);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cassandra/cluster.py":1040
 * 
 *     @run_in_executor
 *     def on_down(self, host, is_host_addition, expect_host_to_be_down=False):             # <<<<<<<<<<<<<<
 *         """
 *         Intended for internal use only.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.on_down", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_session);
  __Pyx_XDECREF(__pyx_v_listener);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1065
 *         self._start_reconnector(host, is_host_addition)
 * 
 *     def on_add(self, host, refresh_nodes=True):             # <<<<<<<<<<<<<<
 *         if self.is_shutdown:
 *             return
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_51on_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_51on_add = {"on_add", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_51on_add, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_51on_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_refresh_nodes = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_add (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,&__pyx_n_s_refresh_nodes,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_add", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_refresh_nodes);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
    __pyx_v_refresh_nodes = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_add", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.on_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_50on_add(__pyx_self, __pyx_v_self, __pyx_v_host, __pyx_v_refresh_nodes);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1089
 *         futures = set()
 * 
 *         def future_completed(future):             # <<<<<<<<<<<<<<
 *             with futures_lock:
 *                 futures.discard(future)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_6on_add_1future_completed(PyObject *__pyx_self, PyObject *__pyx_v_future); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_6on_add_1future_completed = {"future_completed", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_6on_add_1future_completed, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_6on_add_1future_completed(PyObject *__pyx_self, PyObject *__pyx_v_future) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("future_completed (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_6on_add_future_completed(__pyx_self, ((PyObject *)__pyx_v_future));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_6on_add_future_completed(PyObject *__pyx_self, PyObject *__pyx_v_future) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add *__pyx_cur_scope;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add *__pyx_outer_scope;
  PyObject *__pyx_v_exc = NULL;
  PyObject *__pyx_v_f = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("future_completed", 0);
  __pyx_outer_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "cassandra/cluster.py":1090
 * 
 *         def future_completed(future):
 *             with futures_lock:             # <<<<<<<<<<<<<<
 *                 futures.discard(future)
 * 
 */
  /*with:*/ {
    if (unlikely(!__pyx_cur_scope->__pyx_v_futures_lock)) { __Pyx_RaiseClosureNameError("futures_lock"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_futures_lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_cur_scope->__pyx_v_futures_lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        /*try:*/ {

          /* "cassandra/cluster.py":1091
 *         def future_completed(future):
 *             with futures_lock:
 *                 futures.discard(future)             # <<<<<<<<<<<<<<
 * 
 *                 try:
 */
          if (unlikely(!__pyx_cur_scope->__pyx_v_futures)) { __Pyx_RaiseClosureNameError("futures"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L7_error;} }
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_futures, __pyx_n_s_discard); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
            if (likely(__pyx_t_4)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_3, function);
            }
          }
          if (!__pyx_t_4) {
            __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_future); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_2);
          } else {
            __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
            __Pyx_INCREF(__pyx_v_future);
            __Pyx_GIVEREF(__pyx_v_future);
            PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_future);
            __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          }
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "cassandra/cluster.py":1093
 *                 futures.discard(future)
 * 
 *                 try:             # <<<<<<<<<<<<<<
 *                     futures_results.append(future.result())
 *                 except Exception as exc:
 */
          {
            __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
            __Pyx_XGOTREF(__pyx_t_9);
            __Pyx_XGOTREF(__pyx_t_10);
            __Pyx_XGOTREF(__pyx_t_11);
            /*try:*/ {

              /* "cassandra/cluster.py":1094
 * 
 *                 try:
 *                     futures_results.append(future.result())             # <<<<<<<<<<<<<<
 *                 except Exception as exc:
 *                     futures_results.append(exc)
 */
              if (unlikely(!__pyx_cur_scope->__pyx_v_futures_results)) { __Pyx_RaiseClosureNameError("futures_results"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L15_error;} }
              if (unlikely(__pyx_cur_scope->__pyx_v_futures_results == Py_None)) {
                PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
              }
              __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_8 = NULL;
              if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
                __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
                if (likely(__pyx_t_8)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                  __Pyx_INCREF(__pyx_t_8);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_3, function);
                }
              }
              if (__pyx_t_8) {
                __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              } else {
                __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
              }
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __pyx_t_12 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_futures_results, __pyx_t_2); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            }
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            goto __pyx_L22_try_end;
            __pyx_L15_error:;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

            /* "cassandra/cluster.py":1095
 *                 try:
 *                     futures_results.append(future.result())
 *                 except Exception as exc:             # <<<<<<<<<<<<<<
 *                     futures_results.append(exc)
 * 
 */
            __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
            if (__pyx_t_13) {
              __Pyx_AddTraceback("cassandra.cluster.Cluster.on_add.future_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_INCREF(__pyx_t_3);
              __pyx_v_exc = __pyx_t_3;

              /* "cassandra/cluster.py":1096
 *                     futures_results.append(future.result())
 *                 except Exception as exc:
 *                     futures_results.append(exc)             # <<<<<<<<<<<<<<
 * 
 *                 if futures:
 */
              if (unlikely(!__pyx_cur_scope->__pyx_v_futures_results)) { __Pyx_RaiseClosureNameError("futures_results"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;} }
              if (unlikely(__pyx_cur_scope->__pyx_v_futures_results == Py_None)) {
                PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
              }
              __pyx_t_12 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_futures_results, __pyx_v_exc); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              goto __pyx_L16_exception_handled;
            }
            goto __pyx_L17_except_error;
            __pyx_L17_except_error:;
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
            goto __pyx_L7_error;
            __pyx_L16_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_XGIVEREF(__pyx_t_10);
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
            __pyx_L22_try_end:;
          }

          /* "cassandra/cluster.py":1098
 *                     futures_results.append(exc)
 * 
 *                 if futures:             # <<<<<<<<<<<<<<
 *                     return
 * 
 */
          if (unlikely(!__pyx_cur_scope->__pyx_v_futures)) { __Pyx_RaiseClosureNameError("futures"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L7_error;} }
          __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_futures); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          if (__pyx_t_14) {

            /* "cassandra/cluster.py":1099
 * 
 *                 if futures:
 *                     return             # <<<<<<<<<<<<<<
 * 
 *             log.debug('All futures have completed for added host %s', host)
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            goto __pyx_L11_try_return;
          }
        }
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "cassandra/cluster.py":1090
 * 
 *         def future_completed(future):
 *             with futures_lock:             # <<<<<<<<<<<<<<
 *                 futures.discard(future)
 * 
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.Cluster.on_add.future_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = PyTuple_Pack(3, __pyx_t_8, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_15 = ((!(__pyx_t_14 != 0)) != 0);
          if (__pyx_t_15) {
            __Pyx_GIVEREF(__pyx_t_8);
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_XGIVEREF(__pyx_t_2);
            __Pyx_ErrRestore(__pyx_t_8, __pyx_t_3, __pyx_t_2);
            __pyx_t_8 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L4_return;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_1) {
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__35, NULL);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_7 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_1) {
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__36, NULL);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L29;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L1_error;
    __pyx_L29:;
  }

  /* "cassandra/cluster.py":1101
 *                     return
 * 
 *             log.debug('All futures have completed for added host %s', host)             # <<<<<<<<<<<<<<
 * 
 *             for exc in [f for f in futures_results if isinstance(f, Exception)]:
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_v_host)) { __Pyx_RaiseClosureNameError("host"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_3 = NULL;
  __pyx_t_16 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_16 = 1;
    }
  }
  __pyx_t_4 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_All_futures_have_completed_for_a);
  __Pyx_GIVEREF(__pyx_kp_s_All_futures_have_completed_for_a);
  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_16, __pyx_kp_s_All_futures_have_completed_for_a);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_16, __pyx_cur_scope->__pyx_v_host);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1103
 *             log.debug('All futures have completed for added host %s', host)
 * 
 *             for exc in [f for f in futures_results if isinstance(f, Exception)]:             # <<<<<<<<<<<<<<
 *                 log.error("Unexpected failure while adding node %s, will not mark up:", host, exc_info=exc)
 *                 return
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(!__pyx_cur_scope->__pyx_v_futures_results)) { __Pyx_RaiseClosureNameError("futures_results"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  if (unlikely(__pyx_cur_scope->__pyx_v_futures_results == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_8 = __pyx_cur_scope->__pyx_v_futures_results; __Pyx_INCREF(__pyx_t_8); __pyx_t_16 = 0;
  for (;;) {
    if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_8)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_16); __Pyx_INCREF(__pyx_t_4); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_8, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_15 = PyObject_IsInstance(__pyx_v_f, __pyx_builtin_Exception); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_14 = (__pyx_t_15 != 0);
    if (__pyx_t_14) {
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_v_f))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L34;
    }
    __pyx_L34:;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __pyx_t_2; __Pyx_INCREF(__pyx_t_8); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_8)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_16); __Pyx_INCREF(__pyx_t_2); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_2 = PySequence_ITEM(__pyx_t_8, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_exc, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":1104
 * 
 *             for exc in [f for f in futures_results if isinstance(f, Exception)]:
 *                 log.error("Unexpected failure while adding node %s, will not mark up:", host, exc_info=exc)             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_v_host)) { __Pyx_RaiseClosureNameError("host"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_kp_s_Unexpected_failure_while_adding);
    __Pyx_GIVEREF(__pyx_kp_s_Unexpected_failure_while_adding);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_Unexpected_failure_while_adding);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_cur_scope->__pyx_v_host);
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_exc_info, __pyx_v_exc) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

    /* "cassandra/cluster.py":1105
 *             for exc in [f for f in futures_results if isinstance(f, Exception)]:
 *                 log.error("Unexpected failure while adding node %s, will not mark up:", host, exc_info=exc)
 *                 return             # <<<<<<<<<<<<<<
 * 
 *             if not all(futures_results):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "cassandra/cluster.py":1103
 *             log.debug('All futures have completed for added host %s', host)
 * 
 *             for exc in [f for f in futures_results if isinstance(f, Exception)]:             # <<<<<<<<<<<<<<
 *                 log.error("Unexpected failure while adding node %s, will not mark up:", host, exc_info=exc)
 *                 return
 */
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "cassandra/cluster.py":1107
 *                 return
 * 
 *             if not all(futures_results):             # <<<<<<<<<<<<<<
 *                 log.warning("Connection pool could not be created, not marking node %s up", host)
 *                 return
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_futures_results)) { __Pyx_RaiseClosureNameError("futures_results"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_futures_results);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_futures_results);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_cur_scope->__pyx_v_futures_results);
  __pyx_t_17 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_8, NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __pyx_t_15 = ((!__pyx_t_14) != 0);
  if (__pyx_t_15) {

    /* "cassandra/cluster.py":1108
 * 
 *             if not all(futures_results):
 *                 log.warning("Connection pool could not be created, not marking node %s up", host)             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_warning); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_v_host)) { __Pyx_RaiseClosureNameError("host"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_8 = NULL;
    __pyx_t_16 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_16 = 1;
      }
    }
    __pyx_t_2 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Connection_pool_could_not_be_cre);
    __Pyx_GIVEREF(__pyx_kp_s_Connection_pool_could_not_be_cre);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_16, __pyx_kp_s_Connection_pool_could_not_be_cre);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_16, __pyx_cur_scope->__pyx_v_host);
    __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

    /* "cassandra/cluster.py":1109
 *             if not all(futures_results):
 *                 log.warning("Connection pool could not be created, not marking node %s up", host)
 *                 return             # <<<<<<<<<<<<<<
 * 
 *             self._finalize_add(host)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":1111
 *                 return
 * 
 *             self._finalize_add(host)             # <<<<<<<<<<<<<<
 * 
 *         have_future = False
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_finalize_add); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (unlikely(!__pyx_cur_scope->__pyx_v_host)) { __Pyx_RaiseClosureNameError("host"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_17 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_host); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_17);
  } else {
    __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_cur_scope->__pyx_v_host);
    __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

  /* "cassandra/cluster.py":1089
 *         futures = set()
 * 
 *         def future_completed(future):             # <<<<<<<<<<<<<<
 *             with futures_lock:
 *                 futures.discard(future)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.on_add.future_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1065
 *         self._start_reconnector(host, is_host_addition)
 * 
 *     def on_add(self, host, refresh_nodes=True):             # <<<<<<<<<<<<<<
 *         if self.is_shutdown:
 *             return
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_50on_add(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_refresh_nodes) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add *__pyx_cur_scope;
  PyObject *__pyx_v_distance = NULL;
  PyObject *__pyx_v_future_completed = 0;
  int __pyx_v_have_future;
  PyObject *__pyx_v_session = NULL;
  PyObject *__pyx_v_future = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_add", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_1_on_add(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_1_on_add, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_host = __pyx_v_host;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);

  /* "cassandra/cluster.py":1066
 * 
 *     def on_add(self, host, refresh_nodes=True):
 *         if self.is_shutdown:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":1067
 *     def on_add(self, host, refresh_nodes=True):
 *         if self.is_shutdown:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         log.debug("Handling new host %r and notifying listeners", host)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":1069
 *             return
 * 
 *         log.debug("Handling new host %r and notifying listeners", host)             # <<<<<<<<<<<<<<
 * 
 *         distance = self.load_balancing_policy.distance(host)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_Handling_new_host_r_and_notifyin);
  __Pyx_GIVEREF(__pyx_kp_s_Handling_new_host_r_and_notifyin);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_s_Handling_new_host_r_and_notifyin);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_cur_scope->__pyx_v_host);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1071
 *         log.debug("Handling new host %r and notifying listeners", host)
 * 
 *         distance = self.load_balancing_policy.distance(host)             # <<<<<<<<<<<<<<
 *         if distance != HostDistance.IGNORED:
 *             self._prepare_all_queries(host)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_load_balancing_policy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_distance); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_cur_scope->__pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_cur_scope->__pyx_v_host);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_distance = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1072
 * 
 *         distance = self.load_balancing_policy.distance(host)
 *         if distance != HostDistance.IGNORED:             # <<<<<<<<<<<<<<
 *             self._prepare_all_queries(host)
 *             log.debug("Done preparing queries for new host %r", host)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostDistance); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_IGNORED); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_distance, __pyx_t_6, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":1073
 *         distance = self.load_balancing_policy.distance(host)
 *         if distance != HostDistance.IGNORED:
 *             self._prepare_all_queries(host)             # <<<<<<<<<<<<<<
 *             log.debug("Done preparing queries for new host %r", host)
 * 
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_prepare_all_queries); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_cur_scope->__pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_cur_scope->__pyx_v_host);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1074
 *         if distance != HostDistance.IGNORED:
 *             self._prepare_all_queries(host)
 *             log.debug("Done preparing queries for new host %r", host)             # <<<<<<<<<<<<<<
 * 
 *         self.load_balancing_policy.on_add(host)
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_5 = 1;
      }
    }
    __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Done_preparing_queries_for_new_h);
    __Pyx_GIVEREF(__pyx_kp_s_Done_preparing_queries_for_new_h);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_kp_s_Done_preparing_queries_for_new_h);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_cur_scope->__pyx_v_host);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cassandra/cluster.py":1076
 *             log.debug("Done preparing queries for new host %r", host)
 * 
 *         self.load_balancing_policy.on_add(host)             # <<<<<<<<<<<<<<
 *         self.control_connection.on_add(host, refresh_nodes)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_load_balancing_policy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_on_add); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_cur_scope->__pyx_v_host);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1077
 * 
 *         self.load_balancing_policy.on_add(host)
 *         self.control_connection.on_add(host, refresh_nodes)             # <<<<<<<<<<<<<<
 * 
 *         if distance == HostDistance.IGNORED:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_on_add); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_cur_scope->__pyx_v_host);
  __Pyx_INCREF(__pyx_v_refresh_nodes);
  __Pyx_GIVEREF(__pyx_v_refresh_nodes);
  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_refresh_nodes);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1079
 *         self.control_connection.on_add(host, refresh_nodes)
 * 
 *         if distance == HostDistance.IGNORED:             # <<<<<<<<<<<<<<
 *             log.debug("Not adding connection pool for new host %r because the "
 *                       "load balancing policy has marked it as IGNORED", host)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostDistance); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_IGNORED); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_distance, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":1080
 * 
 *         if distance == HostDistance.IGNORED:
 *             log.debug("Not adding connection pool for new host %r because the "             # <<<<<<<<<<<<<<
 *                       "load balancing policy has marked it as IGNORED", host)
 *             self._finalize_add(host)
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "cassandra/cluster.py":1081
 *         if distance == HostDistance.IGNORED:
 *             log.debug("Not adding connection pool for new host %r because the "
 *                       "load balancing policy has marked it as IGNORED", host)             # <<<<<<<<<<<<<<
 *             self._finalize_add(host)
 *             return
 */
    __pyx_t_6 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_5 = 1;
      }
    }
    __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Not_adding_connection_pool_for_n);
    __Pyx_GIVEREF(__pyx_kp_s_Not_adding_connection_pool_for_n);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_kp_s_Not_adding_connection_pool_for_n);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_cur_scope->__pyx_v_host);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1082
 *             log.debug("Not adding connection pool for new host %r because the "
 *                       "load balancing policy has marked it as IGNORED", host)
 *             self._finalize_add(host)             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_finalize_add); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_cur_scope->__pyx_v_host);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1083
 *                       "load balancing policy has marked it as IGNORED", host)
 *             self._finalize_add(host)
 *             return             # <<<<<<<<<<<<<<
 * 
 *         futures_lock = Lock()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":1085
 *             return
 * 
 *         futures_lock = Lock()             # <<<<<<<<<<<<<<
 *         futures_results = []
 *         futures = set()
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_Lock); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_6) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_futures_lock = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1086
 * 
 *         futures_lock = Lock()
 *         futures_results = []             # <<<<<<<<<<<<<<
 *         futures = set()
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_futures_results = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1087
 *         futures_lock = Lock()
 *         futures_results = []
 *         futures = set()             # <<<<<<<<<<<<<<
 * 
 *         def future_completed(future):
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_futures = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1089
 *         futures = set()
 * 
 *         def future_completed(future):             # <<<<<<<<<<<<<<
 *             with futures_lock:
 *                 futures.discard(future)
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_6on_add_1future_completed, 0, __pyx_n_s_Cluster_on_add_locals_future_com, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_future_completed = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1113
 *             self._finalize_add(host)
 * 
 *         have_future = False             # <<<<<<<<<<<<<<
 *         for session in self.sessions:
 *             future = session.add_or_renew_pool(host, is_host_addition=True)
 */
  __pyx_v_have_future = 0;

  /* "cassandra/cluster.py":1114
 * 
 *         have_future = False
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             future = session.add_or_renew_pool(host, is_host_addition=True)
 *             if future is not None:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_sessions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_7(__pyx_t_4);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_session, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1115
 *         have_future = False
 *         for session in self.sessions:
 *             future = session.add_or_renew_pool(host, is_host_addition=True)             # <<<<<<<<<<<<<<
 *             if future is not None:
 *                 have_future = True
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_add_or_renew_pool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_host);
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_is_host_addition, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_future, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "cassandra/cluster.py":1116
 *         for session in self.sessions:
 *             future = session.add_or_renew_pool(host, is_host_addition=True)
 *             if future is not None:             # <<<<<<<<<<<<<<
 *                 have_future = True
 *                 futures.add(future)
 */
    __pyx_t_2 = (__pyx_v_future != Py_None);
    __pyx_t_9 = (__pyx_t_2 != 0);
    if (__pyx_t_9) {

      /* "cassandra/cluster.py":1117
 *             future = session.add_or_renew_pool(host, is_host_addition=True)
 *             if future is not None:
 *                 have_future = True             # <<<<<<<<<<<<<<
 *                 futures.add(future)
 *                 future.add_done_callback(future_completed)
 */
      __pyx_v_have_future = 1;

      /* "cassandra/cluster.py":1118
 *             if future is not None:
 *                 have_future = True
 *                 futures.add(future)             # <<<<<<<<<<<<<<
 *                 future.add_done_callback(future_completed)
 * 
 */
      __pyx_t_10 = PySet_Add(__pyx_cur_scope->__pyx_v_futures, __pyx_v_future); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "cassandra/cluster.py":1119
 *                 have_future = True
 *                 futures.add(future)
 *                 future.add_done_callback(future_completed)             # <<<<<<<<<<<<<<
 * 
 *         if not have_future:
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_add_done_callback); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_future_completed); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_future_completed);
        __Pyx_GIVEREF(__pyx_v_future_completed);
        PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_future_completed);
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "cassandra/cluster.py":1114
 * 
 *         have_future = False
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             future = session.add_or_renew_pool(host, is_host_addition=True)
 *             if future is not None:
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":1121
 *                 future.add_done_callback(future_completed)
 * 
 *         if not have_future:             # <<<<<<<<<<<<<<
 *             self._finalize_add(host)
 * 
 */
  __pyx_t_9 = ((!(__pyx_v_have_future != 0)) != 0);
  if (__pyx_t_9) {

    /* "cassandra/cluster.py":1122
 * 
 *         if not have_future:
 *             self._finalize_add(host)             # <<<<<<<<<<<<<<
 * 
 *     def _finalize_add(self, host):
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_finalize_add); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_cur_scope->__pyx_v_host); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_cur_scope->__pyx_v_host);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "cassandra/cluster.py":1065
 *         self._start_reconnector(host, is_host_addition)
 * 
 *     def on_add(self, host, refresh_nodes=True):             # <<<<<<<<<<<<<<
 *         if self.is_shutdown:
 *             return
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.on_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_distance);
  __Pyx_XDECREF(__pyx_v_future_completed);
  __Pyx_XDECREF(__pyx_v_session);
  __Pyx_XDECREF(__pyx_v_future);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1124
 *             self._finalize_add(host)
 * 
 *     def _finalize_add(self, host):             # <<<<<<<<<<<<<<
 *         # mark the host as up and notify all listeners
 *         host.set_up()
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_53_finalize_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_53_finalize_add = {"_finalize_add", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_53_finalize_add, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_53_finalize_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_finalize_add (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_finalize_add", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_finalize_add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_finalize_add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster._finalize_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_52_finalize_add(__pyx_self, __pyx_v_self, __pyx_v_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_52_finalize_add(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host) {
  PyObject *__pyx_v_listener = NULL;
  PyObject *__pyx_v_session = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_finalize_add", 0);

  /* "cassandra/cluster.py":1126
 *     def _finalize_add(self, host):
 *         # mark the host as up and notify all listeners
 *         host.set_up()             # <<<<<<<<<<<<<<
 *         for listener in self.listeners:
 *             listener.on_add(host)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_set_up); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1127
 *         # mark the host as up and notify all listeners
 *         host.set_up()
 *         for listener in self.listeners:             # <<<<<<<<<<<<<<
 *             listener.on_add(host)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_listeners_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_listener, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1128
 *         host.set_up()
 *         for listener in self.listeners:
 *             listener.on_add(host)             # <<<<<<<<<<<<<<
 * 
 *         # see if there are any pools to add or remove now that the host is marked up
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_listener, __pyx_n_s_on_add); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_host);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1127
 *         # mark the host as up and notify all listeners
 *         host.set_up()
 *         for listener in self.listeners:             # <<<<<<<<<<<<<<
 *             listener.on_add(host)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1131
 * 
 *         # see if there are any pools to add or remove now that the host is marked up
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.update_created_pools()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sessions); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_5(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_session, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":1132
 *         # see if there are any pools to add or remove now that the host is marked up
 *         for session in self.sessions:
 *             session.update_created_pools()             # <<<<<<<<<<<<<<
 * 
 *     def on_remove(self, host):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_update_created_pools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_7) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cassandra/cluster.py":1131
 * 
 *         # see if there are any pools to add or remove now that the host is marked up
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.update_created_pools()
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1124
 *             self._finalize_add(host)
 * 
 *     def _finalize_add(self, host):             # <<<<<<<<<<<<<<
 *         # mark the host as up and notify all listeners
 *         host.set_up()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.Cluster._finalize_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_listener);
  __Pyx_XDECREF(__pyx_v_session);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1134
 *             session.update_created_pools()
 * 
 *     def on_remove(self, host):             # <<<<<<<<<<<<<<
 *         if self.is_shutdown:
 *             return
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_55on_remove(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_55on_remove = {"on_remove", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_55on_remove, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_55on_remove(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_remove (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_remove", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_remove") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_remove", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.on_remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_54on_remove(__pyx_self, __pyx_v_self, __pyx_v_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_54on_remove(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host) {
  PyObject *__pyx_v_session = NULL;
  PyObject *__pyx_v_listener = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_remove", 0);

  /* "cassandra/cluster.py":1135
 * 
 *     def on_remove(self, host):
 *         if self.is_shutdown:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":1136
 *     def on_remove(self, host):
 *         if self.is_shutdown:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         log.debug("Removing host %s", host)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":1138
 *             return
 * 
 *         log.debug("Removing host %s", host)             # <<<<<<<<<<<<<<
 *         host.set_down()
 *         self.load_balancing_policy.on_remove(host)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_Removing_host_s);
  __Pyx_GIVEREF(__pyx_kp_s_Removing_host_s);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_s_Removing_host_s);
  __Pyx_INCREF(__pyx_v_host);
  __Pyx_GIVEREF(__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_host);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1139
 * 
 *         log.debug("Removing host %s", host)
 *         host.set_down()             # <<<<<<<<<<<<<<
 *         self.load_balancing_policy.on_remove(host)
 *         for session in self.sessions:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_set_down); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_6) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1140
 *         log.debug("Removing host %s", host)
 *         host.set_down()
 *         self.load_balancing_policy.on_remove(host)             # <<<<<<<<<<<<<<
 *         for session in self.sessions:
 *             session.on_remove(host)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_load_balancing_policy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_on_remove); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_host);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1141
 *         host.set_down()
 *         self.load_balancing_policy.on_remove(host)
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.on_remove(host)
 *         for listener in self.listeners:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sessions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); __pyx_t_5 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_6))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_7(__pyx_t_6);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_session, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1142
 *         self.load_balancing_policy.on_remove(host)
 *         for session in self.sessions:
 *             session.on_remove(host)             # <<<<<<<<<<<<<<
 *         for listener in self.listeners:
 *             listener.on_remove(host)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_on_remove); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_host);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1141
 *         host.set_down()
 *         self.load_balancing_policy.on_remove(host)
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.on_remove(host)
 *         for listener in self.listeners:
 */
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "cassandra/cluster.py":1143
 *         for session in self.sessions:
 *             session.on_remove(host)
 *         for listener in self.listeners:             # <<<<<<<<<<<<<<
 *             listener.on_remove(host)
 *         self.control_connection.on_remove(host)
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_listeners_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
    __pyx_t_1 = __pyx_t_6; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      }
    } else {
      __pyx_t_6 = __pyx_t_7(__pyx_t_1);
      if (unlikely(!__pyx_t_6)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_6);
    }
    __Pyx_XDECREF_SET(__pyx_v_listener, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "cassandra/cluster.py":1144
 *             session.on_remove(host)
 *         for listener in self.listeners:
 *             listener.on_remove(host)             # <<<<<<<<<<<<<<
 *         self.control_connection.on_remove(host)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_listener, __pyx_n_s_on_remove); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_host); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
    } else {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); __pyx_t_8 = NULL;
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_host);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "cassandra/cluster.py":1143
 *         for session in self.sessions:
 *             session.on_remove(host)
 *         for listener in self.listeners:             # <<<<<<<<<<<<<<
 *             listener.on_remove(host)
 *         self.control_connection.on_remove(host)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1145
 *         for listener in self.listeners:
 *             listener.on_remove(host)
 *         self.control_connection.on_remove(host)             # <<<<<<<<<<<<<<
 * 
 *     def signal_connection_failure(self, host, connection_exc, is_host_addition, expect_host_to_be_down=False):
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_on_remove); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_host);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1134
 *             session.update_created_pools()
 * 
 *     def on_remove(self, host):             # <<<<<<<<<<<<<<
 *         if self.is_shutdown:
 *             return
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.on_remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_session);
  __Pyx_XDECREF(__pyx_v_listener);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1147
 *         self.control_connection.on_remove(host)
 * 
 *     def signal_connection_failure(self, host, connection_exc, is_host_addition, expect_host_to_be_down=False):             # <<<<<<<<<<<<<<
 *         is_down = host.signal_connection_failure(connection_exc)
 *         if is_down:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_57signal_connection_failure(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_57signal_connection_failure = {"signal_connection_failure", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_57signal_connection_failure, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_57signal_connection_failure(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_connection_exc = 0;
  PyObject *__pyx_v_is_host_addition = 0;
  PyObject *__pyx_v_expect_host_to_be_down = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("signal_connection_failure (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,&__pyx_n_s_connection_exc,&__pyx_n_s_is_host_addition,&__pyx_n_s_expect_host_to_be_down,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("signal_connection_failure", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_connection_exc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("signal_connection_failure", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_is_host_addition)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("signal_connection_failure", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_expect_host_to_be_down);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "signal_connection_failure") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
    __pyx_v_connection_exc = values[2];
    __pyx_v_is_host_addition = values[3];
    __pyx_v_expect_host_to_be_down = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("signal_connection_failure", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.signal_connection_failure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_56signal_connection_failure(__pyx_self, __pyx_v_self, __pyx_v_host, __pyx_v_connection_exc, __pyx_v_is_host_addition, __pyx_v_expect_host_to_be_down);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_56signal_connection_failure(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_connection_exc, PyObject *__pyx_v_is_host_addition, PyObject *__pyx_v_expect_host_to_be_down) {
  PyObject *__pyx_v_is_down = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("signal_connection_failure", 0);

  /* "cassandra/cluster.py":1148
 * 
 *     def signal_connection_failure(self, host, connection_exc, is_host_addition, expect_host_to_be_down=False):
 *         is_down = host.signal_connection_failure(connection_exc)             # <<<<<<<<<<<<<<
 *         if is_down:
 *             self.on_down(host, is_host_addition, expect_host_to_be_down)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_signal_connection_failure); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_connection_exc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_connection_exc);
    __Pyx_GIVEREF(__pyx_v_connection_exc);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_connection_exc);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_is_down = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1149
 *     def signal_connection_failure(self, host, connection_exc, is_host_addition, expect_host_to_be_down=False):
 *         is_down = host.signal_connection_failure(connection_exc)
 *         if is_down:             # <<<<<<<<<<<<<<
 *             self.on_down(host, is_host_addition, expect_host_to_be_down)
 *         return is_down
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_is_down); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":1150
 *         is_down = host.signal_connection_failure(connection_exc)
 *         if is_down:
 *             self.on_down(host, is_host_addition, expect_host_to_be_down)             # <<<<<<<<<<<<<<
 *         return is_down
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_down); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_host);
    __Pyx_INCREF(__pyx_v_is_host_addition);
    __Pyx_GIVEREF(__pyx_v_is_host_addition);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_is_host_addition);
    __Pyx_INCREF(__pyx_v_expect_host_to_be_down);
    __Pyx_GIVEREF(__pyx_v_expect_host_to_be_down);
    PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_v_expect_host_to_be_down);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":1151
 *         if is_down:
 *             self.on_down(host, is_host_addition, expect_host_to_be_down)
 *         return is_down             # <<<<<<<<<<<<<<
 * 
 *     def add_host(self, address, datacenter=None, rack=None, signal=True, refresh_nodes=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_is_down);
  __pyx_r = __pyx_v_is_down;
  goto __pyx_L0;

  /* "cassandra/cluster.py":1147
 *         self.control_connection.on_remove(host)
 * 
 *     def signal_connection_failure(self, host, connection_exc, is_host_addition, expect_host_to_be_down=False):             # <<<<<<<<<<<<<<
 *         is_down = host.signal_connection_failure(connection_exc)
 *         if is_down:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.signal_connection_failure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_is_down);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1153
 *         return is_down
 * 
 *     def add_host(self, address, datacenter=None, rack=None, signal=True, refresh_nodes=True):             # <<<<<<<<<<<<<<
 *         """
 *         Called when adding initial contact points and when the control
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_59add_host(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_58add_host[] = "\n        Called when adding initial contact points and when the control\n        connection subsequently discovers a new node.\n        Returns a Host instance, and a flag indicating whether it was new in\n        the metadata.\n        Intended for internal use only.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_59add_host = {"add_host", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_59add_host, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_58add_host};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_59add_host(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_address = 0;
  PyObject *__pyx_v_datacenter = 0;
  PyObject *__pyx_v_rack = 0;
  PyObject *__pyx_v_signal = 0;
  PyObject *__pyx_v_refresh_nodes = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_host (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_address,&__pyx_n_s_datacenter,&__pyx_n_s_rack,&__pyx_n_s_signal,&__pyx_n_s_refresh_nodes,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    values[4] = ((PyObject *)((PyObject *)Py_True));
    values[5] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_address)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_host", 0, 2, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_datacenter);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rack);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_signal);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_refresh_nodes);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_host") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_address = values[1];
    __pyx_v_datacenter = values[2];
    __pyx_v_rack = values[3];
    __pyx_v_signal = values[4];
    __pyx_v_refresh_nodes = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_host", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.add_host", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_58add_host(__pyx_self, __pyx_v_self, __pyx_v_address, __pyx_v_datacenter, __pyx_v_rack, __pyx_v_signal, __pyx_v_refresh_nodes);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_58add_host(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_address, PyObject *__pyx_v_datacenter, PyObject *__pyx_v_rack, PyObject *__pyx_v_signal, PyObject *__pyx_v_refresh_nodes) {
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_new = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_host", 0);

  /* "cassandra/cluster.py":1161
 *         Intended for internal use only.
 *         """
 *         host, new = self.metadata.add_or_return_host(Host(address, self.conviction_policy_factory, datacenter, rack))             # <<<<<<<<<<<<<<
 *         if new and signal:
 *             log.info("New Cassandra host %r discovered", host)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metadata); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_add_or_return_host); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_Host); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_conviction_policy_factory); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_8 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (__pyx_t_6) {
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_INCREF(__pyx_v_address);
  __Pyx_GIVEREF(__pyx_v_address);
  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_address);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_datacenter);
  __Pyx_GIVEREF(__pyx_v_datacenter);
  PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_datacenter);
  __Pyx_INCREF(__pyx_v_rack);
  __Pyx_GIVEREF(__pyx_v_rack);
  PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_v_rack);
  __pyx_t_5 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_8);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_2); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_2); if (unlikely(!__pyx_t_8)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_host = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_new = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "cassandra/cluster.py":1162
 *         """
 *         host, new = self.metadata.add_or_return_host(Host(address, self.conviction_policy_factory, datacenter, rack))
 *         if new and signal:             # <<<<<<<<<<<<<<
 *             log.info("New Cassandra host %r discovered", host)
 *             self.on_add(host, refresh_nodes)
 */
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_new); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_11) {
  } else {
    __pyx_t_10 = __pyx_t_11;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_signal); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = __pyx_t_11;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_10) {

    /* "cassandra/cluster.py":1163
 *         host, new = self.metadata.add_or_return_host(Host(address, self.conviction_policy_factory, datacenter, rack))
 *         if new and signal:
 *             log.info("New Cassandra host %r discovered", host)             # <<<<<<<<<<<<<<
 *             self.on_add(host, refresh_nodes)
 * 
 */
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    __pyx_t_2 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_New_Cassandra_host_r_discovered);
    __Pyx_GIVEREF(__pyx_kp_s_New_Cassandra_host_r_discovered);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_7, __pyx_kp_s_New_Cassandra_host_r_discovered);
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_7, __pyx_v_host);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1164
 *         if new and signal:
 *             log.info("New Cassandra host %r discovered", host)
 *             self.on_add(host, refresh_nodes)             # <<<<<<<<<<<<<<
 * 
 *         return host, new
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_add); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_host);
    __Pyx_INCREF(__pyx_v_refresh_nodes);
    __Pyx_GIVEREF(__pyx_v_refresh_nodes);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_refresh_nodes);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "cassandra/cluster.py":1166
 *             self.on_add(host, refresh_nodes)
 * 
 *         return host, new             # <<<<<<<<<<<<<<
 * 
 *     def remove_host(self, host):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_host);
  __Pyx_GIVEREF(__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_host);
  __Pyx_INCREF(__pyx_v_new);
  __Pyx_GIVEREF(__pyx_v_new);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_new);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":1153
 *         return is_down
 * 
 *     def add_host(self, address, datacenter=None, rack=None, signal=True, refresh_nodes=True):             # <<<<<<<<<<<<<<
 *         """
 *         Called when adding initial contact points and when the control
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.add_host", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_new);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1168
 *         return host, new
 * 
 *     def remove_host(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Called when the control connection observes that a node has left the
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_61remove_host(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_60remove_host[] = "\n        Called when the control connection observes that a node has left the\n        ring.  Intended for internal use only.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_61remove_host = {"remove_host", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_61remove_host, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_60remove_host};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_61remove_host(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove_host (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("remove_host", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "remove_host") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove_host", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.remove_host", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_60remove_host(__pyx_self, __pyx_v_self, __pyx_v_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_60remove_host(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove_host", 0);

  /* "cassandra/cluster.py":1173
 *         ring.  Intended for internal use only.
 *         """
 *         if host and self.metadata.remove_host(host):             # <<<<<<<<<<<<<<
 *             log.info("Cassandra host %s removed", host)
 *             self.on_remove(host)
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_host); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metadata); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_remove_host); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_host); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_host);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cassandra/cluster.py":1174
 *         """
 *         if host and self.metadata.remove_host(host):
 *             log.info("Cassandra host %s removed", host)             # <<<<<<<<<<<<<<
 *             self.on_remove(host)
 * 
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_info); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_7 = 1;
      }
    }
    __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Cassandra_host_s_removed);
    __Pyx_GIVEREF(__pyx_kp_s_Cassandra_host_s_removed);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_kp_s_Cassandra_host_s_removed);
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_v_host);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cassandra/cluster.py":1175
 *         if host and self.metadata.remove_host(host):
 *             log.info("Cassandra host %s removed", host)
 *             self.on_remove(host)             # <<<<<<<<<<<<<<
 * 
 *     def register_listener(self, listener):
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_remove); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_host); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_host);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":1168
 *         return host, new
 * 
 *     def remove_host(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Called when the control connection observes that a node has left the
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.remove_host", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1177
 *             self.on_remove(host)
 * 
 *     def register_listener(self, listener):             # <<<<<<<<<<<<<<
 *         """
 *         Adds a :class:`cassandra.policies.HostStateListener` subclass instance to
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_63register_listener(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_62register_listener[] = "\n        Adds a :class:`cassandra.policies.HostStateListener` subclass instance to\n        the list of listeners to be notified when a host is added, removed,\n        marked up, or marked down.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_63register_listener = {"register_listener", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_63register_listener, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_62register_listener};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_63register_listener(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_listener = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("register_listener (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_listener,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_listener)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("register_listener", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "register_listener") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_listener = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("register_listener", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.register_listener", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_62register_listener(__pyx_self, __pyx_v_self, __pyx_v_listener);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_62register_listener(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_listener) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("register_listener", 0);

  /* "cassandra/cluster.py":1183
 *         marked up, or marked down.
 *         """
 *         with self._listener_lock:             # <<<<<<<<<<<<<<
 *             self._listeners.add(listener)
 * 
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_listener_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cassandra/cluster.py":1184
 *         """
 *         with self._listener_lock:
 *             self._listeners.add(listener)             # <<<<<<<<<<<<<<
 * 
 *     def unregister_listener(self, listener):
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_listeners); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_add); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_4, function);
            }
          }
          if (!__pyx_t_3) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_listener); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_1);
          } else {
            __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
            __Pyx_INCREF(__pyx_v_listener);
            __Pyx_GIVEREF(__pyx_v_listener);
            PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_listener);
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          }
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":1183
 *         marked up, or marked down.
 *         """
 *         with self._listener_lock:             # <<<<<<<<<<<<<<
 *             self._listeners.add(listener)
 * 
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.Cluster.register_listener", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_3 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_4);
            __Pyx_XGIVEREF(__pyx_t_5);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_4, __pyx_t_5);
            __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__39, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L18;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L18:;
  }

  /* "cassandra/cluster.py":1177
 *             self.on_remove(host)
 * 
 *     def register_listener(self, listener):             # <<<<<<<<<<<<<<
 *         """
 *         Adds a :class:`cassandra.policies.HostStateListener` subclass instance to
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.register_listener", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1186
 *             self._listeners.add(listener)
 * 
 *     def unregister_listener(self, listener):             # <<<<<<<<<<<<<<
 *         """ Removes a registered listener. """
 *         with self._listener_lock:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_65unregister_listener(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_64unregister_listener[] = " Removes a registered listener. ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_65unregister_listener = {"unregister_listener", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_65unregister_listener, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_64unregister_listener};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_65unregister_listener(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_listener = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unregister_listener (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_listener,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_listener)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("unregister_listener", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unregister_listener") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_listener = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("unregister_listener", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.unregister_listener", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_64unregister_listener(__pyx_self, __pyx_v_self, __pyx_v_listener);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_64unregister_listener(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_listener) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unregister_listener", 0);

  /* "cassandra/cluster.py":1188
 *     def unregister_listener(self, listener):
 *         """ Removes a registered listener. """
 *         with self._listener_lock:             # <<<<<<<<<<<<<<
 *             self._listeners.remove(listener)
 * 
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_listener_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cassandra/cluster.py":1189
 *         """ Removes a registered listener. """
 *         with self._listener_lock:
 *             self._listeners.remove(listener)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_listeners); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_remove); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_4, function);
            }
          }
          if (!__pyx_t_3) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_listener); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_1);
          } else {
            __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
            __Pyx_INCREF(__pyx_v_listener);
            __Pyx_GIVEREF(__pyx_v_listener);
            PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_listener);
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          }
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":1188
 *     def unregister_listener(self, listener):
 *         """ Removes a registered listener. """
 *         with self._listener_lock:             # <<<<<<<<<<<<<<
 *             self._listeners.remove(listener)
 * 
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.Cluster.unregister_listener", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_3 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_4);
            __Pyx_XGIVEREF(__pyx_t_5);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_4, __pyx_t_5);
            __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__40, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L18;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L18:;
  }

  /* "cassandra/cluster.py":1186
 *             self._listeners.add(listener)
 * 
 *     def unregister_listener(self, listener):             # <<<<<<<<<<<<<<
 *         """ Removes a registered listener. """
 *         with self._listener_lock:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.unregister_listener", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1192
 * 
 *     @property
 *     def listeners(self):             # <<<<<<<<<<<<<<
 *         with self._listener_lock:
 *             return self._listeners.copy()
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_67listeners(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_67listeners = {"listeners", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_67listeners, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_67listeners(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("listeners (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_66listeners(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_66listeners(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("listeners", 0);

  /* "cassandra/cluster.py":1193
 *     @property
 *     def listeners(self):
 *         with self._listener_lock:             # <<<<<<<<<<<<<<
 *             return self._listeners.copy()
 * 
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_listener_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cassandra/cluster.py":1194
 *     def listeners(self):
 *         with self._listener_lock:
 *             return self._listeners.copy()             # <<<<<<<<<<<<<<
 * 
 *     def _ensure_core_connections(self):
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_listeners); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_4, function);
            }
          }
          if (__pyx_t_3) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else {
            __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          }
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = __pyx_t_1;
          __pyx_t_1 = 0;
          goto __pyx_L11_try_return;
        }
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":1193
 *     @property
 *     def listeners(self):
 *         with self._listener_lock:             # <<<<<<<<<<<<<<
 *             return self._listeners.copy()
 * 
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.Cluster.listeners", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_4);
            __Pyx_XGIVEREF(__pyx_t_3);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_4, __pyx_t_3);
            __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L4_return;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__41, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_8 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_2) {
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__42, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __pyx_r = __pyx_t_8;
        __pyx_t_8 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L18;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L18:;
  }

  /* "cassandra/cluster.py":1192
 * 
 *     @property
 *     def listeners(self):             # <<<<<<<<<<<<<<
 *         with self._listener_lock:
 *             return self._listeners.copy()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.listeners", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1196
 *             return self._listeners.copy()
 * 
 *     def _ensure_core_connections(self):             # <<<<<<<<<<<<<<
 *         """
 *         If any host has fewer than the configured number of core connections
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_69_ensure_core_connections(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_68_ensure_core_connections[] = "\n        If any host has fewer than the configured number of core connections\n        open, attempt to open connections until that number is met.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_69_ensure_core_connections = {"_ensure_core_connections", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_69_ensure_core_connections, METH_O, __pyx_doc_9cassandra_7cluster_7Cluster_68_ensure_core_connections};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_69_ensure_core_connections(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_ensure_core_connections (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_68_ensure_core_connections(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_68_ensure_core_connections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_session = NULL;
  PyObject *__pyx_v_pool = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_ensure_core_connections", 0);

  /* "cassandra/cluster.py":1201
 *         open, attempt to open connections until that number is met.
 *         """
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             for pool in session._pools.values():
 *                 pool.ensure_core_connections()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sessions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_session, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1202
 *         """
 *         for session in self.sessions:
 *             for pool in session._pools.values():             # <<<<<<<<<<<<<<
 *                 pool.ensure_core_connections()
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_pools); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_values); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_8(__pyx_t_6);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_v_pool, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "cassandra/cluster.py":1203
 *         for session in self.sessions:
 *             for pool in session._pools.values():
 *                 pool.ensure_core_connections()             # <<<<<<<<<<<<<<
 * 
 *     def _validate_refresh_schema(self, keyspace, table, usertype, function, aggregate):
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_ensure_core_connections_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (__pyx_t_9) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "cassandra/cluster.py":1202
 *         """
 *         for session in self.sessions:
 *             for pool in session._pools.values():             # <<<<<<<<<<<<<<
 *                 pool.ensure_core_connections()
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "cassandra/cluster.py":1201
 *         open, attempt to open connections until that number is met.
 *         """
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             for pool in session._pools.values():
 *                 pool.ensure_core_connections()
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1196
 *             return self._listeners.copy()
 * 
 *     def _ensure_core_connections(self):             # <<<<<<<<<<<<<<
 *         """
 *         If any host has fewer than the configured number of core connections
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cassandra.cluster.Cluster._ensure_core_connections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_session);
  __Pyx_XDECREF(__pyx_v_pool);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1205
 *                 pool.ensure_core_connections()
 * 
 *     def _validate_refresh_schema(self, keyspace, table, usertype, function, aggregate):             # <<<<<<<<<<<<<<
 *         if any((table, usertype, function, aggregate)):
 *             if not keyspace:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_71_validate_refresh_schema(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_71_validate_refresh_schema = {"_validate_refresh_schema", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_71_validate_refresh_schema, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_71_validate_refresh_schema(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keyspace = 0;
  PyObject *__pyx_v_table = 0;
  PyObject *__pyx_v_usertype = 0;
  PyObject *__pyx_v_function = 0;
  PyObject *__pyx_v_aggregate = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_validate_refresh_schema (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_keyspace,&__pyx_n_s_table,&__pyx_n_s_usertype,&__pyx_n_s_function,&__pyx_n_s_aggregate,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_validate_refresh_schema", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_table)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_validate_refresh_schema", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_usertype)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_validate_refresh_schema", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_function)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_validate_refresh_schema", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_aggregate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_validate_refresh_schema", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_validate_refresh_schema") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_self = values[0];
    __pyx_v_keyspace = values[1];
    __pyx_v_table = values[2];
    __pyx_v_usertype = values[3];
    __pyx_v_function = values[4];
    __pyx_v_aggregate = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_validate_refresh_schema", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster._validate_refresh_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_70_validate_refresh_schema(__pyx_self, __pyx_v_self, __pyx_v_keyspace, __pyx_v_table, __pyx_v_usertype, __pyx_v_function, __pyx_v_aggregate);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_9cassandra_7cluster_7Cluster_24_validate_refresh_schema_2generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "cassandra/cluster.py":1209
 *             if not keyspace:
 *                 raise ValueError("keyspace is required to refresh specific sub-entity {table, usertype, function, aggregate}")
 *             if sum(1 for e in (table, usertype, function) if e) > 1:             # <<<<<<<<<<<<<<
 *                 raise ValueError("{table, usertype, function, aggregate} are mutually exclusive")
 * 
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_24_validate_refresh_schema_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_3_genexpr(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_9cassandra_7cluster_7Cluster_24_validate_refresh_schema_2generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Cluster__validate_refresh_schema); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster._validate_refresh_schema.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_9cassandra_7cluster_7Cluster_24_validate_refresh_schema_2generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_table)) { __Pyx_RaiseClosureNameError("table"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_usertype)) { __Pyx_RaiseClosureNameError("usertype"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_function)) { __Pyx_RaiseClosureNameError("function"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_table);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_table);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_table);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_usertype);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_usertype);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_usertype);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_function);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_function);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_function);
  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_3 >= 3) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_e); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {
      __Pyx_INCREF(__pyx_int_1);
      __pyx_r = __pyx_int_1;
      __Pyx_XGIVEREF(__pyx_t_2);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
      __pyx_cur_scope->__pyx_t_0 = 0;
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
      if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "cassandra/cluster.py":1205
 *                 pool.ensure_core_connections()
 * 
 *     def _validate_refresh_schema(self, keyspace, table, usertype, function, aggregate):             # <<<<<<<<<<<<<<
 *         if any((table, usertype, function, aggregate)):
 *             if not keyspace:
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_70_validate_refresh_schema(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_table, PyObject *__pyx_v_usertype, PyObject *__pyx_v_function, PyObject *__pyx_v_aggregate) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_validate_refresh_schema", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_table = __pyx_v_table;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_table);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_table);
  __pyx_cur_scope->__pyx_v_usertype = __pyx_v_usertype;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_usertype);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_usertype);
  __pyx_cur_scope->__pyx_v_function = __pyx_v_function;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_function);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_function);

  /* "cassandra/cluster.py":1206
 * 
 *     def _validate_refresh_schema(self, keyspace, table, usertype, function, aggregate):
 *         if any((table, usertype, function, aggregate)):             # <<<<<<<<<<<<<<
 *             if not keyspace:
 *                 raise ValueError("keyspace is required to refresh specific sub-entity {table, usertype, function, aggregate}")
 */
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_table);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_table);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_table);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_usertype);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_usertype);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_usertype);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_function);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_function);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_cur_scope->__pyx_v_function);
  __Pyx_INCREF(__pyx_v_aggregate);
  __Pyx_GIVEREF(__pyx_v_aggregate);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_aggregate);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_any, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":1207
 *     def _validate_refresh_schema(self, keyspace, table, usertype, function, aggregate):
 *         if any((table, usertype, function, aggregate)):
 *             if not keyspace:             # <<<<<<<<<<<<<<
 *                 raise ValueError("keyspace is required to refresh specific sub-entity {table, usertype, function, aggregate}")
 *             if sum(1 for e in (table, usertype, function) if e) > 1:
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_keyspace); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = ((!__pyx_t_3) != 0);
    if (__pyx_t_4) {

      /* "cassandra/cluster.py":1208
 *         if any((table, usertype, function, aggregate)):
 *             if not keyspace:
 *                 raise ValueError("keyspace is required to refresh specific sub-entity {table, usertype, function, aggregate}")             # <<<<<<<<<<<<<<
 *             if sum(1 for e in (table, usertype, function) if e) > 1:
 *                 raise ValueError("{table, usertype, function, aggregate} are mutually exclusive")
 */
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cassandra/cluster.py":1209
 *             if not keyspace:
 *                 raise ValueError("keyspace is required to refresh specific sub-entity {table, usertype, function, aggregate}")
 *             if sum(1 for e in (table, usertype, function) if e) > 1:             # <<<<<<<<<<<<<<
 *                 raise ValueError("{table, usertype, function, aggregate} are mutually exclusive")
 * 
 */
    __pyx_t_1 = __pyx_pf_9cassandra_7cluster_7Cluster_24_validate_refresh_schema_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_sum, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_4) {

      /* "cassandra/cluster.py":1210
 *                 raise ValueError("keyspace is required to refresh specific sub-entity {table, usertype, function, aggregate}")
 *             if sum(1 for e in (table, usertype, function) if e) > 1:
 *                 raise ValueError("{table, usertype, function, aggregate} are mutually exclusive")             # <<<<<<<<<<<<<<
 * 
 *     def refresh_schema(self, keyspace=None, table=None, usertype=None, function=None, aggregate=None, max_schema_agreement_wait=None):
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":1205
 *                 pool.ensure_core_connections()
 * 
 *     def _validate_refresh_schema(self, keyspace, table, usertype, function, aggregate):             # <<<<<<<<<<<<<<
 *         if any((table, usertype, function, aggregate)):
 *             if not keyspace:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster.Cluster._validate_refresh_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1212
 *                 raise ValueError("{table, usertype, function, aggregate} are mutually exclusive")
 * 
 *     def refresh_schema(self, keyspace=None, table=None, usertype=None, function=None, aggregate=None, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         .. deprecated:: 2.6.0
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_73refresh_schema(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_72refresh_schema[] = "\n        .. deprecated:: 2.6.0\n            Use refresh_*_metadata instead\n\n        Synchronously refresh schema metadata.\n\n        {keyspace, table, usertype} are string names of the respective entities.\n        ``function`` is a :class:`cassandra.UserFunctionDescriptor`.\n        ``aggregate`` is a :class:`cassandra.UserAggregateDescriptor`.\n\n        If none of ``{keyspace, table, usertype, function, aggregate}`` are specified, the entire schema is refreshed.\n\n        If any of ``{keyspace, table, usertype, function, aggregate}`` are specified, ``keyspace`` is required.\n\n        If only ``keyspace`` is specified, just the top-level keyspace metadata is refreshed (e.g. replication).\n\n        The remaining arguments ``{table, usertype, function, aggregate}``\n        are mutually exclusive -- only one may be specified.\n\n        By default, the timeout for this operation is governed by :attr:`~.Cluster.max_schema_agreement_wait`\n        and :attr:`~.Cluster.control_connection_timeout`.\n\n        Passing max_schema_agreement_wait here overrides :attr:`~.Cluster.max_schema_agreement_wait`.\n\n        Setting max_schema_agreement_wait <= 0 will bypass schema agreement and refresh schema immediately.\n\n        An Exception is raised if schema refresh fails for any reason.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_73refresh_schema = {"refresh_schema", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_73refresh_schema, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_72refresh_schema};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_73refresh_schema(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keyspace = 0;
  PyObject *__pyx_v_table = 0;
  PyObject *__pyx_v_usertype = 0;
  PyObject *__pyx_v_function = 0;
  PyObject *__pyx_v_aggregate = 0;
  PyObject *__pyx_v_max_schema_agreement_wait = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refresh_schema (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_keyspace,&__pyx_n_s_table,&__pyx_n_s_usertype,&__pyx_n_s_function,&__pyx_n_s_aggregate,&__pyx_n_s_max_schema_agreement_wait,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    values[4] = ((PyObject *)((PyObject *)Py_None));
    values[5] = ((PyObject *)((PyObject *)Py_None));
    values[6] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_table);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_usertype);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_function);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_aggregate);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_schema_agreement_wait);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "refresh_schema") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_keyspace = values[1];
    __pyx_v_table = values[2];
    __pyx_v_usertype = values[3];
    __pyx_v_function = values[4];
    __pyx_v_aggregate = values[5];
    __pyx_v_max_schema_agreement_wait = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("refresh_schema", 0, 1, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_72refresh_schema(__pyx_self, __pyx_v_self, __pyx_v_keyspace, __pyx_v_table, __pyx_v_usertype, __pyx_v_function, __pyx_v_aggregate, __pyx_v_max_schema_agreement_wait);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_72refresh_schema(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_table, PyObject *__pyx_v_usertype, PyObject *__pyx_v_function, PyObject *__pyx_v_aggregate, PyObject *__pyx_v_max_schema_agreement_wait) {
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("refresh_schema", 0);

  /* "cassandra/cluster.py":1241
 *         An Exception is raised if schema refresh fails for any reason.
 *         """
 *         msg = "refresh_schema is deprecated. Use Cluster.refresh_*_metadata instead."             # <<<<<<<<<<<<<<
 *         warnings.warn(msg, DeprecationWarning)
 *         log.warning(msg)
 */
  __Pyx_INCREF(__pyx_kp_s_refresh_schema_is_deprecated_Use);
  __pyx_v_msg = __pyx_kp_s_refresh_schema_is_deprecated_Use;

  /* "cassandra/cluster.py":1242
 *         """
 *         msg = "refresh_schema is deprecated. Use Cluster.refresh_*_metadata instead."
 *         warnings.warn(msg, DeprecationWarning)             # <<<<<<<<<<<<<<
 *         log.warning(msg)
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_warnings); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_warn); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_2) {
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_INCREF(__pyx_v_msg);
  __Pyx_GIVEREF(__pyx_v_msg);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_msg);
  __Pyx_INCREF(__pyx_builtin_DeprecationWarning);
  __Pyx_GIVEREF(__pyx_builtin_DeprecationWarning);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_builtin_DeprecationWarning);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1243
 *         msg = "refresh_schema is deprecated. Use Cluster.refresh_*_metadata instead."
 *         warnings.warn(msg, DeprecationWarning)
 *         log.warning(msg)             # <<<<<<<<<<<<<<
 * 
 *         self._validate_refresh_schema(keyspace, table, usertype, function, aggregate)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warning); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_msg);
    __Pyx_GIVEREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_msg);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1245
 *         log.warning(msg)
 * 
 *         self._validate_refresh_schema(keyspace, table, usertype, function, aggregate)             # <<<<<<<<<<<<<<
 *         if not self.control_connection.refresh_schema(keyspace, table, usertype, function,
 *                                                       aggregate, max_schema_agreement_wait):
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_validate_refresh_schema); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_3 = PyTuple_New(5+__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_2) {
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_INCREF(__pyx_v_keyspace);
  __Pyx_GIVEREF(__pyx_v_keyspace);
  PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_v_keyspace);
  __Pyx_INCREF(__pyx_v_table);
  __Pyx_GIVEREF(__pyx_v_table);
  PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_v_table);
  __Pyx_INCREF(__pyx_v_usertype);
  __Pyx_GIVEREF(__pyx_v_usertype);
  PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_4, __pyx_v_usertype);
  __Pyx_INCREF(__pyx_v_function);
  __Pyx_GIVEREF(__pyx_v_function);
  PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_4, __pyx_v_function);
  __Pyx_INCREF(__pyx_v_aggregate);
  __Pyx_GIVEREF(__pyx_v_aggregate);
  PyTuple_SET_ITEM(__pyx_t_3, 4+__pyx_t_4, __pyx_v_aggregate);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1246
 * 
 *         self._validate_refresh_schema(keyspace, table, usertype, function, aggregate)
 *         if not self.control_connection.refresh_schema(keyspace, table, usertype, function,             # <<<<<<<<<<<<<<
 *                                                       aggregate, max_schema_agreement_wait):
 *             raise Exception("Schema was not refreshed. See log for details.")
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_refresh_schema); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cassandra/cluster.py":1247
 *         self._validate_refresh_schema(keyspace, table, usertype, function, aggregate)
 *         if not self.control_connection.refresh_schema(keyspace, table, usertype, function,
 *                                                       aggregate, max_schema_agreement_wait):             # <<<<<<<<<<<<<<
 *             raise Exception("Schema was not refreshed. See log for details.")
 * 
 */
  __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_2 = PyTuple_New(6+__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_v_keyspace);
  __Pyx_GIVEREF(__pyx_v_keyspace);
  PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, __pyx_v_keyspace);
  __Pyx_INCREF(__pyx_v_table);
  __Pyx_GIVEREF(__pyx_v_table);
  PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, __pyx_v_table);
  __Pyx_INCREF(__pyx_v_usertype);
  __Pyx_GIVEREF(__pyx_v_usertype);
  PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_4, __pyx_v_usertype);
  __Pyx_INCREF(__pyx_v_function);
  __Pyx_GIVEREF(__pyx_v_function);
  PyTuple_SET_ITEM(__pyx_t_2, 3+__pyx_t_4, __pyx_v_function);
  __Pyx_INCREF(__pyx_v_aggregate);
  __Pyx_GIVEREF(__pyx_v_aggregate);
  PyTuple_SET_ITEM(__pyx_t_2, 4+__pyx_t_4, __pyx_v_aggregate);
  __Pyx_INCREF(__pyx_v_max_schema_agreement_wait);
  __Pyx_GIVEREF(__pyx_v_max_schema_agreement_wait);
  PyTuple_SET_ITEM(__pyx_t_2, 5+__pyx_t_4, __pyx_v_max_schema_agreement_wait);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":1246
 * 
 *         self._validate_refresh_schema(keyspace, table, usertype, function, aggregate)
 *         if not self.control_connection.refresh_schema(keyspace, table, usertype, function,             # <<<<<<<<<<<<<<
 *                                                       aggregate, max_schema_agreement_wait):
 *             raise Exception("Schema was not refreshed. See log for details.")
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = ((!__pyx_t_6) != 0);
  if (__pyx_t_7) {

    /* "cassandra/cluster.py":1248
 *         if not self.control_connection.refresh_schema(keyspace, table, usertype, function,
 *                                                       aggregate, max_schema_agreement_wait):
 *             raise Exception("Schema was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def submit_schema_refresh(self, keyspace=None, table=None, usertype=None, function=None, aggregate=None):
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":1212
 *                 raise ValueError("{table, usertype, function, aggregate} are mutually exclusive")
 * 
 *     def refresh_schema(self, keyspace=None, table=None, usertype=None, function=None, aggregate=None, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         .. deprecated:: 2.6.0
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1250
 *             raise Exception("Schema was not refreshed. See log for details.")
 * 
 *     def submit_schema_refresh(self, keyspace=None, table=None, usertype=None, function=None, aggregate=None):             # <<<<<<<<<<<<<<
 *         """
 *         .. deprecated:: 2.6.0
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_75submit_schema_refresh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_74submit_schema_refresh[] = "\n        .. deprecated:: 2.6.0\n            Use refresh_*_metadata instead\n\n        Schedule a refresh of the internal representation of the current\n        schema for this cluster.  See :meth:`~.refresh_schema` for description of parameters.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_75submit_schema_refresh = {"submit_schema_refresh", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_75submit_schema_refresh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_74submit_schema_refresh};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_75submit_schema_refresh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keyspace = 0;
  PyObject *__pyx_v_table = 0;
  PyObject *__pyx_v_usertype = 0;
  PyObject *__pyx_v_function = 0;
  PyObject *__pyx_v_aggregate = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("submit_schema_refresh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_keyspace,&__pyx_n_s_table,&__pyx_n_s_usertype,&__pyx_n_s_function,&__pyx_n_s_aggregate,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    values[4] = ((PyObject *)((PyObject *)Py_None));
    values[5] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_table);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_usertype);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_function);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_aggregate);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "submit_schema_refresh") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_keyspace = values[1];
    __pyx_v_table = values[2];
    __pyx_v_usertype = values[3];
    __pyx_v_function = values[4];
    __pyx_v_aggregate = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("submit_schema_refresh", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.submit_schema_refresh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_74submit_schema_refresh(__pyx_self, __pyx_v_self, __pyx_v_keyspace, __pyx_v_table, __pyx_v_usertype, __pyx_v_function, __pyx_v_aggregate);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_74submit_schema_refresh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_table, PyObject *__pyx_v_usertype, PyObject *__pyx_v_function, PyObject *__pyx_v_aggregate) {
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("submit_schema_refresh", 0);

  /* "cassandra/cluster.py":1258
 *         schema for this cluster.  See :meth:`~.refresh_schema` for description of parameters.
 *         """
 *         msg = "submit_schema_refresh is deprecated. Use Cluster.refresh_*_metadata instead."             # <<<<<<<<<<<<<<
 *         warnings.warn(msg, DeprecationWarning)
 *         log.warning(msg)
 */
  __Pyx_INCREF(__pyx_kp_s_submit_schema_refresh_is_depreca);
  __pyx_v_msg = __pyx_kp_s_submit_schema_refresh_is_depreca;

  /* "cassandra/cluster.py":1259
 *         """
 *         msg = "submit_schema_refresh is deprecated. Use Cluster.refresh_*_metadata instead."
 *         warnings.warn(msg, DeprecationWarning)             # <<<<<<<<<<<<<<
 *         log.warning(msg)
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_warnings); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_warn); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_2) {
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_INCREF(__pyx_v_msg);
  __Pyx_GIVEREF(__pyx_v_msg);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_msg);
  __Pyx_INCREF(__pyx_builtin_DeprecationWarning);
  __Pyx_GIVEREF(__pyx_builtin_DeprecationWarning);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_builtin_DeprecationWarning);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1260
 *         msg = "submit_schema_refresh is deprecated. Use Cluster.refresh_*_metadata instead."
 *         warnings.warn(msg, DeprecationWarning)
 *         log.warning(msg)             # <<<<<<<<<<<<<<
 * 
 *         self._validate_refresh_schema(keyspace, table, usertype, function, aggregate)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warning); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_msg);
    __Pyx_GIVEREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_msg);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1262
 *         log.warning(msg)
 * 
 *         self._validate_refresh_schema(keyspace, table, usertype, function, aggregate)             # <<<<<<<<<<<<<<
 *         return self.executor.submit(
 *             self.control_connection.refresh_schema, keyspace, table, usertype, function, aggregate)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_validate_refresh_schema); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_3 = PyTuple_New(5+__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_2) {
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_INCREF(__pyx_v_keyspace);
  __Pyx_GIVEREF(__pyx_v_keyspace);
  PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_v_keyspace);
  __Pyx_INCREF(__pyx_v_table);
  __Pyx_GIVEREF(__pyx_v_table);
  PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_v_table);
  __Pyx_INCREF(__pyx_v_usertype);
  __Pyx_GIVEREF(__pyx_v_usertype);
  PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_4, __pyx_v_usertype);
  __Pyx_INCREF(__pyx_v_function);
  __Pyx_GIVEREF(__pyx_v_function);
  PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_4, __pyx_v_function);
  __Pyx_INCREF(__pyx_v_aggregate);
  __Pyx_GIVEREF(__pyx_v_aggregate);
  PyTuple_SET_ITEM(__pyx_t_3, 4+__pyx_t_4, __pyx_v_aggregate);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1263
 * 
 *         self._validate_refresh_schema(keyspace, table, usertype, function, aggregate)
 *         return self.executor.submit(             # <<<<<<<<<<<<<<
 *             self.control_connection.refresh_schema, keyspace, table, usertype, function, aggregate)
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_executor); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_submit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cassandra/cluster.py":1264
 *         self._validate_refresh_schema(keyspace, table, usertype, function, aggregate)
 *         return self.executor.submit(
 *             self.control_connection.refresh_schema, keyspace, table, usertype, function, aggregate)             # <<<<<<<<<<<<<<
 * 
 *     def refresh_schema_metadata(self, max_schema_agreement_wait=None):
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_refresh_schema); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(6+__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_4, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_keyspace);
  __Pyx_GIVEREF(__pyx_v_keyspace);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_4, __pyx_v_keyspace);
  __Pyx_INCREF(__pyx_v_table);
  __Pyx_GIVEREF(__pyx_v_table);
  PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_4, __pyx_v_table);
  __Pyx_INCREF(__pyx_v_usertype);
  __Pyx_GIVEREF(__pyx_v_usertype);
  PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_4, __pyx_v_usertype);
  __Pyx_INCREF(__pyx_v_function);
  __Pyx_GIVEREF(__pyx_v_function);
  PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_4, __pyx_v_function);
  __Pyx_INCREF(__pyx_v_aggregate);
  __Pyx_GIVEREF(__pyx_v_aggregate);
  PyTuple_SET_ITEM(__pyx_t_6, 5+__pyx_t_4, __pyx_v_aggregate);
  __pyx_t_2 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":1250
 *             raise Exception("Schema was not refreshed. See log for details.")
 * 
 *     def submit_schema_refresh(self, keyspace=None, table=None, usertype=None, function=None, aggregate=None):             # <<<<<<<<<<<<<<
 *         """
 *         .. deprecated:: 2.6.0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.submit_schema_refresh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1266
 *             self.control_connection.refresh_schema, keyspace, table, usertype, function, aggregate)
 * 
 *     def refresh_schema_metadata(self, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh all schema metadata.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_77refresh_schema_metadata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_76refresh_schema_metadata[] = "\n        Synchronously refresh all schema metadata.\n\n        By default, the timeout for this operation is governed by :attr:`~.Cluster.max_schema_agreement_wait`\n        and :attr:`~.Cluster.control_connection_timeout`.\n\n        Passing max_schema_agreement_wait here overrides :attr:`~.Cluster.max_schema_agreement_wait`.\n\n        Setting max_schema_agreement_wait <= 0 will bypass schema agreement and refresh schema immediately.\n\n        An Exception is raised if schema refresh fails for any reason.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_77refresh_schema_metadata = {"refresh_schema_metadata", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_77refresh_schema_metadata, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_76refresh_schema_metadata};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_77refresh_schema_metadata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_max_schema_agreement_wait = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refresh_schema_metadata (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_max_schema_agreement_wait,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_schema_agreement_wait);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "refresh_schema_metadata") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_max_schema_agreement_wait = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("refresh_schema_metadata", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_schema_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_76refresh_schema_metadata(__pyx_self, __pyx_v_self, __pyx_v_max_schema_agreement_wait);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_76refresh_schema_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_max_schema_agreement_wait) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("refresh_schema_metadata", 0);

  /* "cassandra/cluster.py":1279
 *         An Exception is raised if schema refresh fails for any reason.
 *         """
 *         if not self.control_connection.refresh_schema(schema_agreement_wait=max_schema_agreement_wait):             # <<<<<<<<<<<<<<
 *             raise Exception("Schema metadata was not refreshed. See log for details.")
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_refresh_schema); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_schema_agreement_wait, __pyx_v_max_schema_agreement_wait) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":1280
 *         """
 *         if not self.control_connection.refresh_schema(schema_agreement_wait=max_schema_agreement_wait):
 *             raise Exception("Schema metadata was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def refresh_keyspace_metadata(self, keyspace, max_schema_agreement_wait=None):
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":1266
 *             self.control_connection.refresh_schema, keyspace, table, usertype, function, aggregate)
 * 
 *     def refresh_schema_metadata(self, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh all schema metadata.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_schema_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1282
 *             raise Exception("Schema metadata was not refreshed. See log for details.")
 * 
 *     def refresh_keyspace_metadata(self, keyspace, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh keyspace metadata. This applies to keyspace-level information such as replication
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_79refresh_keyspace_metadata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_78refresh_keyspace_metadata[] = "\n        Synchronously refresh keyspace metadata. This applies to keyspace-level information such as replication\n        and durability settings. It does not refresh tables, types, etc. contained in the keyspace.\n\n        See :meth:`~.Cluster.refresh_schema_metadata` for description of ``max_schema_agreement_wait`` behavior\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_79refresh_keyspace_metadata = {"refresh_keyspace_metadata", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_79refresh_keyspace_metadata, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_78refresh_keyspace_metadata};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_79refresh_keyspace_metadata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keyspace = 0;
  PyObject *__pyx_v_max_schema_agreement_wait = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refresh_keyspace_metadata (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_keyspace,&__pyx_n_s_max_schema_agreement_wait,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_keyspace_metadata", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_schema_agreement_wait);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "refresh_keyspace_metadata") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_keyspace = values[1];
    __pyx_v_max_schema_agreement_wait = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("refresh_keyspace_metadata", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_keyspace_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_78refresh_keyspace_metadata(__pyx_self, __pyx_v_self, __pyx_v_keyspace, __pyx_v_max_schema_agreement_wait);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_78refresh_keyspace_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_max_schema_agreement_wait) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("refresh_keyspace_metadata", 0);

  /* "cassandra/cluster.py":1289
 *         See :meth:`~.Cluster.refresh_schema_metadata` for description of ``max_schema_agreement_wait`` behavior
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, schema_agreement_wait=max_schema_agreement_wait):             # <<<<<<<<<<<<<<
 *             raise Exception("Keyspace metadata was not refreshed. See log for details.")
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_refresh_schema); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_keyspace);
  __Pyx_GIVEREF(__pyx_v_keyspace);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_keyspace);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_schema_agreement_wait, __pyx_v_max_schema_agreement_wait) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":1290
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, schema_agreement_wait=max_schema_agreement_wait):
 *             raise Exception("Keyspace metadata was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def refresh_table_metadata(self, keyspace, table, max_schema_agreement_wait=None):
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":1282
 *             raise Exception("Schema metadata was not refreshed. See log for details.")
 * 
 *     def refresh_keyspace_metadata(self, keyspace, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh keyspace metadata. This applies to keyspace-level information such as replication
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_keyspace_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1292
 *             raise Exception("Keyspace metadata was not refreshed. See log for details.")
 * 
 *     def refresh_table_metadata(self, keyspace, table, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh table metadata. This applies to a table, and any triggers or indexes attached
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_81refresh_table_metadata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_80refresh_table_metadata[] = "\n        Synchronously refresh table metadata. This applies to a table, and any triggers or indexes attached\n        to the table.\n\n        See :meth:`~.Cluster.refresh_schema_metadata` for description of ``max_schema_agreement_wait`` behavior\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_81refresh_table_metadata = {"refresh_table_metadata", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_81refresh_table_metadata, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_80refresh_table_metadata};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_81refresh_table_metadata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keyspace = 0;
  PyObject *__pyx_v_table = 0;
  PyObject *__pyx_v_max_schema_agreement_wait = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refresh_table_metadata (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_keyspace,&__pyx_n_s_table,&__pyx_n_s_max_schema_agreement_wait,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_table_metadata", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_table)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_table_metadata", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_schema_agreement_wait);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "refresh_table_metadata") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_keyspace = values[1];
    __pyx_v_table = values[2];
    __pyx_v_max_schema_agreement_wait = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("refresh_table_metadata", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_table_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_80refresh_table_metadata(__pyx_self, __pyx_v_self, __pyx_v_keyspace, __pyx_v_table, __pyx_v_max_schema_agreement_wait);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_80refresh_table_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_table, PyObject *__pyx_v_max_schema_agreement_wait) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("refresh_table_metadata", 0);

  /* "cassandra/cluster.py":1299
 *         See :meth:`~.Cluster.refresh_schema_metadata` for description of ``max_schema_agreement_wait`` behavior
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, table, schema_agreement_wait=max_schema_agreement_wait):             # <<<<<<<<<<<<<<
 *             raise Exception("Table metadata was not refreshed. See log for details.")
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_refresh_schema); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_keyspace);
  __Pyx_GIVEREF(__pyx_v_keyspace);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_keyspace);
  __Pyx_INCREF(__pyx_v_table);
  __Pyx_GIVEREF(__pyx_v_table);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_table);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_schema_agreement_wait, __pyx_v_max_schema_agreement_wait) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":1300
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, table, schema_agreement_wait=max_schema_agreement_wait):
 *             raise Exception("Table metadata was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def refresh_user_type_metadata(self, keyspace, user_type, max_schema_agreement_wait=None):
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":1292
 *             raise Exception("Keyspace metadata was not refreshed. See log for details.")
 * 
 *     def refresh_table_metadata(self, keyspace, table, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh table metadata. This applies to a table, and any triggers or indexes attached
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_table_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1302
 *             raise Exception("Table metadata was not refreshed. See log for details.")
 * 
 *     def refresh_user_type_metadata(self, keyspace, user_type, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh user defined type metadata.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_83refresh_user_type_metadata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_82refresh_user_type_metadata[] = "\n        Synchronously refresh user defined type metadata.\n\n        See :meth:`~.Cluster.refresh_schema_metadata` for description of ``max_schema_agreement_wait`` behavior\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_83refresh_user_type_metadata = {"refresh_user_type_metadata", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_83refresh_user_type_metadata, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_82refresh_user_type_metadata};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_83refresh_user_type_metadata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keyspace = 0;
  PyObject *__pyx_v_user_type = 0;
  PyObject *__pyx_v_max_schema_agreement_wait = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refresh_user_type_metadata (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_keyspace,&__pyx_n_s_user_type,&__pyx_n_s_max_schema_agreement_wait,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_user_type_metadata", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_user_type)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_user_type_metadata", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_schema_agreement_wait);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "refresh_user_type_metadata") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_keyspace = values[1];
    __pyx_v_user_type = values[2];
    __pyx_v_max_schema_agreement_wait = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("refresh_user_type_metadata", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_user_type_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_82refresh_user_type_metadata(__pyx_self, __pyx_v_self, __pyx_v_keyspace, __pyx_v_user_type, __pyx_v_max_schema_agreement_wait);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_82refresh_user_type_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_user_type, PyObject *__pyx_v_max_schema_agreement_wait) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("refresh_user_type_metadata", 0);

  /* "cassandra/cluster.py":1308
 *         See :meth:`~.Cluster.refresh_schema_metadata` for description of ``max_schema_agreement_wait`` behavior
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, usertype=user_type, schema_agreement_wait=max_schema_agreement_wait):             # <<<<<<<<<<<<<<
 *             raise Exception("User Type metadata was not refreshed. See log for details.")
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_refresh_schema); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_keyspace);
  __Pyx_GIVEREF(__pyx_v_keyspace);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_keyspace);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_usertype, __pyx_v_user_type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_schema_agreement_wait, __pyx_v_max_schema_agreement_wait) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":1309
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, usertype=user_type, schema_agreement_wait=max_schema_agreement_wait):
 *             raise Exception("User Type metadata was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def refresh_user_function_metadata(self, keyspace, function, max_schema_agreement_wait=None):
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":1302
 *             raise Exception("Table metadata was not refreshed. See log for details.")
 * 
 *     def refresh_user_type_metadata(self, keyspace, user_type, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh user defined type metadata.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_user_type_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1311
 *             raise Exception("User Type metadata was not refreshed. See log for details.")
 * 
 *     def refresh_user_function_metadata(self, keyspace, function, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh user defined function metadata.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_85refresh_user_function_metadata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_84refresh_user_function_metadata[] = "\n        Synchronously refresh user defined function metadata.\n\n        ``function`` is a :class:`cassandra.UserFunctionDescriptor`.\n\n        See :meth:`~.Cluster.refresh_schema_metadata` for description of ``max_schema_agreement_wait`` behavior\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_85refresh_user_function_metadata = {"refresh_user_function_metadata", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_85refresh_user_function_metadata, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_84refresh_user_function_metadata};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_85refresh_user_function_metadata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keyspace = 0;
  PyObject *__pyx_v_function = 0;
  PyObject *__pyx_v_max_schema_agreement_wait = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refresh_user_function_metadata (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_keyspace,&__pyx_n_s_function,&__pyx_n_s_max_schema_agreement_wait,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_user_function_metadata", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_function)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_user_function_metadata", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_schema_agreement_wait);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "refresh_user_function_metadata") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_keyspace = values[1];
    __pyx_v_function = values[2];
    __pyx_v_max_schema_agreement_wait = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("refresh_user_function_metadata", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_user_function_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_84refresh_user_function_metadata(__pyx_self, __pyx_v_self, __pyx_v_keyspace, __pyx_v_function, __pyx_v_max_schema_agreement_wait);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_84refresh_user_function_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_function, PyObject *__pyx_v_max_schema_agreement_wait) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("refresh_user_function_metadata", 0);

  /* "cassandra/cluster.py":1319
 *         See :meth:`~.Cluster.refresh_schema_metadata` for description of ``max_schema_agreement_wait`` behavior
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, function=function, schema_agreement_wait=max_schema_agreement_wait):             # <<<<<<<<<<<<<<
 *             raise Exception("User Function metadata was not refreshed. See log for details.")
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_refresh_schema); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_keyspace);
  __Pyx_GIVEREF(__pyx_v_keyspace);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_keyspace);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_function, __pyx_v_function) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_schema_agreement_wait, __pyx_v_max_schema_agreement_wait) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":1320
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, function=function, schema_agreement_wait=max_schema_agreement_wait):
 *             raise Exception("User Function metadata was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def refresh_user_aggregate_metadata(self, keyspace, aggregate, max_schema_agreement_wait=None):
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":1311
 *             raise Exception("User Type metadata was not refreshed. See log for details.")
 * 
 *     def refresh_user_function_metadata(self, keyspace, function, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh user defined function metadata.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_user_function_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1322
 *             raise Exception("User Function metadata was not refreshed. See log for details.")
 * 
 *     def refresh_user_aggregate_metadata(self, keyspace, aggregate, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh user defined aggregate metadata.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_87refresh_user_aggregate_metadata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_86refresh_user_aggregate_metadata[] = "\n        Synchronously refresh user defined aggregate metadata.\n\n        ``aggregate`` is a :class:`cassandra.UserAggregateDescriptor`.\n\n        See :meth:`~.Cluster.refresh_schema_metadata` for description of ``max_schema_agreement_wait`` behavior\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_87refresh_user_aggregate_metadata = {"refresh_user_aggregate_metadata", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_87refresh_user_aggregate_metadata, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_86refresh_user_aggregate_metadata};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_87refresh_user_aggregate_metadata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keyspace = 0;
  PyObject *__pyx_v_aggregate = 0;
  PyObject *__pyx_v_max_schema_agreement_wait = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refresh_user_aggregate_metadata (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_keyspace,&__pyx_n_s_aggregate,&__pyx_n_s_max_schema_agreement_wait,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_user_aggregate_metadata", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_aggregate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_user_aggregate_metadata", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_schema_agreement_wait);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "refresh_user_aggregate_metadata") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_keyspace = values[1];
    __pyx_v_aggregate = values[2];
    __pyx_v_max_schema_agreement_wait = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("refresh_user_aggregate_metadata", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_user_aggregate_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_86refresh_user_aggregate_metadata(__pyx_self, __pyx_v_self, __pyx_v_keyspace, __pyx_v_aggregate, __pyx_v_max_schema_agreement_wait);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_86refresh_user_aggregate_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_aggregate, PyObject *__pyx_v_max_schema_agreement_wait) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("refresh_user_aggregate_metadata", 0);

  /* "cassandra/cluster.py":1330
 *         See :meth:`~.Cluster.refresh_schema_metadata` for description of ``max_schema_agreement_wait`` behavior
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, aggregate=aggregate, schema_agreement_wait=max_schema_agreement_wait):             # <<<<<<<<<<<<<<
 *             raise Exception("User Aggregate metadata was not refreshed. See log for details.")
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_refresh_schema); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_keyspace);
  __Pyx_GIVEREF(__pyx_v_keyspace);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_keyspace);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_aggregate, __pyx_v_aggregate) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_schema_agreement_wait, __pyx_v_max_schema_agreement_wait) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":1331
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, aggregate=aggregate, schema_agreement_wait=max_schema_agreement_wait):
 *             raise Exception("User Aggregate metadata was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def refresh_nodes(self):
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":1322
 *             raise Exception("User Function metadata was not refreshed. See log for details.")
 * 
 *     def refresh_user_aggregate_metadata(self, keyspace, aggregate, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh user defined aggregate metadata.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_user_aggregate_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1333
 *             raise Exception("User Aggregate metadata was not refreshed. See log for details.")
 * 
 *     def refresh_nodes(self):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh the node list and token metadata
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_89refresh_nodes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_88refresh_nodes[] = "\n        Synchronously refresh the node list and token metadata\n\n        An Exception is raised if node refresh fails for any reason.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_89refresh_nodes = {"refresh_nodes", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_89refresh_nodes, METH_O, __pyx_doc_9cassandra_7cluster_7Cluster_88refresh_nodes};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_89refresh_nodes(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refresh_nodes (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_88refresh_nodes(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_88refresh_nodes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("refresh_nodes", 0);

  /* "cassandra/cluster.py":1339
 *         An Exception is raised if node refresh fails for any reason.
 *         """
 *         if not self.control_connection.refresh_node_list_and_token_map():             # <<<<<<<<<<<<<<
 *             raise Exception("Node list was not refreshed. See log for details.")
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_refresh_node_list_and_token_map); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":1340
 *         """
 *         if not self.control_connection.refresh_node_list_and_token_map():
 *             raise Exception("Node list was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def set_meta_refresh_enabled(self, enabled):
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":1333
 *             raise Exception("User Aggregate metadata was not refreshed. See log for details.")
 * 
 *     def refresh_nodes(self):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh the node list and token metadata
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.refresh_nodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1342
 *             raise Exception("Node list was not refreshed. See log for details.")
 * 
 *     def set_meta_refresh_enabled(self, enabled):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a flag to enable (True) or disable (False) all metadata refresh queries.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_91set_meta_refresh_enabled(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Cluster_90set_meta_refresh_enabled[] = "\n        Sets a flag to enable (True) or disable (False) all metadata refresh queries.\n        This applies to both schema and node topology.\n\n        Disabling this is useful to minimize refreshes during multiple changes.\n\n        Meta refresh must be enabled for the driver to become aware of any cluster\n        topology changes or schema updates.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_91set_meta_refresh_enabled = {"set_meta_refresh_enabled", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_91set_meta_refresh_enabled, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Cluster_90set_meta_refresh_enabled};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_91set_meta_refresh_enabled(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_enabled = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_meta_refresh_enabled (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_enabled,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_enabled)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_meta_refresh_enabled", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_meta_refresh_enabled") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_enabled = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_meta_refresh_enabled", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.set_meta_refresh_enabled", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_90set_meta_refresh_enabled(__pyx_self, __pyx_v_self, __pyx_v_enabled);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_90set_meta_refresh_enabled(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_enabled) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_meta_refresh_enabled", 0);

  /* "cassandra/cluster.py":1352
 *         topology changes or schema updates.
 *         """
 *         self.control_connection.set_meta_refresh_enabled(bool(enabled))             # <<<<<<<<<<<<<<
 * 
 *     def _prepare_all_queries(self, host):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_set_meta_refresh_enabled); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_enabled); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyBool_FromLong((!(!__pyx_t_4))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1342
 *             raise Exception("Node list was not refreshed. See log for details.")
 * 
 *     def set_meta_refresh_enabled(self, enabled):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a flag to enable (True) or disable (False) all metadata refresh queries.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.set_meta_refresh_enabled", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1354
 *         self.control_connection.set_meta_refresh_enabled(bool(enabled))
 * 
 *     def _prepare_all_queries(self, host):             # <<<<<<<<<<<<<<
 *         if not self._prepared_statements:
 *             return
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_93_prepare_all_queries(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_93_prepare_all_queries = {"_prepare_all_queries", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_93_prepare_all_queries, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_93_prepare_all_queries(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_prepare_all_queries (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_prepare_all_queries", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_prepare_all_queries") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_prepare_all_queries", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster._prepare_all_queries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_92_prepare_all_queries(__pyx_self, __pyx_v_self, __pyx_v_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1368
 * 
 *             statements = self._prepared_statements.values()
 *             for keyspace, ks_statements in groupby(statements, lambda s: s.keyspace):             # <<<<<<<<<<<<<<
 *                 if keyspace is not None:
 *                     connection.set_keyspace_blocking(keyspace)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_20_prepare_all_queries_lambda1(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_20_prepare_all_queries_lambda1 = {"lambda1", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_20_prepare_all_queries_lambda1, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_20_prepare_all_queries_lambda1(PyObject *__pyx_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self, ((PyObject *)__pyx_v_s));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda1", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_keyspace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cassandra.cluster.Cluster._prepare_all_queries.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1354
 *         self.control_connection.set_meta_refresh_enabled(bool(enabled))
 * 
 *     def _prepare_all_queries(self, host):             # <<<<<<<<<<<<<<
 *         if not self._prepared_statements:
 *             return
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_92_prepare_all_queries(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host) {
  PyObject *__pyx_v_connection = NULL;
  PyObject *__pyx_v_statements = NULL;
  PyObject *__pyx_v_keyspace = NULL;
  PyObject *__pyx_v_ks_statements = NULL;
  PyObject *__pyx_v_chunks = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_ks_chunk = NULL;
  PyObject *__pyx_v_messages = NULL;
  PyObject *__pyx_v_responses = NULL;
  PyObject *__pyx_v_response = NULL;
  PyObject *__pyx_v_timeout = NULL;
  PyObject *__pyx_v_exc = NULL;
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *(*__pyx_t_18)(PyObject *);
  PyObject *(*__pyx_t_19)(PyObject *);
  Py_ssize_t __pyx_t_20;
  PyObject *(*__pyx_t_21)(PyObject *);
  int __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  int __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  int __pyx_t_26;
  char const *__pyx_t_27;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_prepare_all_queries", 0);

  /* "cassandra/cluster.py":1355
 * 
 *     def _prepare_all_queries(self, host):
 *         if not self._prepared_statements:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_prepared_statements); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":1356
 *     def _prepare_all_queries(self, host):
 *         if not self._prepared_statements:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         log.debug("Preparing all known prepared statements against host %s", host)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":1358
 *             return
 * 
 *         log.debug("Preparing all known prepared statements against host %s", host)             # <<<<<<<<<<<<<<
 *         connection = None
 *         try:
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_Preparing_all_known_prepared_sta);
  __Pyx_GIVEREF(__pyx_kp_s_Preparing_all_known_prepared_sta);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Preparing_all_known_prepared_sta);
  __Pyx_INCREF(__pyx_v_host);
  __Pyx_GIVEREF(__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_host);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1359
 * 
 *         log.debug("Preparing all known prepared statements against host %s", host)
 *         connection = None             # <<<<<<<<<<<<<<
 *         try:
 *             connection = self.connection_factory(host.address)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_connection = Py_None;

  /* "cassandra/cluster.py":1360
 *         log.debug("Preparing all known prepared statements against host %s", host)
 *         connection = None
 *         try:             # <<<<<<<<<<<<<<
 *             connection = self.connection_factory(host.address)
 *             try:
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      /*try:*/ {

        /* "cassandra/cluster.py":1361
 *         connection = None
 *         try:
 *             connection = self.connection_factory(host.address)             # <<<<<<<<<<<<<<
 *             try:
 *                 self.control_connection.wait_for_schema_agreement(connection)
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_factory); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_address); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        if (!__pyx_t_4) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4); __pyx_t_4 = NULL;
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF_SET(__pyx_v_connection, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "cassandra/cluster.py":1362
 *         try:
 *             connection = self.connection_factory(host.address)
 *             try:             # <<<<<<<<<<<<<<
 *                 self.control_connection.wait_for_schema_agreement(connection)
 *             except Exception:
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          /*try:*/ {

            /* "cassandra/cluster.py":1363
 *             connection = self.connection_factory(host.address)
 *             try:
 *                 self.control_connection.wait_for_schema_agreement(connection)             # <<<<<<<<<<<<<<
 *             except Exception:
 *                 log.debug("Error waiting for schema agreement before preparing statements against host %s", host, exc_info=True)
 */
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_wait_for_schema_agreement); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __pyx_t_5 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_11))) {
              __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_11);
              if (likely(__pyx_t_5)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
                __Pyx_INCREF(__pyx_t_5);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_11, function);
              }
            }
            if (!__pyx_t_5) {
              __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_connection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
              __Pyx_GOTREF(__pyx_t_1);
            } else {
              __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
              __Pyx_GOTREF(__pyx_t_7);
              __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
              __Pyx_INCREF(__pyx_v_connection);
              __Pyx_GIVEREF(__pyx_v_connection);
              PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_connection);
              __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            }
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          }
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          goto __pyx_L22_try_end;
          __pyx_L15_error:;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "cassandra/cluster.py":1364
 *             try:
 *                 self.control_connection.wait_for_schema_agreement(connection)
 *             except Exception:             # <<<<<<<<<<<<<<
 *                 log.debug("Error waiting for schema agreement before preparing statements against host %s", host, exc_info=True)
 * 
 */
          __pyx_t_15 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
          if (__pyx_t_15) {
            __Pyx_AddTraceback("cassandra.cluster.Cluster._prepare_all_queries", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_11, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_GOTREF(__pyx_t_7);

            /* "cassandra/cluster.py":1365
 *                 self.control_connection.wait_for_schema_agreement(connection)
 *             except Exception:
 *                 log.debug("Error waiting for schema agreement before preparing statements against host %s", host, exc_info=True)             # <<<<<<<<<<<<<<
 * 
 *             statements = self._prepared_statements.values()
 */
            __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_INCREF(__pyx_kp_s_Error_waiting_for_schema_agreeme);
            __Pyx_GIVEREF(__pyx_kp_s_Error_waiting_for_schema_agreeme);
            PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_s_Error_waiting_for_schema_agreeme);
            __Pyx_INCREF(__pyx_v_host);
            __Pyx_GIVEREF(__pyx_v_host);
            PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_host);
            __pyx_t_16 = PyDict_New(); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
            __Pyx_GOTREF(__pyx_t_16);
            if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_exc_info, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
            __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_16); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
            __Pyx_GOTREF(__pyx_t_17);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            goto __pyx_L16_exception_handled;
          }
          goto __pyx_L17_except_error;
          __pyx_L17_except_error:;
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
          goto __pyx_L7_error;
          __pyx_L16_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
          __pyx_L22_try_end:;
        }

        /* "cassandra/cluster.py":1367
 *                 log.debug("Error waiting for schema agreement before preparing statements against host %s", host, exc_info=True)
 * 
 *             statements = self._prepared_statements.values()             # <<<<<<<<<<<<<<
 *             for keyspace, ks_statements in groupby(statements, lambda s: s.keyspace):
 *                 if keyspace is not None:
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_prepared_statements); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        if (__pyx_t_11) {
          __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        } else {
          __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        }
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_statements = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "cassandra/cluster.py":1368
 * 
 *             statements = self._prepared_statements.values()
 *             for keyspace, ks_statements in groupby(statements, lambda s: s.keyspace):             # <<<<<<<<<<<<<<
 *                 if keyspace is not None:
 *                     connection.set_keyspace_blocking(keyspace)
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_groupby); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_20_prepare_all_queries_lambda1, 0, __pyx_n_s_Cluster__prepare_all_queries_loc, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_17 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_17)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_17);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
            __pyx_t_6 = 1;
          }
        }
        __pyx_t_16 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_16);
        if (__pyx_t_17) {
          __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_17); __pyx_t_17 = NULL;
        }
        __Pyx_INCREF(__pyx_v_statements);
        __Pyx_GIVEREF(__pyx_v_statements);
        PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_6, __pyx_v_statements);
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_6, __pyx_t_11);
        __pyx_t_11 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_16, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) {
          __pyx_t_1 = __pyx_t_7; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
          __pyx_t_18 = NULL;
        } else {
          __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_18 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        for (;;) {
          if (likely(!__pyx_t_18)) {
            if (likely(PyList_CheckExact(__pyx_t_1))) {
              if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
              #if CYTHON_COMPILING_IN_CPYTHON
              __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              #else
              __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_7);
              #endif
            } else {
              if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
              #if CYTHON_COMPILING_IN_CPYTHON
              __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              #else
              __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_7);
              #endif
            }
          } else {
            __pyx_t_7 = __pyx_t_18(__pyx_t_1);
            if (unlikely(!__pyx_t_7)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_7);
          }
          if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
            PyObject* sequence = __pyx_t_7;
            #if CYTHON_COMPILING_IN_CPYTHON
            Py_ssize_t size = Py_SIZE(sequence);
            #else
            Py_ssize_t size = PySequence_Size(sequence);
            #endif
            if (unlikely(size != 2)) {
              if (size > 2) __Pyx_RaiseTooManyValuesError(2);
              else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            }
            #if CYTHON_COMPILING_IN_CPYTHON
            if (likely(PyTuple_CheckExact(sequence))) {
              __pyx_t_16 = PyTuple_GET_ITEM(sequence, 0); 
              __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
            } else {
              __pyx_t_16 = PyList_GET_ITEM(sequence, 0); 
              __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
            }
            __Pyx_INCREF(__pyx_t_16);
            __Pyx_INCREF(__pyx_t_11);
            #else
            __pyx_t_16 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_16);
            __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_11);
            #endif
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          } else {
            Py_ssize_t index = -1;
            __pyx_t_17 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_17);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_19 = Py_TYPE(__pyx_t_17)->tp_iternext;
            index = 0; __pyx_t_16 = __pyx_t_19(__pyx_t_17); if (unlikely(!__pyx_t_16)) goto __pyx_L27_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_16);
            index = 1; __pyx_t_11 = __pyx_t_19(__pyx_t_17); if (unlikely(!__pyx_t_11)) goto __pyx_L27_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_11);
            if (__Pyx_IternextUnpackEndCheck(__pyx_t_19(__pyx_t_17), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __pyx_t_19 = NULL;
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            goto __pyx_L28_unpacking_done;
            __pyx_L27_unpacking_failed:;
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            __pyx_t_19 = NULL;
            if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __pyx_L28_unpacking_done:;
          }
          __Pyx_XDECREF_SET(__pyx_v_keyspace, __pyx_t_16);
          __pyx_t_16 = 0;
          __Pyx_XDECREF_SET(__pyx_v_ks_statements, __pyx_t_11);
          __pyx_t_11 = 0;

          /* "cassandra/cluster.py":1369
 *             statements = self._prepared_statements.values()
 *             for keyspace, ks_statements in groupby(statements, lambda s: s.keyspace):
 *                 if keyspace is not None:             # <<<<<<<<<<<<<<
 *                     connection.set_keyspace_blocking(keyspace)
 * 
 */
          __pyx_t_3 = (__pyx_v_keyspace != Py_None);
          __pyx_t_2 = (__pyx_t_3 != 0);
          if (__pyx_t_2) {

            /* "cassandra/cluster.py":1370
 *             for keyspace, ks_statements in groupby(statements, lambda s: s.keyspace):
 *                 if keyspace is not None:
 *                     connection.set_keyspace_blocking(keyspace)             # <<<<<<<<<<<<<<
 * 
 *                 # prepare 10 statements at a time
 */
            __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_set_keyspace_blocking); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_16 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_11))) {
              __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_11);
              if (likely(__pyx_t_16)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
                __Pyx_INCREF(__pyx_t_16);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_11, function);
              }
            }
            if (!__pyx_t_16) {
              __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_keyspace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_7);
            } else {
              __pyx_t_17 = PyTuple_New(1+1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_17);
              __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_16); __pyx_t_16 = NULL;
              __Pyx_INCREF(__pyx_v_keyspace);
              __Pyx_GIVEREF(__pyx_v_keyspace);
              PyTuple_SET_ITEM(__pyx_t_17, 0+1, __pyx_v_keyspace);
              __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_17, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_7);
              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            }
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            goto __pyx_L29;
          }
          __pyx_L29:;

          /* "cassandra/cluster.py":1373
 * 
 *                 # prepare 10 statements at a time
 *                 ks_statements = list(ks_statements)             # <<<<<<<<<<<<<<
 *                 chunks = []
 *                 for i in range(0, len(ks_statements), 10):
 */
          __pyx_t_7 = PySequence_List(__pyx_v_ks_statements); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF_SET(__pyx_v_ks_statements, __pyx_t_7);
          __pyx_t_7 = 0;

          /* "cassandra/cluster.py":1374
 *                 # prepare 10 statements at a time
 *                 ks_statements = list(ks_statements)
 *                 chunks = []             # <<<<<<<<<<<<<<
 *                 for i in range(0, len(ks_statements), 10):
 *                     chunks.append(ks_statements[i:i + 10])
 */
          __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_XDECREF_SET(__pyx_v_chunks, ((PyObject*)__pyx_t_7));
          __pyx_t_7 = 0;

          /* "cassandra/cluster.py":1375
 *                 ks_statements = list(ks_statements)
 *                 chunks = []
 *                 for i in range(0, len(ks_statements), 10):             # <<<<<<<<<<<<<<
 *                     chunks.append(ks_statements[i:i + 10])
 * 
 */
          __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_range); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_20 = PyObject_Length(__pyx_v_ks_statements); if (unlikely(__pyx_t_20 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __pyx_t_17 = PyInt_FromSsize_t(__pyx_t_20); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_16 = NULL;
          __pyx_t_20 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_11))) {
            __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_11);
            if (likely(__pyx_t_16)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
              __Pyx_INCREF(__pyx_t_16);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_11, function);
              __pyx_t_20 = 1;
            }
          }
          __pyx_t_5 = PyTuple_New(3+__pyx_t_20); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_5);
          if (__pyx_t_16) {
            __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_16); __pyx_t_16 = NULL;
          }
          __Pyx_INCREF(__pyx_int_0);
          __Pyx_GIVEREF(__pyx_int_0);
          PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_20, __pyx_int_0);
          __Pyx_GIVEREF(__pyx_t_17);
          PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_20, __pyx_t_17);
          __Pyx_INCREF(__pyx_int_10);
          __Pyx_GIVEREF(__pyx_int_10);
          PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_20, __pyx_int_10);
          __pyx_t_17 = 0;
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) {
            __pyx_t_11 = __pyx_t_7; __Pyx_INCREF(__pyx_t_11); __pyx_t_20 = 0;
            __pyx_t_21 = NULL;
          } else {
            __pyx_t_20 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_21 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          }
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          for (;;) {
            if (likely(!__pyx_t_21)) {
              if (likely(PyList_CheckExact(__pyx_t_11))) {
                if (__pyx_t_20 >= PyList_GET_SIZE(__pyx_t_11)) break;
                #if CYTHON_COMPILING_IN_CPYTHON
                __pyx_t_7 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_20); __Pyx_INCREF(__pyx_t_7); __pyx_t_20++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                #else
                __pyx_t_7 = PySequence_ITEM(__pyx_t_11, __pyx_t_20); __pyx_t_20++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __Pyx_GOTREF(__pyx_t_7);
                #endif
              } else {
                if (__pyx_t_20 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
                #if CYTHON_COMPILING_IN_CPYTHON
                __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_20); __Pyx_INCREF(__pyx_t_7); __pyx_t_20++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                #else
                __pyx_t_7 = PySequence_ITEM(__pyx_t_11, __pyx_t_20); __pyx_t_20++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __Pyx_GOTREF(__pyx_t_7);
                #endif
              }
            } else {
              __pyx_t_7 = __pyx_t_21(__pyx_t_11);
              if (unlikely(!__pyx_t_7)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                  else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                }
                break;
              }
              __Pyx_GOTREF(__pyx_t_7);
            }
            __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_7);
            __pyx_t_7 = 0;

            /* "cassandra/cluster.py":1376
 *                 chunks = []
 *                 for i in range(0, len(ks_statements), 10):
 *                     chunks.append(ks_statements[i:i + 10])             # <<<<<<<<<<<<<<
 * 
 *                 for ks_chunk in chunks:
 */
            __pyx_t_7 = PyNumber_Add(__pyx_v_i, __pyx_int_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_ks_statements, 0, 0, &__pyx_v_i, &__pyx_t_7, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_22 = __Pyx_PyList_Append(__pyx_v_chunks, __pyx_t_5); if (unlikely(__pyx_t_22 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

            /* "cassandra/cluster.py":1375
 *                 ks_statements = list(ks_statements)
 *                 chunks = []
 *                 for i in range(0, len(ks_statements), 10):             # <<<<<<<<<<<<<<
 *                     chunks.append(ks_statements[i:i + 10])
 * 
 */
          }
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

          /* "cassandra/cluster.py":1378
 *                     chunks.append(ks_statements[i:i + 10])
 * 
 *                 for ks_chunk in chunks:             # <<<<<<<<<<<<<<
 *                     messages = [PrepareMessage(query=s.query_string) for s in ks_chunk]
 *                     # TODO: make this timeout configurable somehow?
 */
          __pyx_t_11 = __pyx_v_chunks; __Pyx_INCREF(__pyx_t_11); __pyx_t_20 = 0;
          for (;;) {
            if (__pyx_t_20 >= PyList_GET_SIZE(__pyx_t_11)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_5 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_20); __Pyx_INCREF(__pyx_t_5); __pyx_t_20++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            #else
            __pyx_t_5 = PySequence_ITEM(__pyx_t_11, __pyx_t_20); __pyx_t_20++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_5);
            #endif
            __Pyx_XDECREF_SET(__pyx_v_ks_chunk, __pyx_t_5);
            __pyx_t_5 = 0;

            /* "cassandra/cluster.py":1379
 * 
 *                 for ks_chunk in chunks:
 *                     messages = [PrepareMessage(query=s.query_string) for s in ks_chunk]             # <<<<<<<<<<<<<<
 *                     # TODO: make this timeout configurable somehow?
 *                     responses = connection.wait_for_responses(*messages, timeout=5.0)
 */
            __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_5);
            if (likely(PyList_CheckExact(__pyx_v_ks_chunk)) || PyTuple_CheckExact(__pyx_v_ks_chunk)) {
              __pyx_t_7 = __pyx_v_ks_chunk; __Pyx_INCREF(__pyx_t_7); __pyx_t_23 = 0;
              __pyx_t_21 = NULL;
            } else {
              __pyx_t_23 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_ks_chunk); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_7);
              __pyx_t_21 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            }
            for (;;) {
              if (likely(!__pyx_t_21)) {
                if (likely(PyList_CheckExact(__pyx_t_7))) {
                  if (__pyx_t_23 >= PyList_GET_SIZE(__pyx_t_7)) break;
                  #if CYTHON_COMPILING_IN_CPYTHON
                  __pyx_t_17 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_23); __Pyx_INCREF(__pyx_t_17); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  #else
                  __pyx_t_17 = PySequence_ITEM(__pyx_t_7, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  __Pyx_GOTREF(__pyx_t_17);
                  #endif
                } else {
                  if (__pyx_t_23 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
                  #if CYTHON_COMPILING_IN_CPYTHON
                  __pyx_t_17 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_23); __Pyx_INCREF(__pyx_t_17); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  #else
                  __pyx_t_17 = PySequence_ITEM(__pyx_t_7, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  __Pyx_GOTREF(__pyx_t_17);
                  #endif
                }
              } else {
                __pyx_t_17 = __pyx_t_21(__pyx_t_7);
                if (unlikely(!__pyx_t_17)) {
                  PyObject* exc_type = PyErr_Occurred();
                  if (exc_type) {
                    if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                    else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  }
                  break;
                }
                __Pyx_GOTREF(__pyx_t_17);
              }
              __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_17);
              __pyx_t_17 = 0;
              __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s_PrepareMessage); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_17);
              __pyx_t_16 = PyDict_New(); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_16);
              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_query_string); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_4);
              if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_query, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_empty_tuple, __pyx_t_16); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
              __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
              if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            }
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_XDECREF_SET(__pyx_v_messages, ((PyObject*)__pyx_t_5));
            __pyx_t_5 = 0;

            /* "cassandra/cluster.py":1381
 *                     messages = [PrepareMessage(query=s.query_string) for s in ks_chunk]
 *                     # TODO: make this timeout configurable somehow?
 *                     responses = connection.wait_for_responses(*messages, timeout=5.0)             # <<<<<<<<<<<<<<
 *                     for response in responses:
 *                         if (not isinstance(response, ResultMessage) or
 */
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_wait_for_responses); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_7 = PySequence_Tuple(__pyx_v_messages); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_4);
            if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_timeout, __pyx_float_5_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_16);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF_SET(__pyx_v_responses, __pyx_t_16);
            __pyx_t_16 = 0;

            /* "cassandra/cluster.py":1382
 *                     # TODO: make this timeout configurable somehow?
 *                     responses = connection.wait_for_responses(*messages, timeout=5.0)
 *                     for response in responses:             # <<<<<<<<<<<<<<
 *                         if (not isinstance(response, ResultMessage) or
 *                                 response.kind != RESULT_KIND_PREPARED):
 */
            if (likely(PyList_CheckExact(__pyx_v_responses)) || PyTuple_CheckExact(__pyx_v_responses)) {
              __pyx_t_16 = __pyx_v_responses; __Pyx_INCREF(__pyx_t_16); __pyx_t_23 = 0;
              __pyx_t_21 = NULL;
            } else {
              __pyx_t_23 = -1; __pyx_t_16 = PyObject_GetIter(__pyx_v_responses); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_16);
              __pyx_t_21 = Py_TYPE(__pyx_t_16)->tp_iternext; if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            }
            for (;;) {
              if (likely(!__pyx_t_21)) {
                if (likely(PyList_CheckExact(__pyx_t_16))) {
                  if (__pyx_t_23 >= PyList_GET_SIZE(__pyx_t_16)) break;
                  #if CYTHON_COMPILING_IN_CPYTHON
                  __pyx_t_4 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_23); __Pyx_INCREF(__pyx_t_4); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  #else
                  __pyx_t_4 = PySequence_ITEM(__pyx_t_16, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  __Pyx_GOTREF(__pyx_t_4);
                  #endif
                } else {
                  if (__pyx_t_23 >= PyTuple_GET_SIZE(__pyx_t_16)) break;
                  #if CYTHON_COMPILING_IN_CPYTHON
                  __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_16, __pyx_t_23); __Pyx_INCREF(__pyx_t_4); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  #else
                  __pyx_t_4 = PySequence_ITEM(__pyx_t_16, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  __Pyx_GOTREF(__pyx_t_4);
                  #endif
                }
              } else {
                __pyx_t_4 = __pyx_t_21(__pyx_t_16);
                if (unlikely(!__pyx_t_4)) {
                  PyObject* exc_type = PyErr_Occurred();
                  if (exc_type) {
                    if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                    else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                  }
                  break;
                }
                __Pyx_GOTREF(__pyx_t_4);
              }
              __Pyx_XDECREF_SET(__pyx_v_response, __pyx_t_4);
              __pyx_t_4 = 0;

              /* "cassandra/cluster.py":1383
 *                     responses = connection.wait_for_responses(*messages, timeout=5.0)
 *                     for response in responses:
 *                         if (not isinstance(response, ResultMessage) or             # <<<<<<<<<<<<<<
 *                                 response.kind != RESULT_KIND_PREPARED):
 *                             log.debug("Got unexpected response when preparing "
 */
              __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ResultMessage); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_3 = PyObject_IsInstance(__pyx_v_response, __pyx_t_4); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              __pyx_t_24 = ((!(__pyx_t_3 != 0)) != 0);
              if (!__pyx_t_24) {
              } else {
                __pyx_t_2 = __pyx_t_24;
                goto __pyx_L39_bool_binop_done;
              }

              /* "cassandra/cluster.py":1384
 *                     for response in responses:
 *                         if (not isinstance(response, ResultMessage) or
 *                                 response.kind != RESULT_KIND_PREPARED):             # <<<<<<<<<<<<<<
 *                             log.debug("Got unexpected response when preparing "
 *                                       "statement on host %s: %r", host, response)
 */
              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_kind); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_RESULT_KIND_PREPARED); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_7);
              __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              __pyx_t_24 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_24 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              __pyx_t_2 = __pyx_t_24;
              __pyx_L39_bool_binop_done:;
              if (__pyx_t_2) {

                /* "cassandra/cluster.py":1385
 *                         if (not isinstance(response, ResultMessage) or
 *                                 response.kind != RESULT_KIND_PREPARED):
 *                             log.debug("Got unexpected response when preparing "             # <<<<<<<<<<<<<<
 *                                       "statement on host %s: %r", host, response)
 * 
 */
                __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __Pyx_GOTREF(__pyx_t_7);
                __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __Pyx_GOTREF(__pyx_t_4);
                __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

                /* "cassandra/cluster.py":1386
 *                                 response.kind != RESULT_KIND_PREPARED):
 *                             log.debug("Got unexpected response when preparing "
 *                                       "statement on host %s: %r", host, response)             # <<<<<<<<<<<<<<
 * 
 *             log.debug("Done preparing all known prepared statements against host %s", host)
 */
                __pyx_t_7 = NULL;
                __pyx_t_25 = 0;
                if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
                  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
                  if (likely(__pyx_t_7)) {
                    PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                    __Pyx_INCREF(__pyx_t_7);
                    __Pyx_INCREF(function);
                    __Pyx_DECREF_SET(__pyx_t_4, function);
                    __pyx_t_25 = 1;
                  }
                }
                __pyx_t_17 = PyTuple_New(3+__pyx_t_25); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __Pyx_GOTREF(__pyx_t_17);
                if (__pyx_t_7) {
                  __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_7); __pyx_t_7 = NULL;
                }
                __Pyx_INCREF(__pyx_kp_s_Got_unexpected_response_when_pre);
                __Pyx_GIVEREF(__pyx_kp_s_Got_unexpected_response_when_pre);
                PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_25, __pyx_kp_s_Got_unexpected_response_when_pre);
                __Pyx_INCREF(__pyx_v_host);
                __Pyx_GIVEREF(__pyx_v_host);
                PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_25, __pyx_v_host);
                __Pyx_INCREF(__pyx_v_response);
                __Pyx_GIVEREF(__pyx_v_response);
                PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_25, __pyx_v_response);
                __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_17, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                __Pyx_GOTREF(__pyx_t_5);
                __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                goto __pyx_L38;
              }
              __pyx_L38:;

              /* "cassandra/cluster.py":1382
 *                     # TODO: make this timeout configurable somehow?
 *                     responses = connection.wait_for_responses(*messages, timeout=5.0)
 *                     for response in responses:             # <<<<<<<<<<<<<<
 *                         if (not isinstance(response, ResultMessage) or
 *                                 response.kind != RESULT_KIND_PREPARED):
 */
            }
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

            /* "cassandra/cluster.py":1378
 *                     chunks.append(ks_statements[i:i + 10])
 * 
 *                 for ks_chunk in chunks:             # <<<<<<<<<<<<<<
 *                     messages = [PrepareMessage(query=s.query_string) for s in ks_chunk]
 *                     # TODO: make this timeout configurable somehow?
 */
          }
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

          /* "cassandra/cluster.py":1368
 * 
 *             statements = self._prepared_statements.values()
 *             for keyspace, ks_statements in groupby(statements, lambda s: s.keyspace):             # <<<<<<<<<<<<<<
 *                 if keyspace is not None:
 *                     connection.set_keyspace_blocking(keyspace)
 */
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":1388
 *                                       "statement on host %s: %r", host, response)
 * 
 *             log.debug("Done preparing all known prepared statements against host %s", host)             # <<<<<<<<<<<<<<
 *         except OperationTimedOut as timeout:
 *             log.warning("Timed out trying to prepare all statements on host %s: %s", host, timeout)
 */
        __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_debug); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_16))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_16);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_16, function);
            __pyx_t_6 = 1;
          }
        }
        __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_5);
        if (__pyx_t_11) {
          __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_11); __pyx_t_11 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_s_Done_preparing_all_known_prepare);
        __Pyx_GIVEREF(__pyx_kp_s_Done_preparing_all_known_prepare);
        PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_kp_s_Done_preparing_all_known_prepare);
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_host);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "cassandra/cluster.py":1389
 * 
 *             log.debug("Done preparing all known prepared statements against host %s", host)
 *         except OperationTimedOut as timeout:             # <<<<<<<<<<<<<<
 *             log.warning("Timed out trying to prepare all statements on host %s: %s", host, timeout)
 *         except (ConnectionException, socket.error) as exc:
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_OperationTimedOut); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_15 = PyErr_ExceptionMatches(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_15) {
        __Pyx_AddTraceback("cassandra.cluster.Cluster._prepare_all_queries", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_16, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_16);
        __pyx_v_timeout = __pyx_t_16;

        /* "cassandra/cluster.py":1390
 *             log.debug("Done preparing all known prepared statements against host %s", host)
 *         except OperationTimedOut as timeout:
 *             log.warning("Timed out trying to prepare all statements on host %s: %s", host, timeout)             # <<<<<<<<<<<<<<
 *         except (ConnectionException, socket.error) as exc:
 *             log.warning("Error trying to prepare all statements on host %s: %r", host, exc)
 */
        __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_warning); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_17))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_17);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_17, function);
            __pyx_t_6 = 1;
          }
        }
        __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_s_Timed_out_trying_to_prepare_all);
        __Pyx_GIVEREF(__pyx_kp_s_Timed_out_trying_to_prepare_all);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Timed_out_trying_to_prepare_all);
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_host);
        __Pyx_INCREF(__pyx_v_timeout);
        __Pyx_GIVEREF(__pyx_v_timeout);
        PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_timeout);
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_7, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L8_exception_handled;
      }

      /* "cassandra/cluster.py":1391
 *         except OperationTimedOut as timeout:
 *             log.warning("Timed out trying to prepare all statements on host %s: %s", host, timeout)
 *         except (ConnectionException, socket.error) as exc:             # <<<<<<<<<<<<<<
 *             log.warning("Error trying to prepare all statements on host %s: %r", host, exc)
 *         except Exception:
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConnectionException); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_socket); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_15 = PyErr_ExceptionMatches(__pyx_t_5) || PyErr_ExceptionMatches(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_15) {
        __Pyx_AddTraceback("cassandra.cluster.Cluster._prepare_all_queries", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_16) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_v_exc = __pyx_t_5;

        /* "cassandra/cluster.py":1392
 *             log.warning("Timed out trying to prepare all statements on host %s: %s", host, timeout)
 *         except (ConnectionException, socket.error) as exc:
 *             log.warning("Error trying to prepare all statements on host %s: %r", host, exc)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             log.exception("Error trying to prepare all statements on host %s", host)
 */
        __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_warning); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_17 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_17)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_17);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_6 = 1;
          }
        }
        __pyx_t_4 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_17) {
          __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_17); __pyx_t_17 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_s_Error_trying_to_prepare_all_stat);
        __Pyx_GIVEREF(__pyx_kp_s_Error_trying_to_prepare_all_stat);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_kp_s_Error_trying_to_prepare_all_stat);
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_host);
        __Pyx_INCREF(__pyx_v_exc);
        __Pyx_GIVEREF(__pyx_v_exc);
        PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_6, __pyx_v_exc);
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        goto __pyx_L8_exception_handled;
      }

      /* "cassandra/cluster.py":1393
 *         except (ConnectionException, socket.error) as exc:
 *             log.warning("Error trying to prepare all statements on host %s: %r", host, exc)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             log.exception("Error trying to prepare all statements on host %s", host)
 *         finally:
 */
      __pyx_t_15 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
      if (__pyx_t_15) {
        __Pyx_AddTraceback("cassandra.cluster.Cluster._prepare_all_queries", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_16, &__pyx_t_5, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1393; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_1);

        /* "cassandra/cluster.py":1394
 *             log.warning("Error trying to prepare all statements on host %s: %r", host, exc)
 *         except Exception:
 *             log.exception("Error trying to prepare all statements on host %s", host)             # <<<<<<<<<<<<<<
 *         finally:
 *             if connection:
 */
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_exception); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_6 = 1;
          }
        }
        __pyx_t_17 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_17);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_s_Error_trying_to_prepare_all_stat_2);
        __Pyx_GIVEREF(__pyx_kp_s_Error_trying_to_prepare_all_stat_2);
        PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_6, __pyx_kp_s_Error_trying_to_prepare_all_stat_2);
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_6, __pyx_v_host);
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_17, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L8_exception_handled;
      }
      goto __pyx_L9_except_error;
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      goto __pyx_L5_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      __pyx_L14_try_end:;
    }
  }

  /* "cassandra/cluster.py":1396
 *             log.exception("Error trying to prepare all statements on host %s", host)
 *         finally:
 *             if connection:             # <<<<<<<<<<<<<<
 *                 connection.close()
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_connection); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_2) {

        /* "cassandra/cluster.py":1397
 *         finally:
 *             if connection:
 *                 connection.close()             # <<<<<<<<<<<<<<
 * 
 *     def prepare_on_all_sessions(self, query_id, prepared_statement, excluded_host):
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_16 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_16)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_16);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        if (__pyx_t_16) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_16); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L47;
      }
      __pyx_L47:;
      goto __pyx_L6;
    }
    /*exception exit:*/{
      __pyx_L5_error:;
      __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_15 = __pyx_lineno; __pyx_t_26 = __pyx_clineno; __pyx_t_27 = __pyx_filename;
      {

        /* "cassandra/cluster.py":1396
 *             log.exception("Error trying to prepare all statements on host %s", host)
 *         finally:
 *             if connection:             # <<<<<<<<<<<<<<
 *                 connection.close()
 * 
 */
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_connection); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; __pyx_clineno = __LINE__; goto __pyx_L49_error;}
        if (__pyx_t_2) {

          /* "cassandra/cluster.py":1397
 *         finally:
 *             if connection:
 *                 connection.close()             # <<<<<<<<<<<<<<
 * 
 *     def prepare_on_all_sessions(self, query_id, prepared_statement, excluded_host):
 */
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L49_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_16 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
            __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_5);
            if (likely(__pyx_t_16)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
              __Pyx_INCREF(__pyx_t_16);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_5, function);
            }
          }
          if (__pyx_t_16) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_16); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L49_error;}
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          } else {
            __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L49_error;}
          }
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          goto __pyx_L50;
        }
        __pyx_L50:;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_13, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_15; __pyx_clineno = __pyx_t_26; __pyx_filename = __pyx_t_27;
      goto __pyx_L1_error;
      __pyx_L49_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_13, __pyx_t_12);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L6:;
  }

  /* "cassandra/cluster.py":1354
 *         self.control_connection.set_meta_refresh_enabled(bool(enabled))
 * 
 *     def _prepare_all_queries(self, host):             # <<<<<<<<<<<<<<
 *         if not self._prepared_statements:
 *             return
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("cassandra.cluster.Cluster._prepare_all_queries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_connection);
  __Pyx_XDECREF(__pyx_v_statements);
  __Pyx_XDECREF(__pyx_v_keyspace);
  __Pyx_XDECREF(__pyx_v_ks_statements);
  __Pyx_XDECREF(__pyx_v_chunks);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_ks_chunk);
  __Pyx_XDECREF(__pyx_v_messages);
  __Pyx_XDECREF(__pyx_v_responses);
  __Pyx_XDECREF(__pyx_v_response);
  __Pyx_XDECREF(__pyx_v_timeout);
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1399
 *                 connection.close()
 * 
 *     def prepare_on_all_sessions(self, query_id, prepared_statement, excluded_host):             # <<<<<<<<<<<<<<
 *         with self._prepared_statement_lock:
 *             self._prepared_statements[query_id] = prepared_statement
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_95prepare_on_all_sessions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Cluster_95prepare_on_all_sessions = {"prepare_on_all_sessions", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Cluster_95prepare_on_all_sessions, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Cluster_95prepare_on_all_sessions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_query_id = 0;
  PyObject *__pyx_v_prepared_statement = 0;
  PyObject *__pyx_v_excluded_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prepare_on_all_sessions (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_query_id,&__pyx_n_s_prepared_statement,&__pyx_n_s_excluded_host,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query_id)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("prepare_on_all_sessions", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_prepared_statement)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("prepare_on_all_sessions", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_excluded_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("prepare_on_all_sessions", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prepare_on_all_sessions") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_query_id = values[1];
    __pyx_v_prepared_statement = values[2];
    __pyx_v_excluded_host = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("prepare_on_all_sessions", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Cluster.prepare_on_all_sessions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Cluster_94prepare_on_all_sessions(__pyx_self, __pyx_v_self, __pyx_v_query_id, __pyx_v_prepared_statement, __pyx_v_excluded_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Cluster_94prepare_on_all_sessions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query_id, PyObject *__pyx_v_prepared_statement, PyObject *__pyx_v_excluded_host) {
  PyObject *__pyx_v_session = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *__pyx_t_14 = NULL;
  Py_ssize_t __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prepare_on_all_sessions", 0);

  /* "cassandra/cluster.py":1400
 * 
 *     def prepare_on_all_sessions(self, query_id, prepared_statement, excluded_host):
 *         with self._prepared_statement_lock:             # <<<<<<<<<<<<<<
 *             self._prepared_statements[query_id] = prepared_statement
 *         for session in self.sessions:
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_prepared_statement_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cassandra/cluster.py":1401
 *     def prepare_on_all_sessions(self, query_id, prepared_statement, excluded_host):
 *         with self._prepared_statement_lock:
 *             self._prepared_statements[query_id] = prepared_statement             # <<<<<<<<<<<<<<
 *         for session in self.sessions:
 *             session.prepare_on_all_hosts(prepared_statement.query_string, excluded_host)
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_prepared_statements); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1401; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_query_id, __pyx_v_prepared_statement) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1401; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":1400
 * 
 *     def prepare_on_all_sessions(self, query_id, prepared_statement, excluded_host):
 *         with self._prepared_statement_lock:             # <<<<<<<<<<<<<<
 *             self._prepared_statements[query_id] = prepared_statement
 *         for session in self.sessions:
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.Cluster.prepare_on_all_sessions", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_4);
            __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__53, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L18;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L18:;
  }

  /* "cassandra/cluster.py":1402
 *         with self._prepared_statement_lock:
 *             self._prepared_statements[query_id] = prepared_statement
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.prepare_on_all_hosts(prepared_statement.query_string, excluded_host)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sessions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_12 = 0;
    __pyx_t_13 = NULL;
  } else {
    __pyx_t_12 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_13 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_13)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_13(__pyx_t_3);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_session, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":1403
 *             self._prepared_statements[query_id] = prepared_statement
 *         for session in self.sessions:
 *             session.prepare_on_all_hosts(prepared_statement.query_string, excluded_host)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_prepare_on_all_hosts); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_prepared_statement, __pyx_n_s_query_string); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_14 = NULL;
    __pyx_t_15 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_15 = 1;
      }
    }
    __pyx_t_16 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_16);
    if (__pyx_t_14) {
      __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_14); __pyx_t_14 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_15, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_excluded_host);
    __Pyx_GIVEREF(__pyx_v_excluded_host);
    PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_15, __pyx_v_excluded_host);
    __pyx_t_5 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_16, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":1402
 *         with self._prepared_statement_lock:
 *             self._prepared_statements[query_id] = prepared_statement
 *         for session in self.sessions:             # <<<<<<<<<<<<<<
 *             session.prepare_on_all_hosts(prepared_statement.query_string, excluded_host)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":1399
 *                 connection.close()
 * 
 *     def prepare_on_all_sessions(self, query_id, prepared_statement, excluded_host):             # <<<<<<<<<<<<<<
 *         with self._prepared_statement_lock:
 *             self._prepared_statements[query_id] = prepared_statement
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("cassandra.cluster.Cluster.prepare_on_all_sessions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_session);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1543
 *     _metrics = None
 * 
 *     def __init__(self, cluster, hosts):             # <<<<<<<<<<<<<<
 *         self.cluster = cluster
 *         self.hosts = hosts
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_1__init__ = {"__init__", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_cluster = 0;
  PyObject *__pyx_v_hosts = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_cluster,&__pyx_n_s_hosts,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cluster)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hosts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_cluster = values[1];
    __pyx_v_hosts = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session___init__(__pyx_self, __pyx_v_self, __pyx_v_cluster, __pyx_v_hosts);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cluster, PyObject *__pyx_v_hosts) {
  PyObject *__pyx_v_futures = NULL;
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_future = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cassandra/cluster.py":1544
 * 
 *     def __init__(self, cluster, hosts):
 *         self.cluster = cluster             # <<<<<<<<<<<<<<
 *         self.hosts = hosts
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cluster, __pyx_v_cluster) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1545
 *     def __init__(self, cluster, hosts):
 *         self.cluster = cluster
 *         self.hosts = hosts             # <<<<<<<<<<<<<<
 * 
 *         self._lock = RLock()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_hosts, __pyx_v_hosts) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1547
 *         self.hosts = hosts
 * 
 *         self._lock = RLock()             # <<<<<<<<<<<<<<
 *         self._pools = {}
 *         self._load_balancer = cluster.load_balancing_policy
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_RLock); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_lock, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1548
 * 
 *         self._lock = RLock()
 *         self._pools = {}             # <<<<<<<<<<<<<<
 *         self._load_balancer = cluster.load_balancing_policy
 *         self._metrics = cluster.metrics
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1549
 *         self._lock = RLock()
 *         self._pools = {}
 *         self._load_balancer = cluster.load_balancing_policy             # <<<<<<<<<<<<<<
 *         self._metrics = cluster.metrics
 *         self._protocol_version = self.cluster.protocol_version
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cluster, __pyx_n_s_load_balancing_policy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_load_balancer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1550
 *         self._pools = {}
 *         self._load_balancer = cluster.load_balancing_policy
 *         self._metrics = cluster.metrics             # <<<<<<<<<<<<<<
 *         self._protocol_version = self.cluster.protocol_version
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cluster, __pyx_n_s_metrics); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1551
 *         self._load_balancer = cluster.load_balancing_policy
 *         self._metrics = cluster.metrics
 *         self._protocol_version = self.cluster.protocol_version             # <<<<<<<<<<<<<<
 * 
 *         self.encoder = Encoder()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_protocol_version); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version_2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1553
 *         self._protocol_version = self.cluster.protocol_version
 * 
 *         self.encoder = Encoder()             # <<<<<<<<<<<<<<
 * 
 *         # create connection pools in parallel
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Encoder); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoder, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1556
 * 
 *         # create connection pools in parallel
 *         futures = []             # <<<<<<<<<<<<<<
 *         for host in hosts:
 *             future = self.add_or_renew_pool(host, is_host_addition=False)
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_futures = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1557
 *         # create connection pools in parallel
 *         futures = []
 *         for host in hosts:             # <<<<<<<<<<<<<<
 *             future = self.add_or_renew_pool(host, is_host_addition=False)
 *             if future is not None:
 */
  if (likely(PyList_CheckExact(__pyx_v_hosts)) || PyTuple_CheckExact(__pyx_v_hosts)) {
    __pyx_t_2 = __pyx_v_hosts; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_hosts); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_host, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1558
 *         futures = []
 *         for host in hosts:
 *             future = self.add_or_renew_pool(host, is_host_addition=False)             # <<<<<<<<<<<<<<
 *             if future is not None:
 *                 futures.append(future)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_add_or_renew_pool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_host);
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_is_host_addition, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_future, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "cassandra/cluster.py":1559
 *         for host in hosts:
 *             future = self.add_or_renew_pool(host, is_host_addition=False)
 *             if future is not None:             # <<<<<<<<<<<<<<
 *                 futures.append(future)
 * 
 */
    __pyx_t_8 = (__pyx_v_future != Py_None);
    __pyx_t_9 = (__pyx_t_8 != 0);
    if (__pyx_t_9) {

      /* "cassandra/cluster.py":1560
 *             future = self.add_or_renew_pool(host, is_host_addition=False)
 *             if future is not None:
 *                 futures.append(future)             # <<<<<<<<<<<<<<
 * 
 *         for future in futures:
 */
      __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_futures, __pyx_v_future); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "cassandra/cluster.py":1557
 *         # create connection pools in parallel
 *         futures = []
 *         for host in hosts:             # <<<<<<<<<<<<<<
 *             future = self.add_or_renew_pool(host, is_host_addition=False)
 *             if future is not None:
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1562
 *                 futures.append(future)
 * 
 *         for future in futures:             # <<<<<<<<<<<<<<
 *             future.result()
 * 
 */
  __pyx_t_2 = __pyx_v_futures; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_7 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_7 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_future, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "cassandra/cluster.py":1563
 * 
 *         for future in futures:
 *             future.result()             # <<<<<<<<<<<<<<
 * 
 *     def execute(self, query, parameters=None, timeout=_NOT_SET, trace=False, custom_payload=None):
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_result); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "cassandra/cluster.py":1562
 *                 futures.append(future)
 * 
 *         for future in futures:             # <<<<<<<<<<<<<<
 *             future.result()
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1543
 *     _metrics = None
 * 
 *     def __init__(self, cluster, hosts):             # <<<<<<<<<<<<<<
 *         self.cluster = cluster
 *         self.hosts = hosts
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.Session.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_futures);
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_future);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1565
 *             future.result()
 * 
 *     def execute(self, query, parameters=None, timeout=_NOT_SET, trace=False, custom_payload=None):             # <<<<<<<<<<<<<<
 *         """
 *         Execute the given query and synchronously wait for the response.
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_36__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__defaults__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_None));
  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_timeout);
  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_timeout);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_timeout);
  __Pyx_INCREF(((PyObject *)Py_False));
  __Pyx_GIVEREF(((PyObject *)Py_False));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)Py_False));
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)Py_None));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster.Session.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_3execute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Session_2execute[] = "\n        Execute the given query and synchronously wait for the response.\n\n        If an error is encountered while executing the query, an Exception\n        will be raised.\n\n        `query` may be a query string or an instance of :class:`cassandra.query.Statement`.\n\n        `parameters` may be a sequence or dict of parameters to bind.  If a\n        sequence is used, ``%s`` should be used the placeholder for each\n        argument.  If a dict is used, ``%(name)s`` style placeholders must\n        be used.\n\n        `timeout` should specify a floating-point timeout (in seconds) after\n        which an :exc:`.OperationTimedOut` exception will be raised if the query\n        has not completed.  If not set, the timeout defaults to\n        :attr:`~.Session.default_timeout`.  If set to :const:`None`, there is\n        no timeout. Please see :meth:`.ResponseFuture.result` for details on\n        the scope and effect of this timeout.\n\n        If `trace` is set to :const:`True`, an attempt will be made to\n        fetch the trace details and attach them to the `query`'s\n        :attr:`~.Statement.trace` attribute in the form of a :class:`.QueryTrace`\n        instance.  This requires that `query` be a :class:`.Statement` subclass\n        instance and not just a string.  If there is an error fetching the\n        trace details, the :attr:`~.Statement.trace` attribute will be left as\n        :const:`None`.\n\n        `custom_payload` is a :ref:`custom_payload` dict to be passed to the server.\n        If `query` is a Statement with its own custom_payload. The message payload\n        will be a union of the two, with the values specified here taking precedence.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_3execute = {"execute", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_3execute, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Session_2execute};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_3execute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_query = 0;
  PyObject *__pyx_v_parameters = 0;
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_v_trace = 0;
  PyObject *__pyx_v_custom_payload = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("execute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_query,&__pyx_n_s_parameters,&__pyx_n_s_timeout,&__pyx_n_s_trace,&__pyx_n_s_custom_payload,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    __pyx_defaults1 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self);
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = __pyx_dynamic_args->__pyx_arg_timeout;
    values[4] = ((PyObject *)((PyObject *)Py_False));
    values[5] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("execute", 0, 2, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parameters);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_trace);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_custom_payload);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "execute") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_query = values[1];
    __pyx_v_parameters = values[2];
    __pyx_v_timeout = values[3];
    __pyx_v_trace = values[4];
    __pyx_v_custom_payload = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("execute", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_2execute(__pyx_self, __pyx_v_self, __pyx_v_query, __pyx_v_parameters, __pyx_v_timeout, __pyx_v_trace, __pyx_v_custom_payload);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_2execute(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query, PyObject *__pyx_v_parameters, PyObject *__pyx_v_timeout, PyObject *__pyx_v_trace, PyObject *__pyx_v_custom_payload) {
  PyObject *__pyx_v_future = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_t_14;
  char const *__pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  int __pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("execute", 0);

  /* "cassandra/cluster.py":1598
 *         will be a union of the two, with the values specified here taking precedence.
 *         """
 *         if trace and not isinstance(query, Statement):             # <<<<<<<<<<<<<<
 *             raise TypeError(
 *                 "The query argument must be an instance of a subclass of "
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_trace); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Statement); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_query, __pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cassandra/cluster.py":1599
 *         """
 *         if trace and not isinstance(query, Statement):
 *             raise TypeError(             # <<<<<<<<<<<<<<
 *                 "The query argument must be an instance of a subclass of "
 *                 "cassandra.query.Statement when trace=True")
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":1603
 *                 "cassandra.query.Statement when trace=True")
 * 
 *         future = self.execute_async(query, parameters, trace, custom_payload, timeout)             # <<<<<<<<<<<<<<
 *         try:
 *             result = future.result()
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_execute_async); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_8 = PyTuple_New(5+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (__pyx_t_6) {
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_INCREF(__pyx_v_query);
  __Pyx_GIVEREF(__pyx_v_query);
  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_query);
  __Pyx_INCREF(__pyx_v_parameters);
  __Pyx_GIVEREF(__pyx_v_parameters);
  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_parameters);
  __Pyx_INCREF(__pyx_v_trace);
  __Pyx_GIVEREF(__pyx_v_trace);
  PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_trace);
  __Pyx_INCREF(__pyx_v_custom_payload);
  __Pyx_GIVEREF(__pyx_v_custom_payload);
  PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_v_custom_payload);
  __Pyx_INCREF(__pyx_v_timeout);
  __Pyx_GIVEREF(__pyx_v_timeout);
  PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_7, __pyx_v_timeout);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_future = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cassandra/cluster.py":1604
 * 
 *         future = self.execute_async(query, parameters, trace, custom_payload, timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             result = future.result()
 *         finally:
 */
  /*try:*/ {

    /* "cassandra/cluster.py":1605
 *         future = self.execute_async(query, parameters, trace, custom_payload, timeout)
 *         try:
 *             result = future.result()             # <<<<<<<<<<<<<<
 *         finally:
 *             if trace:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_result); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1605; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_8) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1605; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1605; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_result = __pyx_t_3;
    __pyx_t_3 = 0;
  }

  /* "cassandra/cluster.py":1607
 *             result = future.result()
 *         finally:
 *             if trace:             # <<<<<<<<<<<<<<
 *                 try:
 *                     query.trace = future.get_query_trace(self.max_trace_wait)
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_trace); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_1) {

        /* "cassandra/cluster.py":1608
 *         finally:
 *             if trace:
 *                 try:             # <<<<<<<<<<<<<<
 *                     query.trace = future.get_query_trace(self.max_trace_wait)
 *                 except Exception:
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          /*try:*/ {

            /* "cassandra/cluster.py":1609
 *             if trace:
 *                 try:
 *                     query.trace = future.get_query_trace(self.max_trace_wait)             # <<<<<<<<<<<<<<
 *                 except Exception:
 *                     log.exception("Unable to fetch query trace:")
 */
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_get_query_trace); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_trace_wait); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_6 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
              __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
              if (likely(__pyx_t_6)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
                __Pyx_INCREF(__pyx_t_6);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_5, function);
              }
            }
            if (!__pyx_t_6) {
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_GOTREF(__pyx_t_3);
            } else {
              __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_6); __pyx_t_6 = NULL;
              __Pyx_GIVEREF(__pyx_t_8);
              PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_8);
              __pyx_t_8 = 0;
              __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            }
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (__Pyx_PyObject_SetAttrStr(__pyx_v_query, __pyx_n_s_trace, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          }
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L17_try_end;
          __pyx_L10_error:;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "cassandra/cluster.py":1610
 *                 try:
 *                     query.trace = future.get_query_trace(self.max_trace_wait)
 *                 except Exception:             # <<<<<<<<<<<<<<
 *                     log.exception("Unable to fetch query trace:")
 * 
 */
          __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
          if (__pyx_t_13) {
            __Pyx_AddTraceback("cassandra.cluster.Session.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1610; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_GOTREF(__pyx_t_12);

            /* "cassandra/cluster.py":1611
 *                     query.trace = future.get_query_trace(self.max_trace_wait)
 *                 except Exception:
 *                     log.exception("Unable to fetch query trace:")             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
            __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_exception); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            goto __pyx_L11_exception_handled;
          }
          goto __pyx_L12_except_error;
          __pyx_L12_except_error:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          goto __pyx_L1_error;
          __pyx_L11_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          __pyx_L17_try_end:;
        }
        goto __pyx_L9;
      }
      __pyx_L9:;
      goto __pyx_L8;
    }
    /*exception exit:*/{
      __pyx_L7_error:;
      __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_18);
      __pyx_t_13 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename;
      {

        /* "cassandra/cluster.py":1607
 *             result = future.result()
 *         finally:
 *             if trace:             # <<<<<<<<<<<<<<
 *                 try:
 *                     query.trace = future.get_query_trace(self.max_trace_wait)
 */
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_trace); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
        if (__pyx_t_1) {

          /* "cassandra/cluster.py":1608
 *         finally:
 *             if trace:
 *                 try:             # <<<<<<<<<<<<<<
 *                     query.trace = future.get_query_trace(self.max_trace_wait)
 *                 except Exception:
 */
          {
            __Pyx_ExceptionSave(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
            __Pyx_XGOTREF(__pyx_t_19);
            __Pyx_XGOTREF(__pyx_t_20);
            __Pyx_XGOTREF(__pyx_t_21);
            /*try:*/ {

              /* "cassandra/cluster.py":1609
 *             if trace:
 *                 try:
 *                     query.trace = future.get_query_trace(self.max_trace_wait)             # <<<<<<<<<<<<<<
 *                 except Exception:
 *                     log.exception("Unable to fetch query trace:")
 */
              __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_get_query_trace); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L23_error;}
              __Pyx_GOTREF(__pyx_t_5);
              __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_trace_wait); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L23_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_8 = NULL;
              if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
                __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
                if (likely(__pyx_t_8)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
                  __Pyx_INCREF(__pyx_t_8);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_5, function);
                }
              }
              if (!__pyx_t_8) {
                __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L23_error;}
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                __Pyx_GOTREF(__pyx_t_12);
              } else {
                __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L23_error;}
                __Pyx_GOTREF(__pyx_t_6);
                __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
                __Pyx_GIVEREF(__pyx_t_3);
                PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
                __pyx_t_3 = 0;
                __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L23_error;}
                __Pyx_GOTREF(__pyx_t_12);
                __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              }
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              if (__Pyx_PyObject_SetAttrStr(__pyx_v_query, __pyx_n_s_trace, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L23_error;}
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            }
            __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
            __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
            __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
            goto __pyx_L30_try_end;
            __pyx_L23_error:;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;

            /* "cassandra/cluster.py":1610
 *                 try:
 *                     query.trace = future.get_query_trace(self.max_trace_wait)
 *                 except Exception:             # <<<<<<<<<<<<<<
 *                     log.exception("Unable to fetch query trace:")
 * 
 */
            __pyx_t_22 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
            if (__pyx_t_22) {
              __Pyx_AddTraceback("cassandra.cluster.Session.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1610; __pyx_clineno = __LINE__; goto __pyx_L25_except_error;}
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_GOTREF(__pyx_t_6);

              /* "cassandra/cluster.py":1611
 *                     query.trace = future.get_query_trace(self.max_trace_wait)
 *                 except Exception:
 *                     log.exception("Unable to fetch query trace:")             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
              __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L25_except_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exception); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L25_except_error;}
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L25_except_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              goto __pyx_L24_exception_handled;
            }
            goto __pyx_L25_except_error;
            __pyx_L25_except_error:;
            __Pyx_XGIVEREF(__pyx_t_19);
            __Pyx_XGIVEREF(__pyx_t_20);
            __Pyx_XGIVEREF(__pyx_t_21);
            __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
            goto __pyx_L21_error;
            __pyx_L24_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_19);
            __Pyx_XGIVEREF(__pyx_t_20);
            __Pyx_XGIVEREF(__pyx_t_21);
            __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
            __pyx_L30_try_end:;
          }
          goto __pyx_L22;
        }
        __pyx_L22:;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
      __pyx_lineno = __pyx_t_13; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15;
      goto __pyx_L1_error;
      __pyx_L21_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L8:;
  }

  /* "cassandra/cluster.py":1613
 *                     log.exception("Unable to fetch query trace:")
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def execute_async(self, query, parameters=None, trace=False, custom_payload=None, timeout=_NOT_SET):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "cassandra/cluster.py":1565
 *             future.result()
 * 
 *     def execute(self, query, parameters=None, timeout=_NOT_SET, trace=False, custom_payload=None):             # <<<<<<<<<<<<<<
 *         """
 *         Execute the given query and synchronously wait for the response.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("cassandra.cluster.Session.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_future);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1615
 *         return result
 * 
 *     def execute_async(self, query, parameters=None, trace=False, custom_payload=None, timeout=_NOT_SET):             # <<<<<<<<<<<<<<
 *         """
 *         Execute the given query and return a :class:`~.ResponseFuture` object
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_38__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__defaults__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_False));
  __Pyx_GIVEREF(((PyObject *)Py_False));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)Py_False));
  __Pyx_INCREF(((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)Py_None));
  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_timeout);
  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_timeout);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_timeout);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster.Session.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_5execute_async(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Session_4execute_async[] = "\n        Execute the given query and return a :class:`~.ResponseFuture` object\n        which callbacks may be attached to for asynchronous response\n        delivery.  You may also call :meth:`~.ResponseFuture.result()`\n        on the :class:`.ResponseFuture` to syncronously block for results at\n        any time.\n\n        If `trace` is set to :const:`True`, you may call\n        :meth:`.ResponseFuture.get_query_trace()` after the request\n        completes to retrieve a :class:`.QueryTrace` instance.\n\n        `custom_payload` is a :ref:`custom_payload` dict to be passed to the server.\n        If `query` is a Statement with its own custom_payload. The message payload\n        will be a union of the two, with the values specified here taking precedence.\n\n        If the server sends a custom payload in the response message,\n        the dict can be obtained following :meth:`.ResponseFuture.result` via\n        :attr:`.ResponseFuture.custom_payload`\n\n        Example usage::\n\n            >>> session = cluster.connect()\n            >>> future = session.execute_async(\"SELECT * FROM mycf\")\n\n            >>> def log_results(results):\n            ...     for row in results:\n            ...         log.info(\"Results: %s\", row)\n\n            >>> def log_error(exc):\n            >>>     log.error(\"Operation failed: %s\", exc)\n\n            >>> future.add_callbacks(log_results, log_error)\n\n        Async execution with blocking wait for results::\n\n            >>> future = session.execute_async(\"SELECT * FROM mycf\")\n            >>> # do other stuff...\n\n            >>> try:\n            ...     results = future.result()\n            ... except Exception:\n            ...     log.exception(\"Operation failed:\")\n\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_5execute_async = {"execute_async", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_5execute_async, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Session_4execute_async};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_5execute_async(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_query = 0;
  PyObject *__pyx_v_parameters = 0;
  PyObject *__pyx_v_trace = 0;
  PyObject *__pyx_v_custom_payload = 0;
  PyObject *__pyx_v_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("execute_async (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_query,&__pyx_n_s_parameters,&__pyx_n_s_trace,&__pyx_n_s_custom_payload,&__pyx_n_s_timeout,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    __pyx_defaults2 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self);
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_False));
    values[4] = ((PyObject *)((PyObject *)Py_None));
    values[5] = __pyx_dynamic_args->__pyx_arg_timeout;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("execute_async", 0, 2, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parameters);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_trace);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_custom_payload);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "execute_async") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_query = values[1];
    __pyx_v_parameters = values[2];
    __pyx_v_trace = values[3];
    __pyx_v_custom_payload = values[4];
    __pyx_v_timeout = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("execute_async", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session.execute_async", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_4execute_async(__pyx_self, __pyx_v_self, __pyx_v_query, __pyx_v_parameters, __pyx_v_trace, __pyx_v_custom_payload, __pyx_v_timeout);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_4execute_async(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query, PyObject *__pyx_v_parameters, PyObject *__pyx_v_trace, PyObject *__pyx_v_custom_payload, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_v_future = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("execute_async", 0);
  __Pyx_INCREF(__pyx_v_timeout);

  /* "cassandra/cluster.py":1660
 * 
 *         """
 *         if timeout is _NOT_SET:             # <<<<<<<<<<<<<<
 *             timeout = self.default_timeout
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOT_SET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_v_timeout == __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":1661
 *         """
 *         if timeout is _NOT_SET:
 *             timeout = self.default_timeout             # <<<<<<<<<<<<<<
 * 
 *         future = self._create_response_future(query, parameters, trace, custom_payload, timeout)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_default_timeout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":1663
 *             timeout = self.default_timeout
 * 
 *         future = self._create_response_future(query, parameters, trace, custom_payload, timeout)             # <<<<<<<<<<<<<<
 *         future._protocol_handler = self.client_protocol_handler
 *         future.send_request()
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_create_response_future); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(5+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_v_query);
  __Pyx_GIVEREF(__pyx_v_query);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_query);
  __Pyx_INCREF(__pyx_v_parameters);
  __Pyx_GIVEREF(__pyx_v_parameters);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_parameters);
  __Pyx_INCREF(__pyx_v_trace);
  __Pyx_GIVEREF(__pyx_v_trace);
  PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_trace);
  __Pyx_INCREF(__pyx_v_custom_payload);
  __Pyx_GIVEREF(__pyx_v_custom_payload);
  PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_6, __pyx_v_custom_payload);
  __Pyx_INCREF(__pyx_v_timeout);
  __Pyx_GIVEREF(__pyx_v_timeout);
  PyTuple_SET_ITEM(__pyx_t_7, 4+__pyx_t_6, __pyx_v_timeout);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_future = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1664
 * 
 *         future = self._create_response_future(query, parameters, trace, custom_payload, timeout)
 *         future._protocol_handler = self.client_protocol_handler             # <<<<<<<<<<<<<<
 *         future.send_request()
 *         return future
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_client_protocol_handler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_future, __pyx_n_s_protocol_handler, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1665
 *         future = self._create_response_future(query, parameters, trace, custom_payload, timeout)
 *         future._protocol_handler = self.client_protocol_handler
 *         future.send_request()             # <<<<<<<<<<<<<<
 *         return future
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_send_request); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_7) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1666
 *         future._protocol_handler = self.client_protocol_handler
 *         future.send_request()
 *         return future             # <<<<<<<<<<<<<<
 * 
 *     def _create_response_future(self, query, parameters, trace, custom_payload, timeout):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_future);
  __pyx_r = __pyx_v_future;
  goto __pyx_L0;

  /* "cassandra/cluster.py":1615
 *         return result
 * 
 *     def execute_async(self, query, parameters=None, trace=False, custom_payload=None, timeout=_NOT_SET):             # <<<<<<<<<<<<<<
 *         """
 *         Execute the given query and return a :class:`~.ResponseFuture` object
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.Session.execute_async", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_future);
  __Pyx_XDECREF(__pyx_v_timeout);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1668
 *         return future
 * 
 *     def _create_response_future(self, query, parameters, trace, custom_payload, timeout):             # <<<<<<<<<<<<<<
 *         """ Returns the ResponseFuture before calling send_request() on it """
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_7_create_response_future(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Session_6_create_response_future[] = " Returns the ResponseFuture before calling send_request() on it ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_7_create_response_future = {"_create_response_future", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_7_create_response_future, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Session_6_create_response_future};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_7_create_response_future(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_query = 0;
  PyObject *__pyx_v_parameters = 0;
  PyObject *__pyx_v_trace = 0;
  PyObject *__pyx_v_custom_payload = 0;
  PyObject *__pyx_v_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_create_response_future (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_query,&__pyx_n_s_parameters,&__pyx_n_s_trace,&__pyx_n_s_custom_payload,&__pyx_n_s_timeout,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_create_response_future", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parameters)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_create_response_future", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_trace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_create_response_future", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_custom_payload)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_create_response_future", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_create_response_future", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_create_response_future") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_self = values[0];
    __pyx_v_query = values[1];
    __pyx_v_parameters = values[2];
    __pyx_v_trace = values[3];
    __pyx_v_custom_payload = values[4];
    __pyx_v_timeout = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_create_response_future", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session._create_response_future", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_6_create_response_future(__pyx_self, __pyx_v_self, __pyx_v_query, __pyx_v_parameters, __pyx_v_trace, __pyx_v_custom_payload, __pyx_v_timeout);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_6_create_response_future(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query, PyObject *__pyx_v_parameters, PyObject *__pyx_v_trace, PyObject *__pyx_v_custom_payload, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_v_prepared_statement = NULL;
  PyObject *__pyx_v_cl = NULL;
  PyObject *__pyx_v_fetch_size = NULL;
  PyObject *__pyx_v_timestamp = NULL;
  PyObject *__pyx_v_query_string = NULL;
  PyObject *__pyx_v_message = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_create_response_future", 0);
  __Pyx_INCREF(__pyx_v_query);

  /* "cassandra/cluster.py":1671
 *         """ Returns the ResponseFuture before calling send_request() on it """
 * 
 *         prepared_statement = None             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(query, six.string_types):
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_prepared_statement = Py_None;

  /* "cassandra/cluster.py":1673
 *         prepared_statement = None
 * 
 *         if isinstance(query, six.string_types):             # <<<<<<<<<<<<<<
 *             query = SimpleStatement(query)
 *         elif isinstance(query, PreparedStatement):
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_six); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_string_types); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_query, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cassandra/cluster.py":1674
 * 
 *         if isinstance(query, six.string_types):
 *             query = SimpleStatement(query)             # <<<<<<<<<<<<<<
 *         elif isinstance(query, PreparedStatement):
 *             query = query.bind(parameters)
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_SimpleStatement); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_query); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_query);
      __Pyx_GIVEREF(__pyx_v_query);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_query);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_query, __pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }

  /* "cassandra/cluster.py":1675
 *         if isinstance(query, six.string_types):
 *             query = SimpleStatement(query)
 *         elif isinstance(query, PreparedStatement):             # <<<<<<<<<<<<<<
 *             query = query.bind(parameters)
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_PreparedStatement); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_IsInstance(__pyx_v_query, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":1676
 *             query = SimpleStatement(query)
 *         elif isinstance(query, PreparedStatement):
 *             query = query.bind(parameters)             # <<<<<<<<<<<<<<
 * 
 *         cl = query.consistency_level if query.consistency_level is not None else self.default_consistency_level
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_bind); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_parameters); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_v_parameters);
      __Pyx_GIVEREF(__pyx_v_parameters);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_parameters);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_query, __pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":1678
 *             query = query.bind(parameters)
 * 
 *         cl = query.consistency_level if query.consistency_level is not None else self.default_consistency_level             # <<<<<<<<<<<<<<
 *         fetch_size = query.fetch_size
 *         if fetch_size is FETCH_SIZE_UNSET and self._protocol_version >= 2:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_consistency_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((__pyx_t_3 != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_consistency_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_t_1;
    __pyx_t_1 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_default_consistency_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_v_cl = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1679
 * 
 *         cl = query.consistency_level if query.consistency_level is not None else self.default_consistency_level
 *         fetch_size = query.fetch_size             # <<<<<<<<<<<<<<
 *         if fetch_size is FETCH_SIZE_UNSET and self._protocol_version >= 2:
 *             fetch_size = self.default_fetch_size
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_fetch_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_fetch_size = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1680
 *         cl = query.consistency_level if query.consistency_level is not None else self.default_consistency_level
 *         fetch_size = query.fetch_size
 *         if fetch_size is FETCH_SIZE_UNSET and self._protocol_version >= 2:             # <<<<<<<<<<<<<<
 *             fetch_size = self.default_fetch_size
 *         elif self._protocol_version == 1:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_FETCH_SIZE_UNSET); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = (__pyx_v_fetch_size == __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = (__pyx_t_4 != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_3 = __pyx_t_7;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_2, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_7;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":1681
 *         fetch_size = query.fetch_size
 *         if fetch_size is FETCH_SIZE_UNSET and self._protocol_version >= 2:
 *             fetch_size = self.default_fetch_size             # <<<<<<<<<<<<<<
 *         elif self._protocol_version == 1:
 *             fetch_size = None
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_default_fetch_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_fetch_size, __pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L4;
  }

  /* "cassandra/cluster.py":1682
 *         if fetch_size is FETCH_SIZE_UNSET and self._protocol_version >= 2:
 *             fetch_size = self.default_fetch_size
 *         elif self._protocol_version == 1:             # <<<<<<<<<<<<<<
 *             fetch_size = None
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":1683
 *             fetch_size = self.default_fetch_size
 *         elif self._protocol_version == 1:
 *             fetch_size = None             # <<<<<<<<<<<<<<
 * 
 *         if self._protocol_version >= 3 and self.use_client_timestamp:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_fetch_size, Py_None);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cassandra/cluster.py":1685
 *             fetch_size = None
 * 
 *         if self._protocol_version >= 3 and self.use_client_timestamp:             # <<<<<<<<<<<<<<
 *             timestamp = int(time.time() * 1e6)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {
  } else {
    __pyx_t_3 = __pyx_t_7;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_use_client_timestamp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_7;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":1686
 * 
 *         if self._protocol_version >= 3 and self.use_client_timestamp:
 *             timestamp = int(time.time() * 1e6)             # <<<<<<<<<<<<<<
 *         else:
 *             timestamp = None
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_float_1e6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_timestamp = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "cassandra/cluster.py":1688
 *             timestamp = int(time.time() * 1e6)
 *         else:
 *             timestamp = None             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(query, SimpleStatement):
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_timestamp = Py_None;
  }
  __pyx_L7:;

  /* "cassandra/cluster.py":1690
 *             timestamp = None
 * 
 *         if isinstance(query, SimpleStatement):             # <<<<<<<<<<<<<<
 *             query_string = query.query_string
 *             if six.PY2 and isinstance(query_string, six.text_type):
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_SimpleStatement); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_query, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = (__pyx_t_3 != 0);
  if (__pyx_t_7) {

    /* "cassandra/cluster.py":1691
 * 
 *         if isinstance(query, SimpleStatement):
 *             query_string = query.query_string             # <<<<<<<<<<<<<<
 *             if six.PY2 and isinstance(query_string, six.text_type):
 *                 query_string = query_string.encode('utf-8')
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_query_string); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_query_string = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1692
 *         if isinstance(query, SimpleStatement):
 *             query_string = query.query_string
 *             if six.PY2 and isinstance(query_string, six.text_type):             # <<<<<<<<<<<<<<
 *                 query_string = query_string.encode('utf-8')
 *             if parameters:
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_six); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_PY2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_7 = __pyx_t_3;
      goto __pyx_L12_bool_binop_done;
    }
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_six); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_text_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_query_string, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = (__pyx_t_3 != 0);
    __pyx_t_7 = __pyx_t_4;
    __pyx_L12_bool_binop_done:;
    if (__pyx_t_7) {

      /* "cassandra/cluster.py":1693
 *             query_string = query.query_string
 *             if six.PY2 and isinstance(query_string, six.text_type):
 *                 query_string = query_string.encode('utf-8')             # <<<<<<<<<<<<<<
 *             if parameters:
 *                 query_string = bind_params(query_string, parameters, self.encoder)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_query_string, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_query_string, __pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "cassandra/cluster.py":1694
 *             if six.PY2 and isinstance(query_string, six.text_type):
 *                 query_string = query_string.encode('utf-8')
 *             if parameters:             # <<<<<<<<<<<<<<
 *                 query_string = bind_params(query_string, parameters, self.encoder)
 *             message = QueryMessage(
 */
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_parameters); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_7) {

      /* "cassandra/cluster.py":1695
 *                 query_string = query_string.encode('utf-8')
 *             if parameters:
 *                 query_string = bind_params(query_string, parameters, self.encoder)             # <<<<<<<<<<<<<<
 *             message = QueryMessage(
 *                 query_string, cl, query.serial_consistency_level,
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_bind_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoder); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_8 = 1;
        }
      }
      __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_v_query_string);
      __Pyx_GIVEREF(__pyx_v_query_string);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_query_string);
      __Pyx_INCREF(__pyx_v_parameters);
      __Pyx_GIVEREF(__pyx_v_parameters);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_parameters);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_query_string, __pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "cassandra/cluster.py":1696
 *             if parameters:
 *                 query_string = bind_params(query_string, parameters, self.encoder)
 *             message = QueryMessage(             # <<<<<<<<<<<<<<
 *                 query_string, cl, query.serial_consistency_level,
 *                 fetch_size, timestamp=timestamp)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);

    /* "cassandra/cluster.py":1697
 *                 query_string = bind_params(query_string, parameters, self.encoder)
 *             message = QueryMessage(
 *                 query_string, cl, query.serial_consistency_level,             # <<<<<<<<<<<<<<
 *                 fetch_size, timestamp=timestamp)
 *         elif isinstance(query, BoundStatement):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_serial_consistency_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "cassandra/cluster.py":1696
 *             if parameters:
 *                 query_string = bind_params(query_string, parameters, self.encoder)
 *             message = QueryMessage(             # <<<<<<<<<<<<<<
 *                 query_string, cl, query.serial_consistency_level,
 *                 fetch_size, timestamp=timestamp)
 */
    __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_v_query_string);
    __Pyx_GIVEREF(__pyx_v_query_string);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_query_string);
    __Pyx_INCREF(__pyx_v_cl);
    __Pyx_GIVEREF(__pyx_v_cl);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_cl);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_fetch_size);
    __Pyx_GIVEREF(__pyx_v_fetch_size);
    PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_v_fetch_size);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "cassandra/cluster.py":1698
 *             message = QueryMessage(
 *                 query_string, cl, query.serial_consistency_level,
 *                 fetch_size, timestamp=timestamp)             # <<<<<<<<<<<<<<
 *         elif isinstance(query, BoundStatement):
 *             message = ExecuteMessage(
 */
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_timestamp, __pyx_v_timestamp) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "cassandra/cluster.py":1696
 *             if parameters:
 *                 query_string = bind_params(query_string, parameters, self.encoder)
 *             message = QueryMessage(             # <<<<<<<<<<<<<<
 *                 query_string, cl, query.serial_consistency_level,
 *                 fetch_size, timestamp=timestamp)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_message = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L10;
  }

  /* "cassandra/cluster.py":1699
 *                 query_string, cl, query.serial_consistency_level,
 *                 fetch_size, timestamp=timestamp)
 *         elif isinstance(query, BoundStatement):             # <<<<<<<<<<<<<<
 *             message = ExecuteMessage(
 *                 query.prepared_statement.query_id, query.values, cl,
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_BoundStatement); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyObject_IsInstance(__pyx_v_query, __pyx_t_2); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_7 != 0);
  if (__pyx_t_4) {

    /* "cassandra/cluster.py":1700
 *                 fetch_size, timestamp=timestamp)
 *         elif isinstance(query, BoundStatement):
 *             message = ExecuteMessage(             # <<<<<<<<<<<<<<
 *                 query.prepared_statement.query_id, query.values, cl,
 *                 query.serial_consistency_level, fetch_size,
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ExecuteMessage); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "cassandra/cluster.py":1701
 *         elif isinstance(query, BoundStatement):
 *             message = ExecuteMessage(
 *                 query.prepared_statement.query_id, query.values, cl,             # <<<<<<<<<<<<<<
 *                 query.serial_consistency_level, fetch_size,
 *                 timestamp=timestamp)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_prepared_statement); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_query_id); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "cassandra/cluster.py":1702
 *             message = ExecuteMessage(
 *                 query.prepared_statement.query_id, query.values, cl,
 *                 query.serial_consistency_level, fetch_size,             # <<<<<<<<<<<<<<
 *                 timestamp=timestamp)
 *             prepared_statement = query.prepared_statement
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_serial_consistency_level); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);

    /* "cassandra/cluster.py":1700
 *                 fetch_size, timestamp=timestamp)
 *         elif isinstance(query, BoundStatement):
 *             message = ExecuteMessage(             # <<<<<<<<<<<<<<
 *                 query.prepared_statement.query_id, query.values, cl,
 *                 query.serial_consistency_level, fetch_size,
 */
    __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_cl);
    __Pyx_GIVEREF(__pyx_v_cl);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_cl);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_fetch_size);
    __Pyx_GIVEREF(__pyx_v_fetch_size);
    PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_v_fetch_size);
    __pyx_t_9 = 0;
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);

    /* "cassandra/cluster.py":1703
 *                 query.prepared_statement.query_id, query.values, cl,
 *                 query.serial_consistency_level, fetch_size,
 *                 timestamp=timestamp)             # <<<<<<<<<<<<<<
 *             prepared_statement = query.prepared_statement
 *         elif isinstance(query, BatchStatement):
 */
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_timestamp, __pyx_v_timestamp) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "cassandra/cluster.py":1700
 *                 fetch_size, timestamp=timestamp)
 *         elif isinstance(query, BoundStatement):
 *             message = ExecuteMessage(             # <<<<<<<<<<<<<<
 *                 query.prepared_statement.query_id, query.values, cl,
 *                 query.serial_consistency_level, fetch_size,
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_message = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1704
 *                 query.serial_consistency_level, fetch_size,
 *                 timestamp=timestamp)
 *             prepared_statement = query.prepared_statement             # <<<<<<<<<<<<<<
 *         elif isinstance(query, BatchStatement):
 *             if self._protocol_version < 2:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_prepared_statement); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_prepared_statement, __pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L10;
  }

  /* "cassandra/cluster.py":1705
 *                 timestamp=timestamp)
 *             prepared_statement = query.prepared_statement
 *         elif isinstance(query, BatchStatement):             # <<<<<<<<<<<<<<
 *             if self._protocol_version < 2:
 *                 raise UnsupportedOperation(
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_BatchStatement); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_IsInstance(__pyx_v_query, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = (__pyx_t_4 != 0);
  if (__pyx_t_7) {

    /* "cassandra/cluster.py":1706
 *             prepared_statement = query.prepared_statement
 *         elif isinstance(query, BatchStatement):
 *             if self._protocol_version < 2:             # <<<<<<<<<<<<<<
 *                 raise UnsupportedOperation(
 *                     "BatchStatement execution is only supported with protocol version "
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_int_2, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_7) {

      /* "cassandra/cluster.py":1707
 *         elif isinstance(query, BatchStatement):
 *             if self._protocol_version < 2:
 *                 raise UnsupportedOperation(             # <<<<<<<<<<<<<<
 *                     "BatchStatement execution is only supported with protocol version "
 *                     "2 or higher (supported in Cassandra 2.0 and higher).  Consider "
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_UnsupportedOperation); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cassandra/cluster.py":1711
 *                     "2 or higher (supported in Cassandra 2.0 and higher).  Consider "
 *                     "setting Cluster.protocol_version to 2 to support this operation.")
 *             message = BatchMessage(             # <<<<<<<<<<<<<<
 *                 query.batch_type, query._statements_and_parameters, cl,
 *                 query.serial_consistency_level, timestamp)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_BatchMessage); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);

    /* "cassandra/cluster.py":1712
 *                     "setting Cluster.protocol_version to 2 to support this operation.")
 *             message = BatchMessage(
 *                 query.batch_type, query._statements_and_parameters, cl,             # <<<<<<<<<<<<<<
 *                 query.serial_consistency_level, timestamp)
 * 
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_batch_type); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_statements_and_parameters); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "cassandra/cluster.py":1713
 *             message = BatchMessage(
 *                 query.batch_type, query._statements_and_parameters, cl,
 *                 query.serial_consistency_level, timestamp)             # <<<<<<<<<<<<<<
 * 
 *         if trace:
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_serial_consistency_level); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_8 = 1;
      }
    }
    __pyx_t_11 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_10) {
      __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_8, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_8, __pyx_t_2);
    __Pyx_INCREF(__pyx_v_cl);
    __Pyx_GIVEREF(__pyx_v_cl);
    PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_8, __pyx_v_cl);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_8, __pyx_t_9);
    __Pyx_INCREF(__pyx_v_timestamp);
    __Pyx_GIVEREF(__pyx_v_timestamp);
    PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_8, __pyx_v_timestamp);
    __pyx_t_6 = 0;
    __pyx_t_2 = 0;
    __pyx_t_9 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_message = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "cassandra/cluster.py":1715
 *                 query.serial_consistency_level, timestamp)
 * 
 *         if trace:             # <<<<<<<<<<<<<<
 *             message.tracing = True
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_trace); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_7) {

    /* "cassandra/cluster.py":1716
 * 
 *         if trace:
 *             message.tracing = True             # <<<<<<<<<<<<<<
 * 
 *         message.update_custom_payload(query.custom_payload)
 */
    if (unlikely(!__pyx_v_message)) { __Pyx_RaiseUnboundLocalError("message"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_message, __pyx_n_s_tracing, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L16;
  }
  __pyx_L16:;

  /* "cassandra/cluster.py":1718
 *             message.tracing = True
 * 
 *         message.update_custom_payload(query.custom_payload)             # <<<<<<<<<<<<<<
 *         message.update_custom_payload(custom_payload)
 * 
 */
  if (unlikely(!__pyx_v_message)) { __Pyx_RaiseUnboundLocalError("message"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_message, __pyx_n_s_update_custom_payload); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_custom_payload); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_9 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_9) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); __pyx_t_9 = NULL;
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_11);
    __pyx_t_11 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1719
 * 
 *         message.update_custom_payload(query.custom_payload)
 *         message.update_custom_payload(custom_payload)             # <<<<<<<<<<<<<<
 * 
 *         return ResponseFuture(
 */
  if (unlikely(!__pyx_v_message)) { __Pyx_RaiseUnboundLocalError("message"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_message, __pyx_n_s_update_custom_payload); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_custom_payload); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_custom_payload);
    __Pyx_GIVEREF(__pyx_v_custom_payload);
    PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_custom_payload);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1721
 *         message.update_custom_payload(custom_payload)
 * 
 *         return ResponseFuture(             # <<<<<<<<<<<<<<
 *             self, message, query, timeout, metrics=self._metrics,
 *             prepared_statement=prepared_statement)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ResponseFuture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "cassandra/cluster.py":1722
 * 
 *         return ResponseFuture(
 *             self, message, query, timeout, metrics=self._metrics,             # <<<<<<<<<<<<<<
 *             prepared_statement=prepared_statement)
 * 
 */
  if (unlikely(!__pyx_v_message)) { __Pyx_RaiseUnboundLocalError("message"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }

  /* "cassandra/cluster.py":1721
 *         message.update_custom_payload(custom_payload)
 * 
 *         return ResponseFuture(             # <<<<<<<<<<<<<<
 *             self, message, query, timeout, metrics=self._metrics,
 *             prepared_statement=prepared_statement)
 */
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
  __Pyx_INCREF(__pyx_v_message);
  __Pyx_GIVEREF(__pyx_v_message);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_message);
  __Pyx_INCREF(__pyx_v_query);
  __Pyx_GIVEREF(__pyx_v_query);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_query);
  __Pyx_INCREF(__pyx_v_timeout);
  __Pyx_GIVEREF(__pyx_v_timeout);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_timeout);
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);

  /* "cassandra/cluster.py":1722
 * 
 *         return ResponseFuture(
 *             self, message, query, timeout, metrics=self._metrics,             # <<<<<<<<<<<<<<
 *             prepared_statement=prepared_statement)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_metrics, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1723
 *         return ResponseFuture(
 *             self, message, query, timeout, metrics=self._metrics,
 *             prepared_statement=prepared_statement)             # <<<<<<<<<<<<<<
 * 
 *     def prepare(self, query, custom_payload=None):
 */
  if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_prepared_statement, __pyx_v_prepared_statement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1721
 *         message.update_custom_payload(custom_payload)
 * 
 *         return ResponseFuture(             # <<<<<<<<<<<<<<
 *             self, message, query, timeout, metrics=self._metrics,
 *             prepared_statement=prepared_statement)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":1668
 *         return future
 * 
 *     def _create_response_future(self, query, parameters, trace, custom_payload, timeout):             # <<<<<<<<<<<<<<
 *         """ Returns the ResponseFuture before calling send_request() on it """
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("cassandra.cluster.Session._create_response_future", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prepared_statement);
  __Pyx_XDECREF(__pyx_v_cl);
  __Pyx_XDECREF(__pyx_v_fetch_size);
  __Pyx_XDECREF(__pyx_v_timestamp);
  __Pyx_XDECREF(__pyx_v_query_string);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF(__pyx_v_query);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1725
 *             prepared_statement=prepared_statement)
 * 
 *     def prepare(self, query, custom_payload=None):             # <<<<<<<<<<<<<<
 *         """
 *         Prepares a query string, returning a :class:`~cassandra.query.PreparedStatement`
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_9prepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Session_8prepare[] = "\n        Prepares a query string, returning a :class:`~cassandra.query.PreparedStatement`\n        instance which can be used as follows::\n\n            >>> session = cluster.connect(\"mykeyspace\")\n            >>> query = \"INSERT INTO users (id, name, age) VALUES (?, ?, ?)\"\n            >>> prepared = session.prepare(query)\n            >>> session.execute(prepared, (user.id, user.name, user.age))\n\n        Or you may bind values to the prepared statement ahead of time::\n\n            >>> prepared = session.prepare(query)\n            >>> bound_stmt = prepared.bind((user.id, user.name, user.age))\n            >>> session.execute(bound_stmt)\n\n        Of course, prepared statements may (and should) be reused::\n\n            >>> prepared = session.prepare(query)\n            >>> for user in users:\n            ...     bound = prepared.bind((user.id, user.name, user.age))\n            ...     session.execute(bound)\n\n        **Important**: PreparedStatements should be prepared only once.\n        Preparing the same query more than once will likely affect performance.\n\n        `custom_payload` is a key value map to be passed along with the prepare\n        message. See :ref:`custom_payload`.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_9prepare = {"prepare", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_9prepare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Session_8prepare};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_9prepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_query = 0;
  CYTHON_UNUSED PyObject *__pyx_v_custom_payload = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prepare (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_query,&__pyx_n_s_custom_payload,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("prepare", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_custom_payload);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prepare") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_query = values[1];
    __pyx_v_custom_payload = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("prepare", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_8prepare(__pyx_self, __pyx_v_self, __pyx_v_query, __pyx_v_custom_payload);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_8prepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query, CYTHON_UNUSED PyObject *__pyx_v_custom_payload) {
  PyObject *__pyx_v_message = NULL;
  PyObject *__pyx_v_future = NULL;
  PyObject *__pyx_v_query_id = NULL;
  PyObject *__pyx_v_column_metadata = NULL;
  PyObject *__pyx_v_pk_indexes = NULL;
  PyObject *__pyx_v_prepared_statement = NULL;
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prepare", 0);

  /* "cassandra/cluster.py":1754
 *         message. See :ref:`custom_payload`.
 *         """
 *         message = PrepareMessage(query=query)             # <<<<<<<<<<<<<<
 *         future = ResponseFuture(self, message, query=None, timeout=self.default_timeout)
 *         try:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_PrepareMessage); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_query, __pyx_v_query) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_message = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cassandra/cluster.py":1755
 *         """
 *         message = PrepareMessage(query=query)
 *         future = ResponseFuture(self, message, query=None, timeout=self.default_timeout)             # <<<<<<<<<<<<<<
 *         try:
 *             future.send_request()
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ResponseFuture); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_INCREF(__pyx_v_message);
  __Pyx_GIVEREF(__pyx_v_message);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_message);
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_query, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_default_timeout); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_timeout, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_future = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cassandra/cluster.py":1756
 *         message = PrepareMessage(query=query)
 *         future = ResponseFuture(self, message, query=None, timeout=self.default_timeout)
 *         try:             # <<<<<<<<<<<<<<
 *             future.send_request()
 *             query_id, column_metadata, pk_indexes = future.result()
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    /*try:*/ {

      /* "cassandra/cluster.py":1757
 *         future = ResponseFuture(self, message, query=None, timeout=self.default_timeout)
 *         try:
 *             future.send_request()             # <<<<<<<<<<<<<<
 *             query_id, column_metadata, pk_indexes = future.result()
 *         except Exception:
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_send_request); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (__pyx_t_2) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cassandra/cluster.py":1758
 *         try:
 *             future.send_request()
 *             query_id, column_metadata, pk_indexes = future.result()             # <<<<<<<<<<<<<<
 *         except Exception:
 *             log.exception("Error preparing query:")
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (__pyx_t_2) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
        PyObject* sequence = __pyx_t_4;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_3 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
        index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_1);
        index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 2; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __pyx_t_9 = NULL;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __pyx_L12_unpacking_done:;
      }
      __pyx_v_query_id = __pyx_t_1;
      __pyx_t_1 = 0;
      __pyx_v_column_metadata = __pyx_t_2;
      __pyx_t_2 = 0;
      __pyx_v_pk_indexes = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":1759
 *             future.send_request()
 *             query_id, column_metadata, pk_indexes = future.result()
 *         except Exception:             # <<<<<<<<<<<<<<
 *             log.exception("Error preparing query:")
 *             raise
 */
    __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_10) {
      __Pyx_AddTraceback("cassandra.cluster.Session.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);

      /* "cassandra/cluster.py":1760
 *             query_id, column_metadata, pk_indexes = future.result()
 *         except Exception:
 *             log.exception("Error preparing query:")             # <<<<<<<<<<<<<<
 *             raise
 * 
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_exception); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "cassandra/cluster.py":1761
 *         except Exception:
 *             log.exception("Error preparing query:")
 *             raise             # <<<<<<<<<<<<<<
 * 
 *         prepared_statement = PreparedStatement.from_message(
 */
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; 
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1761; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L10_try_end:;
  }

  /* "cassandra/cluster.py":1763
 *             raise
 * 
 *         prepared_statement = PreparedStatement.from_message(             # <<<<<<<<<<<<<<
 *             query_id, column_metadata, pk_indexes, self.cluster.metadata, query, self.keyspace,
 *             self._protocol_version)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_PreparedStatement); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_from_message); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":1764
 * 
 *         prepared_statement = PreparedStatement.from_message(
 *             query_id, column_metadata, pk_indexes, self.cluster.metadata, query, self.keyspace,             # <<<<<<<<<<<<<<
 *             self._protocol_version)
 *         prepared_statement.custom_payload = future.custom_payload
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_metadata); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_keyspace); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "cassandra/cluster.py":1765
 *         prepared_statement = PreparedStatement.from_message(
 *             query_id, column_metadata, pk_indexes, self.cluster.metadata, query, self.keyspace,
 *             self._protocol_version)             # <<<<<<<<<<<<<<
 *         prepared_statement.custom_payload = future.custom_payload
 * 
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_11 = NULL;
  __pyx_t_12 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_12 = 1;
    }
  }
  __pyx_t_13 = PyTuple_New(7+__pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  if (__pyx_t_11) {
    __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
  }
  __Pyx_INCREF(__pyx_v_query_id);
  __Pyx_GIVEREF(__pyx_v_query_id);
  PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_v_query_id);
  __Pyx_INCREF(__pyx_v_column_metadata);
  __Pyx_GIVEREF(__pyx_v_column_metadata);
  PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_v_column_metadata);
  __Pyx_INCREF(__pyx_v_pk_indexes);
  __Pyx_GIVEREF(__pyx_v_pk_indexes);
  PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_12, __pyx_v_pk_indexes);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_13, 3+__pyx_t_12, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_query);
  __Pyx_GIVEREF(__pyx_v_query);
  PyTuple_SET_ITEM(__pyx_t_13, 4+__pyx_t_12, __pyx_v_query);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_13, 5+__pyx_t_12, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_13, 6+__pyx_t_12, __pyx_t_8);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_8 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_prepared_statement = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1766
 *             query_id, column_metadata, pk_indexes, self.cluster.metadata, query, self.keyspace,
 *             self._protocol_version)
 *         prepared_statement.custom_payload = future.custom_payload             # <<<<<<<<<<<<<<
 * 
 *         host = future._current_host
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_custom_payload); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_prepared_statement, __pyx_n_s_custom_payload, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1768
 *         prepared_statement.custom_payload = future.custom_payload
 * 
 *         host = future._current_host             # <<<<<<<<<<<<<<
 *         try:
 *             self.cluster.prepare_on_all_sessions(query_id, prepared_statement, host)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_current_host); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_host = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1769
 * 
 *         host = future._current_host
 *         try:             # <<<<<<<<<<<<<<
 *             self.cluster.prepare_on_all_sessions(query_id, prepared_statement, host)
 *         except Exception:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "cassandra/cluster.py":1770
 *         host = future._current_host
 *         try:
 *             self.cluster.prepare_on_all_sessions(query_id, prepared_statement, host)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             log.exception("Error preparing query on all hosts:")
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_prepare_on_all_sessions); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      __pyx_t_12 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_13))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_13);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_13, function);
          __pyx_t_12 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_query_id);
      __Pyx_GIVEREF(__pyx_v_query_id);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_12, __pyx_v_query_id);
      __Pyx_INCREF(__pyx_v_prepared_statement);
      __Pyx_GIVEREF(__pyx_v_prepared_statement);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_12, __pyx_v_prepared_statement);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_12, __pyx_v_host);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L22_try_end;
    __pyx_L15_error:;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cassandra/cluster.py":1771
 *         try:
 *             self.cluster.prepare_on_all_sessions(query_id, prepared_statement, host)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             log.exception("Error preparing query on all hosts:")
 * 
 */
    __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_10) {
      __Pyx_AddTraceback("cassandra.cluster.Session.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_13, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_GOTREF(__pyx_t_8);

      /* "cassandra/cluster.py":1772
 *             self.cluster.prepare_on_all_sessions(query_id, prepared_statement, host)
 *         except Exception:
 *             log.exception("Error preparing query on all hosts:")             # <<<<<<<<<<<<<<
 * 
 *         return prepared_statement
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exception); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__60, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L16_exception_handled;
    }
    goto __pyx_L17_except_error;
    __pyx_L17_except_error:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L16_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_5);
    __pyx_L22_try_end:;
  }

  /* "cassandra/cluster.py":1774
 *             log.exception("Error preparing query on all hosts:")
 * 
 *         return prepared_statement             # <<<<<<<<<<<<<<
 * 
 *     def prepare_on_all_hosts(self, query, excluded_host):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_prepared_statement);
  __pyx_r = __pyx_v_prepared_statement;
  goto __pyx_L0;

  /* "cassandra/cluster.py":1725
 *             prepared_statement=prepared_statement)
 * 
 *     def prepare(self, query, custom_payload=None):             # <<<<<<<<<<<<<<
 *         """
 *         Prepares a query string, returning a :class:`~cassandra.query.PreparedStatement`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("cassandra.cluster.Session.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF(__pyx_v_future);
  __Pyx_XDECREF(__pyx_v_query_id);
  __Pyx_XDECREF(__pyx_v_column_metadata);
  __Pyx_XDECREF(__pyx_v_pk_indexes);
  __Pyx_XDECREF(__pyx_v_prepared_statement);
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1776
 *         return prepared_statement
 * 
 *     def prepare_on_all_hosts(self, query, excluded_host):             # <<<<<<<<<<<<<<
 *         """
 *         Prepare the given query on all hosts, excluding ``excluded_host``.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_11prepare_on_all_hosts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Session_10prepare_on_all_hosts[] = "\n        Prepare the given query on all hosts, excluding ``excluded_host``.\n        Intended for internal use only.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_11prepare_on_all_hosts = {"prepare_on_all_hosts", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_11prepare_on_all_hosts, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Session_10prepare_on_all_hosts};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_11prepare_on_all_hosts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_query = 0;
  PyObject *__pyx_v_excluded_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prepare_on_all_hosts (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_query,&__pyx_n_s_excluded_host,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("prepare_on_all_hosts", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_excluded_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("prepare_on_all_hosts", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prepare_on_all_hosts") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_query = values[1];
    __pyx_v_excluded_host = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("prepare_on_all_hosts", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session.prepare_on_all_hosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_10prepare_on_all_hosts(__pyx_self, __pyx_v_self, __pyx_v_query, __pyx_v_excluded_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_10prepare_on_all_hosts(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_query, PyObject *__pyx_v_excluded_host) {
  PyObject *__pyx_v_futures = NULL;
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_future = NULL;
  PyObject *__pyx_v_request_id = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_t_18;
  PyObject *(*__pyx_t_19)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prepare_on_all_hosts", 0);

  /* "cassandra/cluster.py":1781
 *         Intended for internal use only.
 *         """
 *         futures = []             # <<<<<<<<<<<<<<
 *         for host in self._pools.keys():
 *             if host != excluded_host and host.is_up:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_futures = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1782
 *         """
 *         futures = []
 *         for host in self._pools.keys():             # <<<<<<<<<<<<<<
 *             if host != excluded_host and host.is_up:
 *                 future = ResponseFuture(self, PrepareMessage(query=query), None, self.default_timeout)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pools); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_keys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_3);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_host, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1783
 *         futures = []
 *         for host in self._pools.keys():
 *             if host != excluded_host and host.is_up:             # <<<<<<<<<<<<<<
 *                 future = ResponseFuture(self, PrepareMessage(query=query), None, self.default_timeout)
 * 
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_host, __pyx_v_excluded_host, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_is_up); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __pyx_t_7;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_6) {

      /* "cassandra/cluster.py":1784
 *         for host in self._pools.keys():
 *             if host != excluded_host and host.is_up:
 *                 future = ResponseFuture(self, PrepareMessage(query=query), None, self.default_timeout)             # <<<<<<<<<<<<<<
 * 
 *                 # we don't care about errors preparing against specific hosts,
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ResponseFuture); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_PrepareMessage); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_query, __pyx_v_query) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_default_timeout); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_11 = 1;
        }
      }
      __pyx_t_12 = PyTuple_New(4+__pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_INCREF(__pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_v_self);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_10);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, Py_None);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_11, __pyx_t_9);
      __pyx_t_10 = 0;
      __pyx_t_9 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_future, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "cassandra/cluster.py":1789
 *                 # since we can always prepare them as needed when the prepared
 *                 # statement is used.  Just log errors and continue on.
 *                 try:             # <<<<<<<<<<<<<<
 *                     request_id = future._query(host)
 *                 except Exception:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
        __Pyx_XGOTREF(__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_14);
        __Pyx_XGOTREF(__pyx_t_15);
        /*try:*/ {

          /* "cassandra/cluster.py":1790
 *                 # statement is used.  Just log errors and continue on.
 *                 try:
 *                     request_id = future._query(host)             # <<<<<<<<<<<<<<
 *                 except Exception:
 *                     log.exception("Error preparing query for host %s:", host)
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_query_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_12 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_12) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_1);
          } else {
            __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_12); __pyx_t_12 = NULL;
            __Pyx_INCREF(__pyx_v_host);
            __Pyx_GIVEREF(__pyx_v_host);
            PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_host);
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF_SET(__pyx_v_request_id, __pyx_t_1);
          __pyx_t_1 = 0;
        }
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        goto __pyx_L15_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":1791
 *                 try:
 *                     request_id = future._query(host)
 *                 except Exception:             # <<<<<<<<<<<<<<
 *                     log.exception("Error preparing query for host %s:", host)
 *                     continue
 */
        __pyx_t_16 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
        if (__pyx_t_16) {
          __Pyx_AddTraceback("cassandra.cluster.Session.prepare_on_all_hosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_9);

          /* "cassandra/cluster.py":1792
 *                     request_id = future._query(host)
 *                 except Exception:
 *                     log.exception("Error preparing query for host %s:", host)             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
          __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_exception); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_10 = NULL;
          __pyx_t_11 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
            __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
            if (likely(__pyx_t_10)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
              __Pyx_INCREF(__pyx_t_10);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_8, function);
              __pyx_t_11 = 1;
            }
          }
          __pyx_t_17 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_17);
          if (__pyx_t_10) {
            __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_10); __pyx_t_10 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_s_Error_preparing_query_for_host_s);
          __Pyx_GIVEREF(__pyx_kp_s_Error_preparing_query_for_host_s);
          PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_11, __pyx_kp_s_Error_preparing_query_for_host_s);
          __Pyx_INCREF(__pyx_v_host);
          __Pyx_GIVEREF(__pyx_v_host);
          PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_11, __pyx_v_host);
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_17, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "cassandra/cluster.py":1793
 *                 except Exception:
 *                     log.exception("Error preparing query for host %s:", host)
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 if request_id is None:
 */
          goto __pyx_L17_except_continue;
          __pyx_L17_except_continue:;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L14_try_continue;
        }
        goto __pyx_L10_except_error;
        __pyx_L10_except_error:;
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
        goto __pyx_L1_error;
        __pyx_L14_try_continue:;
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
        goto __pyx_L3_continue;
        __pyx_L15_try_end:;
      }

      /* "cassandra/cluster.py":1795
 *                     continue
 * 
 *                 if request_id is None:             # <<<<<<<<<<<<<<
 *                     # the error has already been logged by ResponsFuture
 *                     log.debug("Failed to prepare query for host %s: %r",
 */
      __pyx_t_6 = (__pyx_v_request_id == Py_None);
      __pyx_t_7 = (__pyx_t_6 != 0);
      if (__pyx_t_7) {

        /* "cassandra/cluster.py":1797
 *                 if request_id is None:
 *                     # the error has already been logged by ResponsFuture
 *                     log.debug("Failed to prepare query for host %s: %r",             # <<<<<<<<<<<<<<
 *                               host, future._errors.get(host))
 *                     continue
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "cassandra/cluster.py":1798
 *                     # the error has already been logged by ResponsFuture
 *                     log.debug("Failed to prepare query for host %s: %r",
 *                               host, future._errors.get(host))             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_errors_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_get); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (!__pyx_t_12) {
          __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_host); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
        } else {
          __pyx_t_17 = PyTuple_New(1+1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_12); __pyx_t_12 = NULL;
          __Pyx_INCREF(__pyx_v_host);
          __Pyx_GIVEREF(__pyx_v_host);
          PyTuple_SET_ITEM(__pyx_t_17, 0+1, __pyx_v_host);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_17, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        __pyx_t_11 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
            __pyx_t_11 = 1;
          }
        }
        __pyx_t_17 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_17);
        if (__pyx_t_8) {
          __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_8); __pyx_t_8 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_s_Failed_to_prepare_query_for_host);
        __Pyx_GIVEREF(__pyx_kp_s_Failed_to_prepare_query_for_host);
        PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_11, __pyx_kp_s_Failed_to_prepare_query_for_host);
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_11, __pyx_v_host);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_11, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_17, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "cassandra/cluster.py":1799
 *                     log.debug("Failed to prepare query for host %s: %r",
 *                               host, future._errors.get(host))
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 futures.append((host, future))
 */
        goto __pyx_L3_continue;
      }

      /* "cassandra/cluster.py":1801
 *                     continue
 * 
 *                 futures.append((host, future))             # <<<<<<<<<<<<<<
 * 
 *         for host, future in futures:
 */
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_host);
      __Pyx_INCREF(__pyx_v_future);
      __Pyx_GIVEREF(__pyx_v_future);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_future);
      __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_futures, __pyx_t_9); if (unlikely(__pyx_t_18 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "cassandra/cluster.py":1782
 *         """
 *         futures = []
 *         for host in self._pools.keys():             # <<<<<<<<<<<<<<
 *             if host != excluded_host and host.is_up:
 *                 future = ResponseFuture(self, PrepareMessage(query=query), None, self.default_timeout)
 */
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":1803
 *                 futures.append((host, future))
 * 
 *         for host, future in futures:             # <<<<<<<<<<<<<<
 *             try:
 *                 future.result()
 */
  __pyx_t_3 = __pyx_v_futures; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
      PyObject* sequence = __pyx_t_9;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_17 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_17 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_17);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_17 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_17);
      #endif
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_2 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_19 = Py_TYPE(__pyx_t_2)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_19(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L21_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_17 = __pyx_t_19(__pyx_t_2); if (unlikely(!__pyx_t_17)) goto __pyx_L21_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_17);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_19(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_19 = NULL;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L22_unpacking_done;
      __pyx_L21_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_19 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L22_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_host, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_future, __pyx_t_17);
    __pyx_t_17 = 0;

    /* "cassandra/cluster.py":1804
 * 
 *         for host, future in futures:
 *             try:             # <<<<<<<<<<<<<<
 *                 future.result()
 *             except Exception:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_13);
      /*try:*/ {

        /* "cassandra/cluster.py":1805
 *         for host, future in futures:
 *             try:
 *                 future.result()             # <<<<<<<<<<<<<<
 *             except Exception:
 *                 log.exception("Error preparing query for host %s:", host)
 */
        __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_result); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __pyx_L23_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_1 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_17))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_17);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_17, function);
          }
        }
        if (__pyx_t_1) {
          __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_17, __pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __pyx_L23_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else {
          __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_17); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __pyx_L23_error;}
        }
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      goto __pyx_L30_try_end;
      __pyx_L23_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "cassandra/cluster.py":1806
 *             try:
 *                 future.result()
 *             except Exception:             # <<<<<<<<<<<<<<
 *                 log.exception("Error preparing query for host %s:", host)
 * 
 */
      __pyx_t_16 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
      if (__pyx_t_16) {
        __Pyx_AddTraceback("cassandra.cluster.Session.prepare_on_all_hosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_17, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L25_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_GOTREF(__pyx_t_1);

        /* "cassandra/cluster.py":1807
 *                 future.result()
 *             except Exception:
 *                 log.exception("Error preparing query for host %s:", host)             # <<<<<<<<<<<<<<
 * 
 *     def shutdown(self):
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1807; __pyx_clineno = __LINE__; goto __pyx_L25_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_exception); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1807; __pyx_clineno = __LINE__; goto __pyx_L25_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        __pyx_t_11 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
            __pyx_t_11 = 1;
          }
        }
        __pyx_t_10 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1807; __pyx_clineno = __LINE__; goto __pyx_L25_except_error;}
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_8) {
          __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_s_Error_preparing_query_for_host_s);
        __Pyx_GIVEREF(__pyx_kp_s_Error_preparing_query_for_host_s);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_11, __pyx_kp_s_Error_preparing_query_for_host_s);
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_11, __pyx_v_host);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1807; __pyx_clineno = __LINE__; goto __pyx_L25_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L24_exception_handled;
      }
      goto __pyx_L25_except_error;
      __pyx_L25_except_error:;
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_14, __pyx_t_13);
      goto __pyx_L1_error;
      __pyx_L24_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_14, __pyx_t_13);
      __pyx_L30_try_end:;
    }

    /* "cassandra/cluster.py":1803
 *                 futures.append((host, future))
 * 
 *         for host, future in futures:             # <<<<<<<<<<<<<<
 *             try:
 *                 future.result()
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":1776
 *         return prepared_statement
 * 
 *     def prepare_on_all_hosts(self, query, excluded_host):             # <<<<<<<<<<<<<<
 *         """
 *         Prepare the given query on all hosts, excluding ``excluded_host``.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("cassandra.cluster.Session.prepare_on_all_hosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_futures);
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_future);
  __Pyx_XDECREF(__pyx_v_request_id);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1809
 *                 log.exception("Error preparing query for host %s:", host)
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         """
 *         Close all connections.  ``Session`` instances should not be used
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_13shutdown(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Session_12shutdown[] = "\n        Close all connections.  ``Session`` instances should not be used\n        for any purpose after being shutdown.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_13shutdown = {"shutdown", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_13shutdown, METH_O, __pyx_doc_9cassandra_7cluster_7Session_12shutdown};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_13shutdown(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shutdown (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_12shutdown(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_12shutdown(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_pool = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shutdown", 0);

  /* "cassandra/cluster.py":1814
 *         for any purpose after being shutdown.
 *         """
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self.is_shutdown:
 *                 return
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cassandra/cluster.py":1815
 *         """
 *         with self._lock:
 *             if self.is_shutdown:             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_9) {

            /* "cassandra/cluster.py":1816
 *         with self._lock:
 *             if self.is_shutdown:
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 self.is_shutdown = True
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            goto __pyx_L11_try_return;
          }
          /*else*/ {

            /* "cassandra/cluster.py":1818
 *                 return
 *             else:
 *                 self.is_shutdown = True             # <<<<<<<<<<<<<<
 * 
 *         for pool in self._pools.values():
 */
            if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          }
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":1814
 *         for any purpose after being shutdown.
 *         """
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self.is_shutdown:
 *                 return
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.Session.shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (__pyx_t_9 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_11 = ((!(__pyx_t_9 != 0)) != 0);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_4);
            __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L4_return;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__61, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_8 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_2) {
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__62, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __pyx_r = __pyx_t_8;
        __pyx_t_8 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L19;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L19:;
  }

  /* "cassandra/cluster.py":1820
 *                 self.is_shutdown = True
 * 
 *         for pool in self._pools.values():             # <<<<<<<<<<<<<<
 *             pool.shutdown()
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0;
    __pyx_t_13 = NULL;
  } else {
    __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_13 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_13)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_13(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_pool, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":1821
 * 
 *         for pool in self._pools.values():
 *             pool.shutdown()             # <<<<<<<<<<<<<<
 * 
 *     def add_or_renew_pool(self, host, is_host_addition):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_shutdown); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":1820
 *                 self.is_shutdown = True
 * 
 *         for pool in self._pools.values():             # <<<<<<<<<<<<<<
 *             pool.shutdown()
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1809
 *                 log.exception("Error preparing query for host %s:", host)
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         """
 *         Close all connections.  ``Session`` instances should not be used
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.Session.shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pool);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1823
 *             pool.shutdown()
 * 
 *     def add_or_renew_pool(self, host, is_host_addition):             # <<<<<<<<<<<<<<
 *         """
 *         For internal use only.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_15add_or_renew_pool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Session_14add_or_renew_pool[] = "\n        For internal use only.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_15add_or_renew_pool = {"add_or_renew_pool", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_15add_or_renew_pool, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Session_14add_or_renew_pool};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_15add_or_renew_pool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_is_host_addition = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_or_renew_pool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,&__pyx_n_s_is_host_addition,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_or_renew_pool", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_is_host_addition)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_or_renew_pool", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_or_renew_pool") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
    __pyx_v_is_host_addition = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_or_renew_pool", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session.add_or_renew_pool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_14add_or_renew_pool(__pyx_self, __pyx_v_self, __pyx_v_host, __pyx_v_is_host_addition);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1831
 *             return None
 * 
 *         def run_add_or_renew_pool():             # <<<<<<<<<<<<<<
 *             try:
 *                 if self._protocol_version >= 3:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_17add_or_renew_pool_1run_add_or_renew_pool(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_17add_or_renew_pool_1run_add_or_renew_pool = {"run_add_or_renew_pool", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_17add_or_renew_pool_1run_add_or_renew_pool, METH_NOARGS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_17add_or_renew_pool_1run_add_or_renew_pool(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("run_add_or_renew_pool (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_17add_or_renew_pool_run_add_or_renew_pool(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_17add_or_renew_pool_run_add_or_renew_pool(PyObject *__pyx_self) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool *__pyx_cur_scope;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool *__pyx_outer_scope;
  PyObject *__pyx_v_new_pool = NULL;
  PyObject *__pyx_v_auth_exc = NULL;
  PyObject *__pyx_v_conn_exc = NULL;
  PyObject *__pyx_v_previous = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("run_add_or_renew_pool", 0);
  __pyx_outer_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "cassandra/cluster.py":1832
 * 
 *         def run_add_or_renew_pool():
 *             try:             # <<<<<<<<<<<<<<
 *                 if self._protocol_version >= 3:
 *                     new_pool = HostConnection(host, distance, self)
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cassandra/cluster.py":1833
 *         def run_add_or_renew_pool():
 *             try:
 *                 if self._protocol_version >= 3:             # <<<<<<<<<<<<<<
 *                     new_pool = HostConnection(host, distance, self)
 *                 else:
 */
      if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1833; __pyx_clineno = __LINE__; goto __pyx_L3_error;} }
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_protocol_version_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {

        /* "cassandra/cluster.py":1834
 *             try:
 *                 if self._protocol_version >= 3:
 *                     new_pool = HostConnection(host, distance, self)             # <<<<<<<<<<<<<<
 *                 else:
 *                     new_pool = HostConnectionPool(host, distance, self)
 */
        __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostConnection); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1834; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_4);
        if (unlikely(!__pyx_cur_scope->__pyx_v_host)) { __Pyx_RaiseClosureNameError("host"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1834; __pyx_clineno = __LINE__; goto __pyx_L3_error;} }
        if (unlikely(!__pyx_cur_scope->__pyx_v_distance)) { __Pyx_RaiseClosureNameError("distance"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1834; __pyx_clineno = __LINE__; goto __pyx_L3_error;} }
        if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1834; __pyx_clineno = __LINE__; goto __pyx_L3_error;} }
        __pyx_t_7 = NULL;
        __pyx_t_8 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_8 = 1;
          }
        }
        __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1834; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_cur_scope->__pyx_v_host);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_distance);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_distance);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_cur_scope->__pyx_v_distance);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
        PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_cur_scope->__pyx_v_self);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1834; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_v_new_pool = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "cassandra/cluster.py":1836
 *                     new_pool = HostConnection(host, distance, self)
 *                 else:
 *                     new_pool = HostConnectionPool(host, distance, self)             # <<<<<<<<<<<<<<
 *             except AuthenticationFailed as auth_exc:
 *                 conn_exc = ConnectionException(str(auth_exc), host=host)
 */
        __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostConnectionPool); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_4);
        if (unlikely(!__pyx_cur_scope->__pyx_v_host)) { __Pyx_RaiseClosureNameError("host"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L3_error;} }
        if (unlikely(!__pyx_cur_scope->__pyx_v_distance)) { __Pyx_RaiseClosureNameError("distance"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L3_error;} }
        if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L3_error;} }
        __pyx_t_9 = NULL;
        __pyx_t_8 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_8 = 1;
          }
        }
        __pyx_t_7 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_cur_scope->__pyx_v_host);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_distance);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_distance);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_cur_scope->__pyx_v_distance);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
        PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_cur_scope->__pyx_v_self);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_v_new_pool = __pyx_t_5;
        __pyx_t_5 = 0;
      }
      __pyx_L11:;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":1837
 *                 else:
 *                     new_pool = HostConnectionPool(host, distance, self)
 *             except AuthenticationFailed as auth_exc:             # <<<<<<<<<<<<<<
 *                 conn_exc = ConnectionException(str(auth_exc), host=host)
 *                 self.cluster.signal_connection_failure(host, conn_exc, is_host_addition)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_AuthenticationFailed); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1837; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = PyErr_ExceptionMatches(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_10) {
      __Pyx_AddTraceback("cassandra.cluster.Session.add_or_renew_pool.run_add_or_renew_pool", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1837; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_v_auth_exc = __pyx_t_4;

      /* "cassandra/cluster.py":1838
 *                     new_pool = HostConnectionPool(host, distance, self)
 *             except AuthenticationFailed as auth_exc:
 *                 conn_exc = ConnectionException(str(auth_exc), host=host)             # <<<<<<<<<<<<<<
 *                 self.cluster.signal_connection_failure(host, conn_exc, is_host_addition)
 *                 return False
 */
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConnectionException); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_v_auth_exc);
      __Pyx_GIVEREF(__pyx_v_auth_exc);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_auth_exc);
      __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_11, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
      __pyx_t_12 = 0;
      __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      if (unlikely(!__pyx_cur_scope->__pyx_v_host)) { __Pyx_RaiseClosureNameError("host"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} }
      if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_host, __pyx_cur_scope->__pyx_v_host) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_v_conn_exc = __pyx_t_13;
      __pyx_t_13 = 0;

      /* "cassandra/cluster.py":1839
 *             except AuthenticationFailed as auth_exc:
 *                 conn_exc = ConnectionException(str(auth_exc), host=host)
 *                 self.cluster.signal_connection_failure(host, conn_exc, is_host_addition)             # <<<<<<<<<<<<<<
 *                 return False
 *             except Exception as conn_exc:
 */
      if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} }
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_cluster); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_signal_connection_failure); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_cur_scope->__pyx_v_host)) { __Pyx_RaiseClosureNameError("host"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} }
      if (unlikely(!__pyx_cur_scope->__pyx_v_is_host_addition)) { __Pyx_RaiseClosureNameError("is_host_addition"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} }
      __pyx_t_12 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
          __pyx_t_8 = 1;
        }
      }
      __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_12) {
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_12); __pyx_t_12 = NULL;
      }
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_cur_scope->__pyx_v_host);
      __Pyx_INCREF(__pyx_v_conn_exc);
      __Pyx_GIVEREF(__pyx_v_conn_exc);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_conn_exc);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_is_host_addition);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_is_host_addition);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_cur_scope->__pyx_v_is_host_addition);
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_9, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

      /* "cassandra/cluster.py":1840
 *                 conn_exc = ConnectionException(str(auth_exc), host=host)
 *                 self.cluster.signal_connection_failure(host, conn_exc, is_host_addition)
 *                 return False             # <<<<<<<<<<<<<<
 *             except Exception as conn_exc:
 *                 log.warning("Failed to create connection pool for new host %s:",
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }

    /* "cassandra/cluster.py":1841
 *                 self.cluster.signal_connection_failure(host, conn_exc, is_host_addition)
 *                 return False
 *             except Exception as conn_exc:             # <<<<<<<<<<<<<<
 *                 log.warning("Failed to create connection pool for new host %s:",
 *                             host, exc_info=conn_exc)
 */
    __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_10) {
      __Pyx_AddTraceback("cassandra.cluster.Session.add_or_renew_pool.run_add_or_renew_pool", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_v_conn_exc = __pyx_t_4;

      /* "cassandra/cluster.py":1842
 *                 return False
 *             except Exception as conn_exc:
 *                 log.warning("Failed to create connection pool for new host %s:",             # <<<<<<<<<<<<<<
 *                             host, exc_info=conn_exc)
 *                 # the host itself will still be marked down, so we need to pass
 */
      __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_warning); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

      /* "cassandra/cluster.py":1843
 *             except Exception as conn_exc:
 *                 log.warning("Failed to create connection pool for new host %s:",
 *                             host, exc_info=conn_exc)             # <<<<<<<<<<<<<<
 *                 # the host itself will still be marked down, so we need to pass
 *                 # a special flag to make sure the reconnector is created
 */
      if (unlikely(!__pyx_cur_scope->__pyx_v_host)) { __Pyx_RaiseClosureNameError("host"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} }

      /* "cassandra/cluster.py":1842
 *                 return False
 *             except Exception as conn_exc:
 *                 log.warning("Failed to create connection pool for new host %s:",             # <<<<<<<<<<<<<<
 *                             host, exc_info=conn_exc)
 *                 # the host itself will still be marked down, so we need to pass
 */
      __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_kp_s_Failed_to_create_connection_pool);
      __Pyx_GIVEREF(__pyx_kp_s_Failed_to_create_connection_pool);
      PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_kp_s_Failed_to_create_connection_pool);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_cur_scope->__pyx_v_host);
      __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);

      /* "cassandra/cluster.py":1843
 *             except Exception as conn_exc:
 *                 log.warning("Failed to create connection pool for new host %s:",
 *                             host, exc_info=conn_exc)             # <<<<<<<<<<<<<<
 *                 # the host itself will still be marked down, so we need to pass
 *                 # a special flag to make sure the reconnector is created
 */
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_exc_info, __pyx_v_conn_exc) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}

      /* "cassandra/cluster.py":1842
 *                 return False
 *             except Exception as conn_exc:
 *                 log.warning("Failed to create connection pool for new host %s:",             # <<<<<<<<<<<<<<
 *                             host, exc_info=conn_exc)
 *                 # the host itself will still be marked down, so we need to pass
 */
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_13, __pyx_t_9); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "cassandra/cluster.py":1846
 *                 # the host itself will still be marked down, so we need to pass
 *                 # a special flag to make sure the reconnector is created
 *                 self.cluster.signal_connection_failure(             # <<<<<<<<<<<<<<
 *                     host, conn_exc, is_host_addition, expect_host_to_be_down=True)
 *                 return False
 */
      if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} }
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_cluster); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_signal_connection_failure); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "cassandra/cluster.py":1847
 *                 # a special flag to make sure the reconnector is created
 *                 self.cluster.signal_connection_failure(
 *                     host, conn_exc, is_host_addition, expect_host_to_be_down=True)             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
      if (unlikely(!__pyx_cur_scope->__pyx_v_host)) { __Pyx_RaiseClosureNameError("host"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} }
      if (unlikely(!__pyx_cur_scope->__pyx_v_is_host_addition)) { __Pyx_RaiseClosureNameError("is_host_addition"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} }

      /* "cassandra/cluster.py":1846
 *                 # the host itself will still be marked down, so we need to pass
 *                 # a special flag to make sure the reconnector is created
 *                 self.cluster.signal_connection_failure(             # <<<<<<<<<<<<<<
 *                     host, conn_exc, is_host_addition, expect_host_to_be_down=True)
 *                 return False
 */
      __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_cur_scope->__pyx_v_host);
      __Pyx_INCREF(__pyx_v_conn_exc);
      __Pyx_GIVEREF(__pyx_v_conn_exc);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_conn_exc);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_is_host_addition);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_is_host_addition);
      PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_cur_scope->__pyx_v_is_host_addition);
      __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);

      /* "cassandra/cluster.py":1847
 *                 # a special flag to make sure the reconnector is created
 *                 self.cluster.signal_connection_failure(
 *                     host, conn_exc, is_host_addition, expect_host_to_be_down=True)             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
      if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_expect_host_to_be_down, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}

      /* "cassandra/cluster.py":1846
 *                 # the host itself will still be marked down, so we need to pass
 *                 # a special flag to make sure the reconnector is created
 *                 self.cluster.signal_connection_failure(             # <<<<<<<<<<<<<<
 *                     host, conn_exc, is_host_addition, expect_host_to_be_down=True)
 *                 return False
 */
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "cassandra/cluster.py":1848
 *                 self.cluster.signal_connection_failure(
 *                     host, conn_exc, is_host_addition, expect_host_to_be_down=True)
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *             previous = self._pools.get(host)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L10_try_end:;
  }

  /* "cassandra/cluster.py":1850
 *                 return False
 * 
 *             previous = self._pools.get(host)             # <<<<<<<<<<<<<<
 *             self._pools[host] = new_pool
 *             log.debug("Added pool for host %s to session", host)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_pools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_v_host)) { __Pyx_RaiseClosureNameError("host"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_cur_scope->__pyx_v_host); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_cur_scope->__pyx_v_host);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_previous = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cassandra/cluster.py":1851
 * 
 *             previous = self._pools.get(host)
 *             self._pools[host] = new_pool             # <<<<<<<<<<<<<<
 *             log.debug("Added pool for host %s to session", host)
 *             if previous:
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_pools); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (unlikely(!__pyx_cur_scope->__pyx_v_host)) { __Pyx_RaiseClosureNameError("host"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_cur_scope->__pyx_v_host, __pyx_v_new_pool) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cassandra/cluster.py":1852
 *             previous = self._pools.get(host)
 *             self._pools[host] = new_pool
 *             log.debug("Added pool for host %s to session", host)             # <<<<<<<<<<<<<<
 *             if previous:
 *                 previous.shutdown()
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_debug); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_v_host)) { __Pyx_RaiseClosureNameError("host"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_t_7) {
    __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_Added_pool_for_host_s_to_session);
  __Pyx_GIVEREF(__pyx_kp_s_Added_pool_for_host_s_to_session);
  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_kp_s_Added_pool_for_host_s_to_session);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_cur_scope->__pyx_v_host);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cassandra/cluster.py":1853
 *             self._pools[host] = new_pool
 *             log.debug("Added pool for host %s to session", host)
 *             if previous:             # <<<<<<<<<<<<<<
 *                 previous.shutdown()
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_previous); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":1854
 *             log.debug("Added pool for host %s to session", host)
 *             if previous:
 *                 previous.shutdown()             # <<<<<<<<<<<<<<
 * 
 *             return True
 */
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_previous, __pyx_n_s_shutdown); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L16;
  }
  __pyx_L16:;

  /* "cassandra/cluster.py":1856
 *                 previous.shutdown()
 * 
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         return self.submit(run_add_or_renew_pool)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "cassandra/cluster.py":1831
 *             return None
 * 
 *         def run_add_or_renew_pool():             # <<<<<<<<<<<<<<
 *             try:
 *                 if self._protocol_version >= 3:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("cassandra.cluster.Session.add_or_renew_pool.run_add_or_renew_pool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_new_pool);
  __Pyx_XDECREF(__pyx_v_auth_exc);
  __Pyx_XDECREF(__pyx_v_conn_exc);
  __Pyx_XDECREF(__pyx_v_previous);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1823
 *             pool.shutdown()
 * 
 *     def add_or_renew_pool(self, host, is_host_addition):             # <<<<<<<<<<<<<<
 *         """
 *         For internal use only.
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_14add_or_renew_pool(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_is_host_addition) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool *__pyx_cur_scope;
  PyObject *__pyx_v_run_add_or_renew_pool = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_or_renew_pool", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_host = __pyx_v_host;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
  __pyx_cur_scope->__pyx_v_is_host_addition = __pyx_v_is_host_addition;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_is_host_addition);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_is_host_addition);

  /* "cassandra/cluster.py":1827
 *         For internal use only.
 *         """
 *         distance = self._load_balancer.distance(host)             # <<<<<<<<<<<<<<
 *         if distance == HostDistance.IGNORED:
 *             return None
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_load_balancer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_distance); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_cur_scope->__pyx_v_host);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_distance = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1828
 *         """
 *         distance = self._load_balancer.distance(host)
 *         if distance == HostDistance.IGNORED:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostDistance); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_IGNORED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_distance, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":1829
 *         distance = self._load_balancer.distance(host)
 *         if distance == HostDistance.IGNORED:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         def run_add_or_renew_pool():
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":1831
 *             return None
 * 
 *         def run_add_or_renew_pool():             # <<<<<<<<<<<<<<
 *             try:
 *                 if self._protocol_version >= 3:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_17add_or_renew_pool_1run_add_or_renew_pool, 0, __pyx_n_s_Session_add_or_renew_pool_locals, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_run_add_or_renew_pool = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1858
 *             return True
 * 
 *         return self.submit(run_add_or_renew_pool)             # <<<<<<<<<<<<<<
 * 
 *     def remove_pool(self, host):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_submit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_run_add_or_renew_pool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_run_add_or_renew_pool);
    __Pyx_GIVEREF(__pyx_v_run_add_or_renew_pool);
    PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_run_add_or_renew_pool);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":1823
 *             pool.shutdown()
 * 
 *     def add_or_renew_pool(self, host, is_host_addition):             # <<<<<<<<<<<<<<
 *         """
 *         For internal use only.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster.Session.add_or_renew_pool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_run_add_or_renew_pool);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1860
 *         return self.submit(run_add_or_renew_pool)
 * 
 *     def remove_pool(self, host):             # <<<<<<<<<<<<<<
 *         pool = self._pools.pop(host, None)
 *         if pool:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_17remove_pool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_17remove_pool = {"remove_pool", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_17remove_pool, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_17remove_pool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove_pool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("remove_pool", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "remove_pool") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove_pool", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session.remove_pool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_16remove_pool(__pyx_self, __pyx_v_self, __pyx_v_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_16remove_pool(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host) {
  PyObject *__pyx_v_pool = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove_pool", 0);

  /* "cassandra/cluster.py":1861
 * 
 *     def remove_pool(self, host):
 *         pool = self._pools.pop(host, None)             # <<<<<<<<<<<<<<
 *         if pool:
 *             log.debug("Removed connection pool for %r", host)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pools); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_pop); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_2) {
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_INCREF(__pyx_v_host);
  __Pyx_GIVEREF(__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_host);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, Py_None);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_pool = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1862
 *     def remove_pool(self, host):
 *         pool = self._pools.pop(host, None)
 *         if pool:             # <<<<<<<<<<<<<<
 *             log.debug("Removed connection pool for %r", host)
 *             return self.submit(pool.shutdown)
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_pool); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":1863
 *         pool = self._pools.pop(host, None)
 *         if pool:
 *             log.debug("Removed connection pool for %r", host)             # <<<<<<<<<<<<<<
 *             return self.submit(pool.shutdown)
 *         else:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_4 = 1;
      }
    }
    __pyx_t_2 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Removed_connection_pool_for_r);
    __Pyx_GIVEREF(__pyx_kp_s_Removed_connection_pool_for_r);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, __pyx_kp_s_Removed_connection_pool_for_r);
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, __pyx_v_host);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1864
 *         if pool:
 *             log.debug("Removed connection pool for %r", host)
 *             return self.submit(pool.shutdown)             # <<<<<<<<<<<<<<
 *         else:
 *             return None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_submit); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_shutdown); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cassandra/cluster.py":1866
 *             return self.submit(pool.shutdown)
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def update_created_pools(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":1860
 *         return self.submit(run_add_or_renew_pool)
 * 
 *     def remove_pool(self, host):             # <<<<<<<<<<<<<<
 *         pool = self._pools.pop(host, None)
 *         if pool:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.Session.remove_pool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pool);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1868
 *             return None
 * 
 *     def update_created_pools(self):             # <<<<<<<<<<<<<<
 *         """
 *         When the set of live nodes change, the loadbalancer will change its
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_19update_created_pools(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Session_18update_created_pools[] = "\n        When the set of live nodes change, the loadbalancer will change its\n        mind on host distances. It might change it on the node that came/left\n        but also on other nodes (for instance, if a node dies, another\n        previously ignored node may be now considered).\n\n        This method ensures that all hosts for which a pool should exist\n        have one, and hosts that shouldn't don't.\n\n        For internal use only.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_19update_created_pools = {"update_created_pools", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_19update_created_pools, METH_O, __pyx_doc_9cassandra_7cluster_7Session_18update_created_pools};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_19update_created_pools(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_created_pools (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_18update_created_pools(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_18update_created_pools(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_distance = NULL;
  PyObject *__pyx_v_pool = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_created_pools", 0);

  /* "cassandra/cluster.py":1880
 *         For internal use only.
 *         """
 *         for host in self.cluster.metadata.all_hosts():             # <<<<<<<<<<<<<<
 *             distance = self._load_balancer.distance(host)
 *             pool = self._pools.get(host)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_metadata); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_all_hosts); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_host, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1881
 *         """
 *         for host in self.cluster.metadata.all_hosts():
 *             distance = self._load_balancer.distance(host)             # <<<<<<<<<<<<<<
 *             pool = self._pools.get(host)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_load_balancer); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_distance); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_host);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_distance, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1882
 *         for host in self.cluster.metadata.all_hosts():
 *             distance = self._load_balancer.distance(host)
 *             pool = self._pools.get(host)             # <<<<<<<<<<<<<<
 * 
 *             if not pool or pool.is_shutdown:
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pools); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_get); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_host);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_pool, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1884
 *             pool = self._pools.get(host)
 * 
 *             if not pool or pool.is_shutdown:             # <<<<<<<<<<<<<<
 *                 if distance != HostDistance.IGNORED and host.is_up:
 *                     self.add_or_renew_pool(host, False)
 */
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_pool); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = ((!__pyx_t_9) != 0);
    if (!__pyx_t_10) {
    } else {
      __pyx_t_8 = __pyx_t_10;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __pyx_t_10;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_8) {

      /* "cassandra/cluster.py":1885
 * 
 *             if not pool or pool.is_shutdown:
 *                 if distance != HostDistance.IGNORED and host.is_up:             # <<<<<<<<<<<<<<
 *                     self.add_or_renew_pool(host, False)
 *             elif distance != pool.host_distance:
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostDistance); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_IGNORED); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_distance, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_10) {
      } else {
        __pyx_t_8 = __pyx_t_10;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_is_up); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = __pyx_t_10;
      __pyx_L9_bool_binop_done:;
      if (__pyx_t_8) {

        /* "cassandra/cluster.py":1886
 *             if not pool or pool.is_shutdown:
 *                 if distance != HostDistance.IGNORED and host.is_up:
 *                     self.add_or_renew_pool(host, False)             # <<<<<<<<<<<<<<
 *             elif distance != pool.host_distance:
 *                 # the distance has changed
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_add_or_renew_pool); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = NULL;
        __pyx_t_11 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_11 = 1;
          }
        }
        __pyx_t_6 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_11, __pyx_v_host);
        __Pyx_INCREF(Py_False);
        __Pyx_GIVEREF(Py_False);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_11, Py_False);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L8;
      }
      __pyx_L8:;
      goto __pyx_L5;
    }

    /* "cassandra/cluster.py":1887
 *                 if distance != HostDistance.IGNORED and host.is_up:
 *                     self.add_or_renew_pool(host, False)
 *             elif distance != pool.host_distance:             # <<<<<<<<<<<<<<
 *                 # the distance has changed
 *                 if distance == HostDistance.IGNORED:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_host_distance); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = PyObject_RichCompare(__pyx_v_distance, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_8) {

      /* "cassandra/cluster.py":1889
 *             elif distance != pool.host_distance:
 *                 # the distance has changed
 *                 if distance == HostDistance.IGNORED:             # <<<<<<<<<<<<<<
 *                     self.remove_pool(host)
 *                 else:
 */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_HostDistance); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_IGNORED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_RichCompare(__pyx_v_distance, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_8) {

        /* "cassandra/cluster.py":1890
 *                 # the distance has changed
 *                 if distance == HostDistance.IGNORED:
 *                     self.remove_pool(host)             # <<<<<<<<<<<<<<
 *                 else:
 *                     pool.host_distance = distance
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_remove_pool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        if (!__pyx_t_6) {
          __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_host); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
        } else {
          __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
          __Pyx_INCREF(__pyx_v_host);
          __Pyx_GIVEREF(__pyx_v_host);
          PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_host);
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "cassandra/cluster.py":1892
 *                     self.remove_pool(host)
 *                 else:
 *                     pool.host_distance = distance             # <<<<<<<<<<<<<<
 * 
 *     def on_down(self, host):
 */
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_pool, __pyx_n_s_host_distance, __pyx_v_distance) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L11:;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "cassandra/cluster.py":1880
 *         For internal use only.
 *         """
 *         for host in self.cluster.metadata.all_hosts():             # <<<<<<<<<<<<<<
 *             distance = self._load_balancer.distance(host)
 *             pool = self._pools.get(host)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1868
 *             return None
 * 
 *     def update_created_pools(self):             # <<<<<<<<<<<<<<
 *         """
 *         When the set of live nodes change, the loadbalancer will change its
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.Session.update_created_pools", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_distance);
  __Pyx_XDECREF(__pyx_v_pool);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1894
 *                     pool.host_distance = distance
 * 
 *     def on_down(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the parent Cluster instance when a node is marked down.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_21on_down(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Session_20on_down[] = "\n        Called by the parent Cluster instance when a node is marked down.\n        Only intended for internal use.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_21on_down = {"on_down", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_21on_down, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Session_20on_down};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_21on_down(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_down (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_down", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_down") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_down", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session.on_down", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_20on_down(__pyx_self, __pyx_v_self, __pyx_v_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1901
 *         future = self.remove_pool(host)
 *         if future:
 *             future.add_done_callback(lambda f: self.update_created_pools())             # <<<<<<<<<<<<<<
 * 
 *     def on_remove(self, host):
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_7on_down_lambda2(PyObject *__pyx_self, PyObject *__pyx_v_f); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_7on_down_lambda2 = {"lambda2", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_7on_down_lambda2, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_7on_down_lambda2(PyObject *__pyx_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda2 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda2(__pyx_self, ((PyObject *)__pyx_v_f));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_f) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down *__pyx_cur_scope;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda2", 0);
  __pyx_outer_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_update_created_pools); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cassandra.cluster.Session.on_down.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1894
 *                     pool.host_distance = distance
 * 
 *     def on_down(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the parent Cluster instance when a node is marked down.
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_20on_down(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down *__pyx_cur_scope;
  PyObject *__pyx_v_future = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_down", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_5_on_down(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_5_on_down, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);

  /* "cassandra/cluster.py":1899
 *         Only intended for internal use.
 *         """
 *         future = self.remove_pool(host)             # <<<<<<<<<<<<<<
 *         if future:
 *             future.add_done_callback(lambda f: self.update_created_pools())
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_remove_pool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_host);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_future = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1900
 *         """
 *         future = self.remove_pool(host)
 *         if future:             # <<<<<<<<<<<<<<
 *             future.add_done_callback(lambda f: self.update_created_pools())
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_future); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":1901
 *         future = self.remove_pool(host)
 *         if future:
 *             future.add_done_callback(lambda f: self.update_created_pools())             # <<<<<<<<<<<<<<
 * 
 *     def on_remove(self, host):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_add_done_callback); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_7on_down_lambda2, 0, __pyx_n_s_Session_on_down_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cassandra_cluster, __pyx_d, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":1894
 *                     pool.host_distance = distance
 * 
 *     def on_down(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the parent Cluster instance when a node is marked down.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.Session.on_down", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_future);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1903
 *             future.add_done_callback(lambda f: self.update_created_pools())
 * 
 *     def on_remove(self, host):             # <<<<<<<<<<<<<<
 *         """ Internal """
 *         self.on_down(host)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_23on_remove(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Session_22on_remove[] = " Internal ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_23on_remove = {"on_remove", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_23on_remove, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Session_22on_remove};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_23on_remove(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_remove (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_remove", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_remove") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_remove", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session.on_remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_22on_remove(__pyx_self, __pyx_v_self, __pyx_v_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_22on_remove(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_remove", 0);

  /* "cassandra/cluster.py":1905
 *     def on_remove(self, host):
 *         """ Internal """
 *         self.on_down(host)             # <<<<<<<<<<<<<<
 * 
 *     def set_keyspace(self, keyspace):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_down); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_host);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1903
 *             future.add_done_callback(lambda f: self.update_created_pools())
 * 
 *     def on_remove(self, host):             # <<<<<<<<<<<<<<
 *         """ Internal """
 *         self.on_down(host)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster.Session.on_remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1907
 *         self.on_down(host)
 * 
 *     def set_keyspace(self, keyspace):             # <<<<<<<<<<<<<<
 *         """
 *         Set the default keyspace for all queries made through this Session.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_25set_keyspace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Session_24set_keyspace[] = "\n        Set the default keyspace for all queries made through this Session.\n        This operation blocks until complete.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_25set_keyspace = {"set_keyspace", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_25set_keyspace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Session_24set_keyspace};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_25set_keyspace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keyspace = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_keyspace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_keyspace,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_keyspace", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_keyspace") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_keyspace = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_keyspace", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session.set_keyspace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_24set_keyspace(__pyx_self, __pyx_v_self, __pyx_v_keyspace);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_24set_keyspace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_keyspace", 0);

  /* "cassandra/cluster.py":1912
 *         This operation blocks until complete.
 *         """
 *         self.execute('USE %s' % (protect_name(keyspace),))             # <<<<<<<<<<<<<<
 * 
 *     def _set_keyspace_for_all_pools(self, keyspace, callback):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_execute); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_protect_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_keyspace); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_keyspace);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_USE_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1907
 *         self.on_down(host)
 * 
 *     def set_keyspace(self, keyspace):             # <<<<<<<<<<<<<<
 *         """
 *         Set the default keyspace for all queries made through this Session.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.Session.set_keyspace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1914
 *         self.execute('USE %s' % (protect_name(keyspace),))
 * 
 *     def _set_keyspace_for_all_pools(self, keyspace, callback):             # <<<<<<<<<<<<<<
 *         """
 *         Asynchronously sets the keyspace on all pools.  When all
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_27_set_keyspace_for_all_pools(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Session_26_set_keyspace_for_all_pools[] = "\n        Asynchronously sets the keyspace on all pools.  When all\n        pools have set all of their connections, `callback` will be\n        called with a dictionary of all errors that occurred, keyed\n        by the `Host` that they occurred against.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_27_set_keyspace_for_all_pools = {"_set_keyspace_for_all_pools", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_27_set_keyspace_for_all_pools, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Session_26_set_keyspace_for_all_pools};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_27_set_keyspace_for_all_pools(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keyspace = 0;
  PyObject *__pyx_v_callback = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_keyspace_for_all_pools (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_keyspace,&__pyx_n_s_callback,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_keyspace_for_all_pools", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_keyspace_for_all_pools", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_set_keyspace_for_all_pools") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_keyspace = values[1];
    __pyx_v_callback = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_set_keyspace_for_all_pools", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session._set_keyspace_for_all_pools", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_26_set_keyspace_for_all_pools(__pyx_self, __pyx_v_self, __pyx_v_keyspace, __pyx_v_callback);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1930
 *             return
 * 
 *         def pool_finished_setting_keyspace(pool, host_errors):             # <<<<<<<<<<<<<<
 *             remaining_callbacks.remove(pool)
 *             if host_errors:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_27_set_keyspace_for_all_pools_1pool_finished_setting_keyspace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_27_set_keyspace_for_all_pools_1pool_finished_setting_keyspace = {"pool_finished_setting_keyspace", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_27_set_keyspace_for_all_pools_1pool_finished_setting_keyspace, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_27_set_keyspace_for_all_pools_1pool_finished_setting_keyspace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pool = 0;
  PyObject *__pyx_v_host_errors = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pool_finished_setting_keyspace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pool,&__pyx_n_s_host_errors,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pool)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host_errors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pool_finished_setting_keyspace", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pool_finished_setting_keyspace") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pool = values[0];
    __pyx_v_host_errors = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pool_finished_setting_keyspace", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session._set_keyspace_for_all_pools.pool_finished_setting_keyspace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_27_set_keyspace_for_all_pools_pool_finished_setting_keyspace(__pyx_self, __pyx_v_pool, __pyx_v_host_errors);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_27_set_keyspace_for_all_pools_pool_finished_setting_keyspace(PyObject *__pyx_self, PyObject *__pyx_v_pool, PyObject *__pyx_v_host_errors) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools *__pyx_cur_scope;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pool_finished_setting_keyspace", 0);
  __pyx_outer_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "cassandra/cluster.py":1931
 * 
 *         def pool_finished_setting_keyspace(pool, host_errors):
 *             remaining_callbacks.remove(pool)             # <<<<<<<<<<<<<<
 *             if host_errors:
 *                 errors[pool.host] = host_errors
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_remaining_callbacks)) { __Pyx_RaiseClosureNameError("remaining_callbacks"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_remaining_callbacks, __pyx_n_s_remove); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_pool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_pool);
    __Pyx_GIVEREF(__pyx_v_pool);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_pool);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1932
 *         def pool_finished_setting_keyspace(pool, host_errors):
 *             remaining_callbacks.remove(pool)
 *             if host_errors:             # <<<<<<<<<<<<<<
 *                 errors[pool.host] = host_errors
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_host_errors); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":1933
 *             remaining_callbacks.remove(pool)
 *             if host_errors:
 *                 errors[pool.host] = host_errors             # <<<<<<<<<<<<<<
 * 
 *             if not remaining_callbacks:
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_errors)) { __Pyx_RaiseClosureNameError("errors"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    if (unlikely(__pyx_cur_scope->__pyx_v_errors == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_errors, __pyx_t_1, __pyx_v_host_errors) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":1935
 *                 errors[pool.host] = host_errors
 * 
 *             if not remaining_callbacks:             # <<<<<<<<<<<<<<
 *                 callback(host_errors)
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_remaining_callbacks)) { __Pyx_RaiseClosureNameError("remaining_callbacks"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_remaining_callbacks); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":1936
 * 
 *             if not remaining_callbacks:
 *                 callback(host_errors)             # <<<<<<<<<<<<<<
 * 
 *         for pool in self._pools.values():
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_callback)) { __Pyx_RaiseClosureNameError("callback"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_callback);
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_callback; __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_host_errors); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_host_errors);
      __Pyx_GIVEREF(__pyx_v_host_errors);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_host_errors);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cassandra/cluster.py":1930
 *             return
 * 
 *         def pool_finished_setting_keyspace(pool, host_errors):             # <<<<<<<<<<<<<<
 *             remaining_callbacks.remove(pool)
 *             if host_errors:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster.Session._set_keyspace_for_all_pools.pool_finished_setting_keyspace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1914
 *         self.execute('USE %s' % (protect_name(keyspace),))
 * 
 *     def _set_keyspace_for_all_pools(self, keyspace, callback):             # <<<<<<<<<<<<<<
 *         """
 *         Asynchronously sets the keyspace on all pools.  When all
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_26_set_keyspace_for_all_pools(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_callback) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools *__pyx_cur_scope;
  PyObject *__pyx_v_pool_finished_setting_keyspace = 0;
  PyObject *__pyx_v_pool = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_keyspace_for_all_pools", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_callback = __pyx_v_callback;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_callback);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_callback);

  /* "cassandra/cluster.py":1921
 *         by the `Host` that they occurred against.
 *         """
 *         self.keyspace = keyspace             # <<<<<<<<<<<<<<
 * 
 *         remaining_callbacks = set(self._pools.values())
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_keyspace, __pyx_v_keyspace) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1923
 *         self.keyspace = keyspace
 * 
 *         remaining_callbacks = set(self._pools.values())             # <<<<<<<<<<<<<<
 *         errors = {}
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pools); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PySet_New(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_remaining_callbacks = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cassandra/cluster.py":1924
 * 
 *         remaining_callbacks = set(self._pools.values())
 *         errors = {}             # <<<<<<<<<<<<<<
 * 
 *         if not remaining_callbacks:
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_errors = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cassandra/cluster.py":1926
 *         errors = {}
 * 
 *         if not remaining_callbacks:             # <<<<<<<<<<<<<<
 *             callback(errors)
 *             return
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_remaining_callbacks); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":1927
 * 
 *         if not remaining_callbacks:
 *             callback(errors)             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_callback);
    __pyx_t_1 = __pyx_cur_scope->__pyx_v_callback; __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_cur_scope->__pyx_v_errors); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_errors);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_errors);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_cur_scope->__pyx_v_errors);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cassandra/cluster.py":1928
 *         if not remaining_callbacks:
 *             callback(errors)
 *             return             # <<<<<<<<<<<<<<
 * 
 *         def pool_finished_setting_keyspace(pool, host_errors):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":1930
 *             return
 * 
 *         def pool_finished_setting_keyspace(pool, host_errors):             # <<<<<<<<<<<<<<
 *             remaining_callbacks.remove(pool)
 *             if host_errors:
 */
  __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_27_set_keyspace_for_all_pools_1pool_finished_setting_keyspace, 0, __pyx_n_s_Session__set_keyspace_for_all_po, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_pool_finished_setting_keyspace = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cassandra/cluster.py":1938
 *                 callback(host_errors)
 * 
 *         for pool in self._pools.values():             # <<<<<<<<<<<<<<
 *             pool._set_keyspace_for_all_conns(keyspace, pool_finished_setting_keyspace)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_values); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_6 = __pyx_t_3; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_6))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_8(__pyx_t_6);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_pool, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "cassandra/cluster.py":1939
 * 
 *         for pool in self._pools.values():
 *             pool._set_keyspace_for_all_conns(keyspace, pool_finished_setting_keyspace)             # <<<<<<<<<<<<<<
 * 
 *     def user_type_registered(self, keyspace, user_type, klass):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_set_keyspace_for_all_conns); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_9 = 1;
      }
    }
    __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_keyspace);
    __Pyx_INCREF(__pyx_v_pool_finished_setting_keyspace);
    __Pyx_GIVEREF(__pyx_v_pool_finished_setting_keyspace);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_pool_finished_setting_keyspace);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cassandra/cluster.py":1938
 *                 callback(host_errors)
 * 
 *         for pool in self._pools.values():             # <<<<<<<<<<<<<<
 *             pool._set_keyspace_for_all_conns(keyspace, pool_finished_setting_keyspace)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "cassandra/cluster.py":1914
 *         self.execute('USE %s' % (protect_name(keyspace),))
 * 
 *     def _set_keyspace_for_all_pools(self, keyspace, callback):             # <<<<<<<<<<<<<<
 *         """
 *         Asynchronously sets the keyspace on all pools.  When all
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cassandra.cluster.Session._set_keyspace_for_all_pools", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pool_finished_setting_keyspace);
  __Pyx_XDECREF(__pyx_v_pool);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1941
 *             pool._set_keyspace_for_all_conns(keyspace, pool_finished_setting_keyspace)
 * 
 *     def user_type_registered(self, keyspace, user_type, klass):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the parent Cluster instance when the user registers a new
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_29user_type_registered(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Session_28user_type_registered[] = "\n        Called by the parent Cluster instance when the user registers a new\n        mapping from a user-defined type to a class.  Intended for internal\n        use only.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_29user_type_registered = {"user_type_registered", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_29user_type_registered, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Session_28user_type_registered};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_29user_type_registered(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keyspace = 0;
  PyObject *__pyx_v_user_type = 0;
  PyObject *__pyx_v_klass = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("user_type_registered (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_keyspace,&__pyx_n_s_user_type,&__pyx_n_s_klass,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("user_type_registered", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_user_type)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("user_type_registered", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_klass)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("user_type_registered", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "user_type_registered") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_keyspace = values[1];
    __pyx_v_user_type = values[2];
    __pyx_v_klass = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("user_type_registered", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session.user_type_registered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_28user_type_registered(__pyx_self, __pyx_v_self, __pyx_v_keyspace, __pyx_v_user_type, __pyx_v_klass);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1959
 *                 'User type %s does not exist in keyspace %s' % (user_type, keyspace))
 * 
 *         def encode(val):             # <<<<<<<<<<<<<<
 *             return '{ %s }' % ' , '.join('%s : %s' % (
 *                 field_name,
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_20user_type_registered_1encode(PyObject *__pyx_self, PyObject *__pyx_v_val); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_20user_type_registered_1encode = {"encode", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_20user_type_registered_1encode, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_20user_type_registered_1encode(PyObject *__pyx_self, PyObject *__pyx_v_val) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("encode (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_20user_type_registered_encode(__pyx_self, ((PyObject *)__pyx_v_val));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_9cassandra_7cluster_7Session_20user_type_registered_6encode_2generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "cassandra/cluster.py":1960
 * 
 *         def encode(val):
 *             return '{ %s }' % ' , '.join('%s : %s' % (             # <<<<<<<<<<<<<<
 *                 field_name,
 *                 self.encoder.cql_encode_all_types(getattr(val, field_name, None))
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_20user_type_registered_6encode_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_9_genexpr(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_9_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_9cassandra_7cluster_7Session_20user_type_registered_6encode_2generator1, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Session_user_type_registered_loc); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session.user_type_registered.encode.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_9cassandra_7cluster_7Session_20user_type_registered_6encode_2generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1963
 *                 field_name,
 *                 self.encoder.cql_encode_all_types(getattr(val, field_name, None))
 *             ) for field_name in type_meta.field_names)             # <<<<<<<<<<<<<<
 * 
 *         self.encoder.mapping[klass] = encode
 */
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_outer_scope->__pyx_v_type_meta)) { __Pyx_RaiseClosureNameError("type_meta"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_outer_scope->__pyx_v_type_meta, __pyx_n_s_field_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_field_name);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_field_name, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1962
 *             return '{ %s }' % ' , '.join('%s : %s' % (
 *                 field_name,
 *                 self.encoder.cql_encode_all_types(getattr(val, field_name, None))             # <<<<<<<<<<<<<<
 *             ) for field_name in type_meta.field_names)
 * 
 */
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s_encoder); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_cql_encode_all_types); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_val)) { __Pyx_RaiseClosureNameError("val"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_5 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_val;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_GetAttr3(__pyx_t_5, __pyx_cur_scope->__pyx_v_field_name, Py_None); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "cassandra/cluster.py":1961
 *         def encode(val):
 *             return '{ %s }' % ' , '.join('%s : %s' % (
 *                 field_name,             # <<<<<<<<<<<<<<
 *                 self.encoder.cql_encode_all_types(getattr(val, field_name, None))
 *             ) for field_name in type_meta.field_names)
 */
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_field_name);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_field_name);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_field_name);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":1960
 * 
 *         def encode(val):
 *             return '{ %s }' % ' , '.join('%s : %s' % (             # <<<<<<<<<<<<<<
 *                 field_name,
 *                 self.encoder.cql_encode_all_types(getattr(val, field_name, None))
 */
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "cassandra/cluster.py":1963
 *                 field_name,
 *                 self.encoder.cql_encode_all_types(getattr(val, field_name, None))
 *             ) for field_name in type_meta.field_names)             # <<<<<<<<<<<<<<
 * 
 *         self.encoder.mapping[klass] = encode
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1960
 * 
 *         def encode(val):
 *             return '{ %s }' % ' , '.join('%s : %s' % (             # <<<<<<<<<<<<<<
 *                 field_name,
 *                 self.encoder.cql_encode_all_types(getattr(val, field_name, None))
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "cassandra/cluster.py":1959
 *                 'User type %s does not exist in keyspace %s' % (user_type, keyspace))
 * 
 *         def encode(val):             # <<<<<<<<<<<<<<
 *             return '{ %s }' % ' , '.join('%s : %s' % (
 *                 field_name,
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_20user_type_registered_encode(PyObject *__pyx_self, PyObject *__pyx_v_val) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("encode", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_8_encode(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_8_encode, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_v_val = __pyx_v_val;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_val);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_val);

  /* "cassandra/cluster.py":1960
 * 
 *         def encode(val):
 *             return '{ %s }' % ' , '.join('%s : %s' % (             # <<<<<<<<<<<<<<
 *                 field_name,
 *                 self.encoder.cql_encode_all_types(getattr(val, field_name, None))
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_pf_9cassandra_7cluster_7Session_20user_type_registered_6encode_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__67, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":1959
 *                 'User type %s does not exist in keyspace %s' % (user_type, keyspace))
 * 
 *         def encode(val):             # <<<<<<<<<<<<<<
 *             return '{ %s }' % ' , '.join('%s : %s' % (
 *                 field_name,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster.Session.user_type_registered.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1941
 *             pool._set_keyspace_for_all_conns(keyspace, pool_finished_setting_keyspace)
 * 
 *     def user_type_registered(self, keyspace, user_type, klass):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the parent Cluster instance when the user registers a new
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_28user_type_registered(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_user_type, PyObject *__pyx_v_klass) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered *__pyx_cur_scope;
  PyObject *__pyx_v_ks_meta = NULL;
  PyObject *__pyx_v_encode = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("user_type_registered", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);

  /* "cassandra/cluster.py":1947
 *         use only.
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             ks_meta = self.cluster.metadata.keyspaces[keyspace]
 *         except KeyError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cassandra/cluster.py":1948
 *         """
 *         try:
 *             ks_meta = self.cluster.metadata.keyspaces[keyspace]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             raise UserTypeDoesNotExist(
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_cluster); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_metadata); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_keyspaces); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_v_keyspace); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_ks_meta = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":1949
 *         try:
 *             ks_meta = self.cluster.metadata.keyspaces[keyspace]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             raise UserTypeDoesNotExist(
 *                 'Keyspace %s does not exist or has not been discovered by the driver' % (keyspace,))
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("cassandra.cluster.Session.user_type_registered", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_7);

      /* "cassandra/cluster.py":1950
 *             ks_meta = self.cluster.metadata.keyspaces[keyspace]
 *         except KeyError:
 *             raise UserTypeDoesNotExist(             # <<<<<<<<<<<<<<
 *                 'Keyspace %s does not exist or has not been discovered by the driver' % (keyspace,))
 * 
 */
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_UserTypeDoesNotExist); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);

      /* "cassandra/cluster.py":1951
 *         except KeyError:
 *             raise UserTypeDoesNotExist(
 *                 'Keyspace %s does not exist or has not been discovered by the driver' % (keyspace,))             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_v_keyspace);
      __Pyx_GIVEREF(__pyx_v_keyspace);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_keyspace);
      __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_Keyspace_s_does_not_exist_or_has, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_10) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_11);
        __pyx_t_11 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L10_try_end:;
  }

  /* "cassandra/cluster.py":1953
 *                 'Keyspace %s does not exist or has not been discovered by the driver' % (keyspace,))
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             type_meta = ks_meta.user_types[user_type]
 *         except KeyError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "cassandra/cluster.py":1954
 * 
 *         try:
 *             type_meta = ks_meta.user_types[user_type]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             raise UserTypeDoesNotExist(
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_ks_meta, __pyx_n_s_user_types_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = PyObject_GetItem(__pyx_t_7, __pyx_v_user_type); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L13_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_cur_scope->__pyx_v_type_meta = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L20_try_end;
    __pyx_L13_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":1955
 *         try:
 *             type_meta = ks_meta.user_types[user_type]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             raise UserTypeDoesNotExist(
 *                 'User type %s does not exist in keyspace %s' % (user_type, keyspace))
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("cassandra.cluster.Session.user_type_registered", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_5);

      /* "cassandra/cluster.py":1956
 *             type_meta = ks_meta.user_types[user_type]
 *         except KeyError:
 *             raise UserTypeDoesNotExist(             # <<<<<<<<<<<<<<
 *                 'User type %s does not exist in keyspace %s' % (user_type, keyspace))
 * 
 */
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_UserTypeDoesNotExist); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
      __Pyx_GOTREF(__pyx_t_9);

      /* "cassandra/cluster.py":1957
 *         except KeyError:
 *             raise UserTypeDoesNotExist(
 *                 'User type %s does not exist in keyspace %s' % (user_type, keyspace))             # <<<<<<<<<<<<<<
 * 
 *         def encode(val):
 */
      __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_v_user_type);
      __Pyx_GIVEREF(__pyx_v_user_type);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_user_type);
      __Pyx_INCREF(__pyx_v_keyspace);
      __Pyx_GIVEREF(__pyx_v_keyspace);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_keyspace);
      __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_User_type_s_does_not_exist_in_ke, __pyx_t_12); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_12) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_12); __pyx_t_12 = NULL;
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_11);
        __pyx_t_11 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
    }
    goto __pyx_L15_except_error;
    __pyx_L15_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L20_try_end:;
  }

  /* "cassandra/cluster.py":1959
 *                 'User type %s does not exist in keyspace %s' % (user_type, keyspace))
 * 
 *         def encode(val):             # <<<<<<<<<<<<<<
 *             return '{ %s }' % ' , '.join('%s : %s' % (
 *                 field_name,
 */
  __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_20user_type_registered_1encode, 0, __pyx_n_s_Session_user_type_registered_loc_2, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_encode = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cassandra/cluster.py":1965
 *             ) for field_name in type_meta.field_names)
 * 
 *         self.encoder.mapping[klass] = encode             # <<<<<<<<<<<<<<
 * 
 *     def submit(self, fn, *args, **kwargs):
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_encoder); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_mapping); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(PyObject_SetItem(__pyx_t_7, __pyx_v_klass, __pyx_v_encode) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "cassandra/cluster.py":1941
 *             pool._set_keyspace_for_all_conns(keyspace, pool_finished_setting_keyspace)
 * 
 *     def user_type_registered(self, keyspace, user_type, klass):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the parent Cluster instance when the user registers a new
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("cassandra.cluster.Session.user_type_registered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ks_meta);
  __Pyx_XDECREF(__pyx_v_encode);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1967
 *         self.encoder.mapping[klass] = encode
 * 
 *     def submit(self, fn, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """ Internal """
 *         if not self.is_shutdown:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_31submit(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_7Session_30submit[] = " Internal ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_31submit = {"submit", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_31submit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_7Session_30submit};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_31submit(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_fn = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("submit (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_fn,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("submit", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "submit") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_fn = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("submit", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("cassandra.cluster.Session.submit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_30submit(__pyx_self, __pyx_v_self, __pyx_v_fn, __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_30submit(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fn, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("submit", 0);

  /* "cassandra/cluster.py":1969
 *     def submit(self, fn, *args, **kwargs):
 *         """ Internal """
 *         if not self.is_shutdown:             # <<<<<<<<<<<<<<
 *             return self.cluster.executor.submit(fn, *args, **kwargs)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":1970
 *         """ Internal """
 *         if not self.is_shutdown:
 *             return self.cluster.executor.submit(fn, *args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def get_pool_state(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_executor); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_submit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_fn);
    __Pyx_GIVEREF(__pyx_v_fn);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fn);
    __pyx_t_5 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __pyx_v_kwargs;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":1967
 *         self.encoder.mapping[klass] = encode
 * 
 *     def submit(self, fn, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """ Internal """
 *         if not self.is_shutdown:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.Session.submit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1972
 *             return self.cluster.executor.submit(fn, *args, **kwargs)
 * 
 *     def get_pool_state(self):             # <<<<<<<<<<<<<<
 *         return dict((host, pool.get_state()) for host, pool in self._pools.items())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_33get_pool_state(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_33get_pool_state = {"get_pool_state", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_33get_pool_state, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_33get_pool_state(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_pool_state (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_32get_pool_state(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_9cassandra_7cluster_7Session_14get_pool_state_2generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "cassandra/cluster.py":1973
 * 
 *     def get_pool_state(self):
 *         return dict((host, pool.get_state()) for host, pool in self._pools.items())             # <<<<<<<<<<<<<<
 * 
 *     def get_pools(self):
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_14get_pool_state_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_11_genexpr(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_11_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_9cassandra_7cluster_7Session_14get_pool_state_2generator2, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Session_get_pool_state_locals_ge); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cassandra.cluster.Session.get_pool_state.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_9cassandra_7cluster_7Session_14get_pool_state_2generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L8_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s_pools); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_3);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_host);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_host, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pool);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pool, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_pool, __pyx_n_s_get_state); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_host);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_host);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_t_3);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L8_resume_from_yield:;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "cassandra/cluster.py":1972
 *             return self.cluster.executor.submit(fn, *args, **kwargs)
 * 
 *     def get_pool_state(self):             # <<<<<<<<<<<<<<
 *         return dict((host, pool.get_state()) for host, pool in self._pools.items())
 * 
 */

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_32get_pool_state(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_pool_state", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);

  /* "cassandra/cluster.py":1973
 * 
 *     def get_pool_state(self):
 *         return dict((host, pool.get_state()) for host, pool in self._pools.items())             # <<<<<<<<<<<<<<
 * 
 *     def get_pools(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_pf_9cassandra_7cluster_7Session_14get_pool_state_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":1972
 *             return self.cluster.executor.submit(fn, *args, **kwargs)
 * 
 *     def get_pool_state(self):             # <<<<<<<<<<<<<<
 *         return dict((host, pool.get_state()) for host, pool in self._pools.items())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster.Session.get_pool_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1975
 *         return dict((host, pool.get_state()) for host, pool in self._pools.items())
 * 
 *     def get_pools(self):             # <<<<<<<<<<<<<<
 *         return self._pools.values()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_35get_pools(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_7Session_35get_pools = {"get_pools", (PyCFunction)__pyx_pw_9cassandra_7cluster_7Session_35get_pools, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_7Session_35get_pools(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_pools (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_7Session_34get_pools(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_7Session_34get_pools(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_pools", 0);

  /* "cassandra/cluster.py":1976
 * 
 *     def get_pools(self):
 *         return self._pools.values()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pools); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":1975
 *         return dict((host, pool.get_state()) for host, pool in self._pools.items())
 * 
 *     def get_pools(self):             # <<<<<<<<<<<<<<
 *         return self._pools.values()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cassandra.cluster.Session.get_pools", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1993
 *     """
 * 
 *     def __init__(self, control_connection, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         _ReconnectionHandler.__init__(self, *args, **kwargs)
 *         self.control_connection = weakref.proxy(control_connection)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_27_ControlReconnectionHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_27_ControlReconnectionHandler_1__init__ = {"__init__", (PyCFunction)__pyx_pw_9cassandra_7cluster_27_ControlReconnectionHandler_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_27_ControlReconnectionHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_control_connection = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_control_connection,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_control_connection)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_control_connection = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("cassandra.cluster._ControlReconnectionHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_27_ControlReconnectionHandler___init__(__pyx_self, __pyx_v_self, __pyx_v_control_connection, __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_27_ControlReconnectionHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_control_connection, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cassandra/cluster.py":1994
 * 
 *     def __init__(self, control_connection, *args, **kwargs):
 *         _ReconnectionHandler.__init__(self, *args, **kwargs)             # <<<<<<<<<<<<<<
 *         self.control_connection = weakref.proxy(control_connection)
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ReconnectionHandler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __pyx_t_3 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_v_kwargs;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1995
 *     def __init__(self, control_connection, *args, **kwargs):
 *         _ReconnectionHandler.__init__(self, *args, **kwargs)
 *         self.control_connection = weakref.proxy(control_connection)             # <<<<<<<<<<<<<<
 * 
 *     def try_reconnect(self):
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_weakref); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_proxy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_control_connection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_control_connection);
    __Pyx_GIVEREF(__pyx_v_control_connection);
    PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_control_connection);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_control_connection, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1993
 *     """
 * 
 *     def __init__(self, control_connection, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         _ReconnectionHandler.__init__(self, *args, **kwargs)
 *         self.control_connection = weakref.proxy(control_connection)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster._ControlReconnectionHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":1997
 *         self.control_connection = weakref.proxy(control_connection)
 * 
 *     def try_reconnect(self):             # <<<<<<<<<<<<<<
 *         # we'll either get back a new Connection or a NoHostAvailable
 *         return self.control_connection._reconnect_internal()
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_27_ControlReconnectionHandler_3try_reconnect(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_27_ControlReconnectionHandler_3try_reconnect = {"try_reconnect", (PyCFunction)__pyx_pw_9cassandra_7cluster_27_ControlReconnectionHandler_3try_reconnect, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_27_ControlReconnectionHandler_3try_reconnect(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("try_reconnect (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_27_ControlReconnectionHandler_2try_reconnect(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_27_ControlReconnectionHandler_2try_reconnect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("try_reconnect", 0);

  /* "cassandra/cluster.py":1999
 *     def try_reconnect(self):
 *         # we'll either get back a new Connection or a NoHostAvailable
 *         return self.control_connection._reconnect_internal()             # <<<<<<<<<<<<<<
 * 
 *     def on_reconnection(self, connection):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_reconnect_internal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":1997
 *         self.control_connection = weakref.proxy(control_connection)
 * 
 *     def try_reconnect(self):             # <<<<<<<<<<<<<<
 *         # we'll either get back a new Connection or a NoHostAvailable
 *         return self.control_connection._reconnect_internal()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cassandra.cluster._ControlReconnectionHandler.try_reconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2001
 *         return self.control_connection._reconnect_internal()
 * 
 *     def on_reconnection(self, connection):             # <<<<<<<<<<<<<<
 *         self.control_connection._set_new_connection(connection)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_27_ControlReconnectionHandler_5on_reconnection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_27_ControlReconnectionHandler_5on_reconnection = {"on_reconnection", (PyCFunction)__pyx_pw_9cassandra_7cluster_27_ControlReconnectionHandler_5on_reconnection, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_27_ControlReconnectionHandler_5on_reconnection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_connection = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_reconnection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_connection,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_connection)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_reconnection", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_reconnection") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_connection = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_reconnection", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster._ControlReconnectionHandler.on_reconnection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_27_ControlReconnectionHandler_4on_reconnection(__pyx_self, __pyx_v_self, __pyx_v_connection);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_27_ControlReconnectionHandler_4on_reconnection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_connection) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_reconnection", 0);

  /* "cassandra/cluster.py":2002
 * 
 *     def on_reconnection(self, connection):
 *         self.control_connection._set_new_connection(connection)             # <<<<<<<<<<<<<<
 * 
 *     def on_exception(self, exc, next_delay):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_set_new_connection); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_connection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_connection);
    __Pyx_GIVEREF(__pyx_v_connection);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_connection);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2001
 *         return self.control_connection._reconnect_internal()
 * 
 *     def on_reconnection(self, connection):             # <<<<<<<<<<<<<<
 *         self.control_connection._set_new_connection(connection)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster._ControlReconnectionHandler.on_reconnection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2004
 *         self.control_connection._set_new_connection(connection)
 * 
 *     def on_exception(self, exc, next_delay):             # <<<<<<<<<<<<<<
 *         # TODO only overridden to add logging, so add logging
 *         if isinstance(exc, AuthenticationFailed):
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_27_ControlReconnectionHandler_7on_exception(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_27_ControlReconnectionHandler_7on_exception = {"on_exception", (PyCFunction)__pyx_pw_9cassandra_7cluster_27_ControlReconnectionHandler_7on_exception, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_27_ControlReconnectionHandler_7on_exception(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_exc = 0;
  CYTHON_UNUSED PyObject *__pyx_v_next_delay = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_exception (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_exc,&__pyx_n_s_next_delay,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_exception", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_next_delay)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_exception", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_exception") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_exc = values[1];
    __pyx_v_next_delay = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_exception", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster._ControlReconnectionHandler.on_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_27_ControlReconnectionHandler_6on_exception(__pyx_self, __pyx_v_self, __pyx_v_exc, __pyx_v_next_delay);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_27_ControlReconnectionHandler_6on_exception(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_exc, CYTHON_UNUSED PyObject *__pyx_v_next_delay) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_exception", 0);

  /* "cassandra/cluster.py":2006
 *     def on_exception(self, exc, next_delay):
 *         # TODO only overridden to add logging, so add logging
 *         if isinstance(exc, AuthenticationFailed):             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_AuthenticationFailed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_exc, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":2007
 *         # TODO only overridden to add logging, so add logging
 *         if isinstance(exc, AuthenticationFailed):
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             log.debug("Error trying to reconnect control connection: %r", exc)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cassandra/cluster.py":2009
 *             return False
 *         else:
 *             log.debug("Error trying to reconnect control connection: %r", exc)             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Error_trying_to_reconnect_contro);
    __Pyx_GIVEREF(__pyx_kp_s_Error_trying_to_reconnect_contro);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Error_trying_to_reconnect_contro);
    __Pyx_INCREF(__pyx_v_exc);
    __Pyx_GIVEREF(__pyx_v_exc);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_exc);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2010
 *         else:
 *             log.debug("Error trying to reconnect control connection: %r", exc)
 *             return True             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2004
 *         self.control_connection._set_new_connection(connection)
 * 
 *     def on_exception(self, exc, next_delay):             # <<<<<<<<<<<<<<
 *         # TODO only overridden to add logging, so add logging
 *         if isinstance(exc, AuthenticationFailed):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster._ControlReconnectionHandler.on_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2013
 * 
 * 
 * def _watch_callback(obj_weakref, method_name, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     """
 *     A callback handler for the ControlConnection that tolerates
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_15_watch_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_14_watch_callback[] = "\n    A callback handler for the ControlConnection that tolerates\n    weak references.\n    ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_15_watch_callback = {"_watch_callback", (PyCFunction)__pyx_pw_9cassandra_7cluster_15_watch_callback, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_14_watch_callback};
static PyObject *__pyx_pw_9cassandra_7cluster_15_watch_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obj_weakref = 0;
  PyObject *__pyx_v_method_name = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_watch_callback (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj_weakref,&__pyx_n_s_method_name,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_obj_weakref)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_method_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_watch_callback", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "_watch_callback") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_obj_weakref = values[0];
    __pyx_v_method_name = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_watch_callback", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("cassandra.cluster._watch_callback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14_watch_callback(__pyx_self, __pyx_v_obj_weakref, __pyx_v_method_name, __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14_watch_callback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj_weakref, PyObject *__pyx_v_method_name, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_obj = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_watch_callback", 0);

  /* "cassandra/cluster.py":2018
 *     weak references.
 *     """
 *     obj = obj_weakref()             # <<<<<<<<<<<<<<
 *     if obj is None:
 *         return
 */
  __Pyx_INCREF(__pyx_v_obj_weakref);
  __pyx_t_2 = __pyx_v_obj_weakref; __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_obj = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2019
 *     """
 *     obj = obj_weakref()
 *     if obj is None:             # <<<<<<<<<<<<<<
 *         return
 *     getattr(obj, method_name)(*args, **kwargs)
 */
  __pyx_t_4 = (__pyx_v_obj == Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":2020
 *     obj = obj_weakref()
 *     if obj is None:
 *         return             # <<<<<<<<<<<<<<
 *     getattr(obj, method_name)(*args, **kwargs)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2021
 *     if obj is None:
 *         return
 *     getattr(obj, method_name)(*args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_GetAttr(__pyx_v_obj, __pyx_v_method_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_v_kwargs;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "cassandra/cluster.py":2013
 * 
 * 
 * def _watch_callback(obj_weakref, method_name, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     """
 *     A callback handler for the ControlConnection that tolerates
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster._watch_callback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2024
 * 
 * 
 * def _clear_watcher(conn, expiring_weakref):             # <<<<<<<<<<<<<<
 *     """
 *     Called when the ControlConnection object is about to be finalized.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17_clear_watcher(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_16_clear_watcher[] = "\n    Called when the ControlConnection object is about to be finalized.\n    This clears watchers on the underlying Connection object.\n    ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17_clear_watcher = {"_clear_watcher", (PyCFunction)__pyx_pw_9cassandra_7cluster_17_clear_watcher, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_16_clear_watcher};
static PyObject *__pyx_pw_9cassandra_7cluster_17_clear_watcher(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_conn = 0;
  CYTHON_UNUSED PyObject *__pyx_v_expiring_weakref = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_clear_watcher (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_conn,&__pyx_n_s_expiring_weakref,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_conn)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_expiring_weakref)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_clear_watcher", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_clear_watcher") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_conn = values[0];
    __pyx_v_expiring_weakref = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_clear_watcher", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster._clear_watcher", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_16_clear_watcher(__pyx_self, __pyx_v_conn, __pyx_v_expiring_weakref);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_16_clear_watcher(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_conn, CYTHON_UNUSED PyObject *__pyx_v_expiring_weakref) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_clear_watcher", 0);

  /* "cassandra/cluster.py":2029
 *     This clears watchers on the underlying Connection object.
 *     """
 *     try:             # <<<<<<<<<<<<<<
 *         conn.control_conn_disposed()
 *     except ReferenceError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cassandra/cluster.py":2030
 *     """
 *     try:
 *         conn.control_conn_disposed()             # <<<<<<<<<<<<<<
 *     except ReferenceError:
 *         pass
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_conn, __pyx_n_s_control_conn_disposed); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (__pyx_t_6) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2031
 *     try:
 *         conn.control_conn_disposed()
 *     except ReferenceError:             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_ReferenceError);
    if (__pyx_t_7) {
      PyErr_Restore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "cassandra/cluster.py":2024
 * 
 * 
 * def _clear_watcher(conn, expiring_weakref):             # <<<<<<<<<<<<<<
 *     """
 *     Called when the ControlConnection object is about to be finalized.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster._clear_watcher", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2066
 *     _time = time
 * 
 *     def __init__(self, cluster, timeout,             # <<<<<<<<<<<<<<
 *                  schema_event_refresh_window,
 *                  topology_event_refresh_window):
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_1__init__ = {"__init__", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_cluster = 0;
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_v_schema_event_refresh_window = 0;
  PyObject *__pyx_v_topology_event_refresh_window = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_cluster,&__pyx_n_s_timeout,&__pyx_n_s_schema_event_refresh_window,&__pyx_n_s_topology_event_refresh_window,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cluster)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_schema_event_refresh_window)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_topology_event_refresh_window)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_self = values[0];
    __pyx_v_cluster = values[1];
    __pyx_v_timeout = values[2];
    __pyx_v_schema_event_refresh_window = values[3];
    __pyx_v_topology_event_refresh_window = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection___init__(__pyx_self, __pyx_v_self, __pyx_v_cluster, __pyx_v_timeout, __pyx_v_schema_event_refresh_window, __pyx_v_topology_event_refresh_window);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cluster, PyObject *__pyx_v_timeout, PyObject *__pyx_v_schema_event_refresh_window, PyObject *__pyx_v_topology_event_refresh_window) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cassandra/cluster.py":2071
 *         # use a weak reference to allow the Cluster instance to be GC'ed (and
 *         # shutdown) since implementing __del__ disables the cycle detector
 *         self._cluster = weakref.proxy(cluster)             # <<<<<<<<<<<<<<
 *         self._connection = None
 *         self._timeout = timeout
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_weakref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_proxy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cluster); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_cluster);
    __Pyx_GIVEREF(__pyx_v_cluster);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_cluster);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2072
 *         # shutdown) since implementing __del__ disables the cycle detector
 *         self._cluster = weakref.proxy(cluster)
 *         self._connection = None             # <<<<<<<<<<<<<<
 *         self._timeout = timeout
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_connection_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2073
 *         self._cluster = weakref.proxy(cluster)
 *         self._connection = None
 *         self._timeout = timeout             # <<<<<<<<<<<<<<
 * 
 *         self._schema_event_refresh_window = schema_event_refresh_window
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_timeout_2, __pyx_v_timeout) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2075
 *         self._timeout = timeout
 * 
 *         self._schema_event_refresh_window = schema_event_refresh_window             # <<<<<<<<<<<<<<
 *         self._topology_event_refresh_window = topology_event_refresh_window
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_schema_event_refresh_window_2, __pyx_v_schema_event_refresh_window) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2076
 * 
 *         self._schema_event_refresh_window = schema_event_refresh_window
 *         self._topology_event_refresh_window = topology_event_refresh_window             # <<<<<<<<<<<<<<
 * 
 *         self._lock = RLock()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_topology_event_refresh_window_2, __pyx_v_topology_event_refresh_window) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2078
 *         self._topology_event_refresh_window = topology_event_refresh_window
 * 
 *         self._lock = RLock()             # <<<<<<<<<<<<<<
 *         self._schema_agreement_lock = Lock()
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_RLock); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_lock, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2079
 * 
 *         self._lock = RLock()
 *         self._schema_agreement_lock = Lock()             # <<<<<<<<<<<<<<
 * 
 *         self._reconnection_handler = None
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Lock); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_schema_agreement_lock, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2081
 *         self._schema_agreement_lock = Lock()
 * 
 *         self._reconnection_handler = None             # <<<<<<<<<<<<<<
 *         self._reconnection_lock = RLock()
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_handler, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2082
 * 
 *         self._reconnection_handler = None
 *         self._reconnection_lock = RLock()             # <<<<<<<<<<<<<<
 * 
 *         self._event_schedule_times = {}
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_RLock); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_lock, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2084
 *         self._reconnection_lock = RLock()
 * 
 *         self._event_schedule_times = {}             # <<<<<<<<<<<<<<
 * 
 *     def connect(self):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_event_schedule_times, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2066
 *     _time = time
 * 
 *     def __init__(self, cluster, timeout,             # <<<<<<<<<<<<<<
 *                  schema_event_refresh_window,
 *                  topology_event_refresh_window):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2086
 *         self._event_schedule_times = {}
 * 
 *     def connect(self):             # <<<<<<<<<<<<<<
 *         if self._is_shutdown:
 *             return
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_3connect(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_3connect = {"connect", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_3connect, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_3connect(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connect (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_2connect(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_2connect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connect", 0);

  /* "cassandra/cluster.py":2087
 * 
 *     def connect(self):
 *         if self._is_shutdown:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":2088
 *     def connect(self):
 *         if self._is_shutdown:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         self._protocol_version = self._cluster.protocol_version
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2090
 *             return
 * 
 *         self._protocol_version = self._cluster.protocol_version             # <<<<<<<<<<<<<<
 *         self._set_new_connection(self._reconnect_internal())
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_protocol_version); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_protocol_version_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":2091
 * 
 *         self._protocol_version = self._cluster.protocol_version
 *         self._set_new_connection(self._reconnect_internal())             # <<<<<<<<<<<<<<
 * 
 *     def _set_new_connection(self, conn):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_new_connection); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnect_internal); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (__pyx_t_6) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":2086
 *         self._event_schedule_times = {}
 * 
 *     def connect(self):             # <<<<<<<<<<<<<<
 *         if self._is_shutdown:
 *             return
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2093
 *         self._set_new_connection(self._reconnect_internal())
 * 
 *     def _set_new_connection(self, conn):             # <<<<<<<<<<<<<<
 *         """
 *         Replace existing connection (if there is one) and close it.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_5_set_new_connection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_17ControlConnection_4_set_new_connection[] = "\n        Replace existing connection (if there is one) and close it.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_5_set_new_connection = {"_set_new_connection", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_5_set_new_connection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_17ControlConnection_4_set_new_connection};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_5_set_new_connection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_conn = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_new_connection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_conn,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_conn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_new_connection", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_set_new_connection") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_conn = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_set_new_connection", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._set_new_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_4_set_new_connection(__pyx_self, __pyx_v_self, __pyx_v_conn);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_4_set_new_connection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_conn) {
  PyObject *__pyx_v_old = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_new_connection", 0);

  /* "cassandra/cluster.py":2097
 *         Replace existing connection (if there is one) and close it.
 *         """
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             old = self._connection
 *             self._connection = conn
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cassandra/cluster.py":2098
 *         """
 *         with self._lock:
 *             old = self._connection             # <<<<<<<<<<<<<<
 *             self._connection = conn
 * 
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_v_old = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "cassandra/cluster.py":2099
 *         with self._lock:
 *             old = self._connection
 *             self._connection = conn             # <<<<<<<<<<<<<<
 * 
 *         if old:
 */
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_connection_2, __pyx_v_conn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":2097
 *         Replace existing connection (if there is one) and close it.
 *         """
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             old = self._connection
 *             self._connection = conn
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.ControlConnection._set_new_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_4);
            __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__70, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L18;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L18:;
  }

  /* "cassandra/cluster.py":2101
 *             self._connection = conn
 * 
 *         if old:             # <<<<<<<<<<<<<<
 *             log.debug("[control connection] Closing old connection %r, replacing with %r", old, conn)
 *             old.close()
 */
  if (unlikely(!__pyx_v_old)) { __Pyx_RaiseUnboundLocalError("old"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_old); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_11) {

    /* "cassandra/cluster.py":2102
 * 
 *         if old:
 *             log.debug("[control connection] Closing old connection %r, replacing with %r", old, conn)             # <<<<<<<<<<<<<<
 *             old.close()
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_v_old)) { __Pyx_RaiseUnboundLocalError("old"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_3 = NULL;
    __pyx_t_12 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_12 = 1;
      }
    }
    __pyx_t_5 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_control_connection_Closing_old);
    __Pyx_GIVEREF(__pyx_kp_s_control_connection_Closing_old);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_12, __pyx_kp_s_control_connection_Closing_old);
    __Pyx_INCREF(__pyx_v_old);
    __Pyx_GIVEREF(__pyx_v_old);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_12, __pyx_v_old);
    __Pyx_INCREF(__pyx_v_conn);
    __Pyx_GIVEREF(__pyx_v_conn);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_12, __pyx_v_conn);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2103
 *         if old:
 *             log.debug("[control connection] Closing old connection %r, replacing with %r", old, conn)
 *             old.close()             # <<<<<<<<<<<<<<
 * 
 *     def _reconnect_internal(self):
 */
    if (unlikely(!__pyx_v_old)) { __Pyx_RaiseUnboundLocalError("old"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_old, __pyx_n_s_close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L19;
  }
  __pyx_L19:;

  /* "cassandra/cluster.py":2093
 *         self._set_new_connection(self._reconnect_internal())
 * 
 *     def _set_new_connection(self, conn):             # <<<<<<<<<<<<<<
 *         """
 *         Replace existing connection (if there is one) and close it.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._set_new_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_old);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2105
 *             old.close()
 * 
 *     def _reconnect_internal(self):             # <<<<<<<<<<<<<<
 *         """
 *         Tries to connect to each host in the query plan until one succeeds
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_7_reconnect_internal(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cassandra_7cluster_17ControlConnection_6_reconnect_internal[] = "\n        Tries to connect to each host in the query plan until one succeeds\n        or every attempt fails. If successful, a new Connection will be\n        returned.  Otherwise, :exc:`NoHostAvailable` will be raised\n        with an \"errors\" arg that is a dict mapping host addresses\n        to the exception that was raised when an attempt was made to open\n        a connection to that host.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_7_reconnect_internal = {"_reconnect_internal", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_7_reconnect_internal, METH_O, __pyx_doc_9cassandra_7cluster_17ControlConnection_6_reconnect_internal};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_7_reconnect_internal(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_reconnect_internal (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_6_reconnect_internal(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_6_reconnect_internal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_errors = NULL;
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_exc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_reconnect_internal", 0);

  /* "cassandra/cluster.py":2114
 *         a connection to that host.
 *         """
 *         errors = {}             # <<<<<<<<<<<<<<
 *         for host in self._cluster.load_balancing_policy.make_query_plan():
 *             try:
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_errors = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2115
 *         """
 *         errors = {}
 *         for host in self._cluster.load_balancing_policy.make_query_plan():             # <<<<<<<<<<<<<<
 *             try:
 *                 return self._try_connect(host)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_load_balancing_policy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_make_query_plan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_host, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2116
 *         errors = {}
 *         for host in self._cluster.load_balancing_policy.make_query_plan():
 *             try:             # <<<<<<<<<<<<<<
 *                 return self._try_connect(host)
 *             except ConnectionException as exc:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {

        /* "cassandra/cluster.py":2117
 *         for host in self._cluster.load_balancing_policy.make_query_plan():
 *             try:
 *                 return self._try_connect(host)             # <<<<<<<<<<<<<<
 *             except ConnectionException as exc:
 *                 errors[host.address] = exc
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_try_connect); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_9 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (!__pyx_t_9) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
          __Pyx_INCREF(__pyx_v_host);
          __Pyx_GIVEREF(__pyx_v_host);
          PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_host);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L9_try_return;
      }
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "cassandra/cluster.py":2118
 *             try:
 *                 return self._try_connect(host)
 *             except ConnectionException as exc:             # <<<<<<<<<<<<<<
 *                 errors[host.address] = exc
 *                 log.warning("[control connection] Error connecting to %s:", host, exc_info=True)
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConnectionException); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = PyErr_ExceptionMatches(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_11) {
        __Pyx_AddTraceback("cassandra.cluster.ControlConnection._reconnect_internal", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_exc, __pyx_t_3);

        /* "cassandra/cluster.py":2119
 *                 return self._try_connect(host)
 *             except ConnectionException as exc:
 *                 errors[host.address] = exc             # <<<<<<<<<<<<<<
 *                 log.warning("[control connection] Error connecting to %s:", host, exc_info=True)
 *                 self._cluster.signal_connection_failure(host, exc, is_host_addition=False)
 */
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_address); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        if (unlikely(PyDict_SetItem(__pyx_v_errors, __pyx_t_9, __pyx_v_exc) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "cassandra/cluster.py":2120
 *             except ConnectionException as exc:
 *                 errors[host.address] = exc
 *                 log.warning("[control connection] Error connecting to %s:", host, exc_info=True)             # <<<<<<<<<<<<<<
 *                 self._cluster.signal_connection_failure(host, exc, is_host_addition=False)
 *             except Exception as exc:
 */
        __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_warning); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_kp_s_control_connection_Error_connec);
        __Pyx_GIVEREF(__pyx_kp_s_control_connection_Error_connec);
        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_s_control_connection_Error_connec);
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_host);
        __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_13);
        if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_exc_info, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_9, __pyx_t_13); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

        /* "cassandra/cluster.py":2121
 *                 errors[host.address] = exc
 *                 log.warning("[control connection] Error connecting to %s:", host, exc_info=True)
 *                 self._cluster.signal_connection_failure(host, exc, is_host_addition=False)             # <<<<<<<<<<<<<<
 *             except Exception as exc:
 *                 errors[host.address] = exc
 */
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_signal_connection_failure); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_host);
        __Pyx_INCREF(__pyx_v_exc);
        __Pyx_GIVEREF(__pyx_v_exc);
        PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_exc);
        __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_is_host_addition, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_14, __pyx_t_9); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L6_exception_handled;
      }

      /* "cassandra/cluster.py":2122
 *                 log.warning("[control connection] Error connecting to %s:", host, exc_info=True)
 *                 self._cluster.signal_connection_failure(host, exc, is_host_addition=False)
 *             except Exception as exc:             # <<<<<<<<<<<<<<
 *                 errors[host.address] = exc
 *                 log.warning("[control connection] Error connecting to %s:", host, exc_info=True)
 */
      __pyx_t_11 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
      if (__pyx_t_11) {
        __Pyx_AddTraceback("cassandra.cluster.ControlConnection._reconnect_internal", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_exc, __pyx_t_3);

        /* "cassandra/cluster.py":2123
 *                 self._cluster.signal_connection_failure(host, exc, is_host_addition=False)
 *             except Exception as exc:
 *                 errors[host.address] = exc             # <<<<<<<<<<<<<<
 *                 log.warning("[control connection] Error connecting to %s:", host, exc_info=True)
 * 
 */
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_address); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        if (unlikely(PyDict_SetItem(__pyx_v_errors, __pyx_t_12, __pyx_v_exc) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "cassandra/cluster.py":2124
 *             except Exception as exc:
 *                 errors[host.address] = exc
 *                 log.warning("[control connection] Error connecting to %s:", host, exc_info=True)             # <<<<<<<<<<<<<<
 * 
 *         raise NoHostAvailable("Unable to connect to any servers", errors)
 */
        __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_warning); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_INCREF(__pyx_kp_s_control_connection_Error_connec);
        __Pyx_GIVEREF(__pyx_kp_s_control_connection_Error_connec);
        PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_kp_s_control_connection_Error_connec);
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_host);
        __pyx_t_14 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_exc_info, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, __pyx_t_14); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L6_exception_handled;
      }
      goto __pyx_L7_except_error;
      __pyx_L7_except_error:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L1_error;
      __pyx_L9_try_return:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L0;
      __pyx_L6_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    }

    /* "cassandra/cluster.py":2115
 *         """
 *         errors = {}
 *         for host in self._cluster.load_balancing_policy.make_query_plan():             # <<<<<<<<<<<<<<
 *             try:
 *                 return self._try_connect(host)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2126
 *                 log.warning("[control connection] Error connecting to %s:", host, exc_info=True)
 * 
 *         raise NoHostAvailable("Unable to connect to any servers", errors)             # <<<<<<<<<<<<<<
 * 
 *     def _try_connect(self, host):
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_NoHostAvailable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_10 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_Unable_to_connect_to_any_servers);
  __Pyx_GIVEREF(__pyx_kp_s_Unable_to_connect_to_any_servers);
  PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_4, __pyx_kp_s_Unable_to_connect_to_any_servers);
  __Pyx_INCREF(__pyx_v_errors);
  __Pyx_GIVEREF(__pyx_v_errors);
  PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_4, __pyx_v_errors);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2105
 *             old.close()
 * 
 *     def _reconnect_internal(self):             # <<<<<<<<<<<<<<
 *         """
 *         Tries to connect to each host in the query plan until one succeeds
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._reconnect_internal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_errors);
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2128
 *         raise NoHostAvailable("Unable to connect to any servers", errors)
 * 
 *     def _try_connect(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Creates a new Connection, registers for pushed events, and refreshes
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_9_try_connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_17ControlConnection_8_try_connect[] = "\n        Creates a new Connection, registers for pushed events, and refreshes\n        node/token and schema metadata.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_9_try_connect = {"_try_connect", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_9_try_connect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_17ControlConnection_8_try_connect};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_9_try_connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_try_connect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_try_connect", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_try_connect") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_try_connect", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._try_connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_8_try_connect(__pyx_self, __pyx_v_self, __pyx_v_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_8_try_connect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host) {
  PyObject *__pyx_v_connection = NULL;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_self_weakref = NULL;
  PyObject *__pyx_v_peers_query = NULL;
  PyObject *__pyx_v_local_query = NULL;
  PyObject *__pyx_v_shared_results = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_try_connect", 0);

  /* "cassandra/cluster.py":2133
 *         node/token and schema metadata.
 *         """
 *         log.debug("[control connection] Opening new connection to %s", host)             # <<<<<<<<<<<<<<
 * 
 *         while True:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_2) {
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_control_connection_Opening_new);
  __Pyx_GIVEREF(__pyx_kp_s_control_connection_Opening_new);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_kp_s_control_connection_Opening_new);
  __Pyx_INCREF(__pyx_v_host);
  __Pyx_GIVEREF(__pyx_v_host);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_host);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2135
 *         log.debug("[control connection] Opening new connection to %s", host)
 * 
 *         while True:             # <<<<<<<<<<<<<<
 *             try:
 *                 connection = self._cluster.connection_factory(host.address, is_control_connection=True)
 */
  while (1) {

    /* "cassandra/cluster.py":2136
 * 
 *         while True:
 *             try:             # <<<<<<<<<<<<<<
 *                 connection = self._cluster.connection_factory(host.address, is_control_connection=True)
 *                 break
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {

        /* "cassandra/cluster.py":2137
 *         while True:
 *             try:
 *                 connection = self._cluster.connection_factory(host.address, is_control_connection=True)             # <<<<<<<<<<<<<<
 *                 break
 *             except ProtocolVersionUnsupported as e:
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_connection_factory); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_address); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_1);
        if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_is_control_connection, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF_SET(__pyx_v_connection, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "cassandra/cluster.py":2138
 *             try:
 *                 connection = self._cluster.connection_factory(host.address, is_control_connection=True)
 *                 break             # <<<<<<<<<<<<<<
 *             except ProtocolVersionUnsupported as e:
 *                 self._cluster.protocol_downgrade(host.address, e.startup_version)
 */
        goto __pyx_L10_try_break;
      }
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "cassandra/cluster.py":2139
 *                 connection = self._cluster.connection_factory(host.address, is_control_connection=True)
 *                 break
 *             except ProtocolVersionUnsupported as e:             # <<<<<<<<<<<<<<
 *                 self._cluster.protocol_downgrade(host.address, e.startup_version)
 * 
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProtocolVersionUnsupported); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_9) {
        __Pyx_AddTraceback("cassandra.cluster.ControlConnection._try_connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_1);

        /* "cassandra/cluster.py":2140
 *                 break
 *             except ProtocolVersionUnsupported as e:
 *                 self._cluster.protocol_downgrade(host.address, e.startup_version)             # <<<<<<<<<<<<<<
 * 
 *         log.debug("[control connection] Established new connection %r, "
 */
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_protocol_downgrade); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_address); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_e, __pyx_n_s_startup_version); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = NULL;
        __pyx_t_4 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_11, function);
            __pyx_t_4 = 1;
          }
        }
        __pyx_t_14 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        if (__pyx_t_13) {
          __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_4, __pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_4, __pyx_t_12);
        __pyx_t_10 = 0;
        __pyx_t_12 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_14, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L6_exception_handled;
      }
      goto __pyx_L7_except_error;
      __pyx_L7_except_error:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L1_error;
      __pyx_L10_try_break:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L4_break;
      __pyx_L6_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    }
  }
  __pyx_L4_break:;

  /* "cassandra/cluster.py":2142
 *                 self._cluster.protocol_downgrade(host.address, e.startup_version)
 * 
 *         log.debug("[control connection] Established new connection %r, "             # <<<<<<<<<<<<<<
 *                   "registering watchers and refreshing schema and topology",
 *                   connection)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2144
 *         log.debug("[control connection] Established new connection %r, "
 *                   "registering watchers and refreshing schema and topology",
 *                   connection)             # <<<<<<<<<<<<<<
 * 
 *         # use weak references in both directions
 */
  if (unlikely(!__pyx_v_connection)) { __Pyx_RaiseUnboundLocalError("connection"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_1 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_1) {
    __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_control_connection_Established);
  __Pyx_GIVEREF(__pyx_kp_s_control_connection_Established);
  PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_kp_s_control_connection_Established);
  __Pyx_INCREF(__pyx_v_connection);
  __Pyx_GIVEREF(__pyx_v_connection);
  PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_v_connection);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cassandra/cluster.py":2150
 *         # _watch_callback will get the actual callback from the Connection and relay it to
 *         # this object (after a dereferencing a weakref)
 *         self_weakref = weakref.ref(self, callback=partial(_clear_watcher, weakref.proxy(connection)))             # <<<<<<<<<<<<<<
 *         try:
 *             connection.register_watchers({
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_weakref); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_partial); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_clear_watcher); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_weakref); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_proxy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(!__pyx_v_connection)) { __Pyx_RaiseUnboundLocalError("connection"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_10 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_13))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_13);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_13, function);
    }
  }
  if (!__pyx_t_10) {
    __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_connection); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
  } else {
    __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10); __pyx_t_10 = NULL;
    __Pyx_INCREF(__pyx_v_connection);
    __Pyx_GIVEREF(__pyx_v_connection);
    PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_connection);
    __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_15, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_13)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_15 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  if (__pyx_t_13) {
    __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_4, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_4, __pyx_t_12);
  __pyx_t_14 = 0;
  __pyx_t_12 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_callback, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self_weakref = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2151
 *         # this object (after a dereferencing a weakref)
 *         self_weakref = weakref.ref(self, callback=partial(_clear_watcher, weakref.proxy(connection)))
 *         try:             # <<<<<<<<<<<<<<
 *             connection.register_watchers({
 *                 "TOPOLOGY_CHANGE": partial(_watch_callback, self_weakref, '_handle_topology_change'),
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "cassandra/cluster.py":2152
 *         self_weakref = weakref.ref(self, callback=partial(_clear_watcher, weakref.proxy(connection)))
 *         try:
 *             connection.register_watchers({             # <<<<<<<<<<<<<<
 *                 "TOPOLOGY_CHANGE": partial(_watch_callback, self_weakref, '_handle_topology_change'),
 *                 "STATUS_CHANGE": partial(_watch_callback, self_weakref, '_handle_status_change'),
 */
      if (unlikely(!__pyx_v_connection)) { __Pyx_RaiseUnboundLocalError("connection"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L15_error;} }
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_register_watchers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_3);

      /* "cassandra/cluster.py":2153
 *         try:
 *             connection.register_watchers({
 *                 "TOPOLOGY_CHANGE": partial(_watch_callback, self_weakref, '_handle_topology_change'),             # <<<<<<<<<<<<<<
 *                 "STATUS_CHANGE": partial(_watch_callback, self_weakref, '_handle_status_change'),
 *                 "SCHEMA_CHANGE": partial(_watch_callback, self_weakref, '_handle_schema_change')
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_partial); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_watch_callback); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_15 = NULL;
      __pyx_t_4 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_15)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_15);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_4 = 1;
        }
      }
      __pyx_t_12 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_15) {
        __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_15); __pyx_t_15 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_4, __pyx_t_11);
      __Pyx_INCREF(__pyx_v_self_weakref);
      __Pyx_GIVEREF(__pyx_v_self_weakref);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_4, __pyx_v_self_weakref);
      __Pyx_INCREF(__pyx_n_s_handle_topology_change);
      __Pyx_GIVEREF(__pyx_n_s_handle_topology_change);
      PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_4, __pyx_n_s_handle_topology_change);
      __pyx_t_11 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_TOPOLOGY_CHANGE, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cassandra/cluster.py":2154
 *             connection.register_watchers({
 *                 "TOPOLOGY_CHANGE": partial(_watch_callback, self_weakref, '_handle_topology_change'),
 *                 "STATUS_CHANGE": partial(_watch_callback, self_weakref, '_handle_status_change'),             # <<<<<<<<<<<<<<
 *                 "SCHEMA_CHANGE": partial(_watch_callback, self_weakref, '_handle_schema_change')
 *             }, register_timeout=self._timeout)
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_partial); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_watch_callback); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_11 = NULL;
      __pyx_t_4 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_4 = 1;
        }
      }
      __pyx_t_15 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_15);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_4, __pyx_t_12);
      __Pyx_INCREF(__pyx_v_self_weakref);
      __Pyx_GIVEREF(__pyx_v_self_weakref);
      PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_4, __pyx_v_self_weakref);
      __Pyx_INCREF(__pyx_n_s_handle_status_change);
      __Pyx_GIVEREF(__pyx_n_s_handle_status_change);
      PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_4, __pyx_n_s_handle_status_change);
      __pyx_t_12 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_15, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_STATUS_CHANGE, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cassandra/cluster.py":2155
 *                 "TOPOLOGY_CHANGE": partial(_watch_callback, self_weakref, '_handle_topology_change'),
 *                 "STATUS_CHANGE": partial(_watch_callback, self_weakref, '_handle_status_change'),
 *                 "SCHEMA_CHANGE": partial(_watch_callback, self_weakref, '_handle_schema_change')             # <<<<<<<<<<<<<<
 *             }, register_timeout=self._timeout)
 * 
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_partial); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_watch_callback); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_12 = NULL;
      __pyx_t_4 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_4 = 1;
        }
      }
      __pyx_t_11 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_11);
      if (__pyx_t_12) {
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __pyx_t_12 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_4, __pyx_t_15);
      __Pyx_INCREF(__pyx_v_self_weakref);
      __Pyx_GIVEREF(__pyx_v_self_weakref);
      PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_4, __pyx_v_self_weakref);
      __Pyx_INCREF(__pyx_n_s_handle_schema_change);
      __Pyx_GIVEREF(__pyx_n_s_handle_schema_change);
      PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_4, __pyx_n_s_handle_schema_change);
      __pyx_t_15 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_SCHEMA_CHANGE, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cassandra/cluster.py":2152
 *         self_weakref = weakref.ref(self, callback=partial(_clear_watcher, weakref.proxy(connection)))
 *         try:
 *             connection.register_watchers({             # <<<<<<<<<<<<<<
 *                 "TOPOLOGY_CHANGE": partial(_watch_callback, self_weakref, '_handle_topology_change'),
 *                 "STATUS_CHANGE": partial(_watch_callback, self_weakref, '_handle_status_change'),
 */
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_3);

      /* "cassandra/cluster.py":2156
 *                 "STATUS_CHANGE": partial(_watch_callback, self_weakref, '_handle_status_change'),
 *                 "SCHEMA_CHANGE": partial(_watch_callback, self_weakref, '_handle_schema_change')
 *             }, register_timeout=self._timeout)             # <<<<<<<<<<<<<<
 * 
 *             peers_query = QueryMessage(query=self._SELECT_PEERS, consistency_level=ConsistencyLevel.ONE)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_register_timeout, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "cassandra/cluster.py":2152
 *         self_weakref = weakref.ref(self, callback=partial(_clear_watcher, weakref.proxy(connection)))
 *         try:
 *             connection.register_watchers({             # <<<<<<<<<<<<<<
 *                 "TOPOLOGY_CHANGE": partial(_watch_callback, self_weakref, '_handle_topology_change'),
 *                 "STATUS_CHANGE": partial(_watch_callback, self_weakref, '_handle_status_change'),
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "cassandra/cluster.py":2158
 *             }, register_timeout=self._timeout)
 * 
 *             peers_query = QueryMessage(query=self._SELECT_PEERS, consistency_level=ConsistencyLevel.ONE)             # <<<<<<<<<<<<<<
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=ConsistencyLevel.ONE)
 *             shared_results = connection.wait_for_responses(
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_PEERS); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_query, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConsistencyLevel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ONE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_consistency_level, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_peers_query = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "cassandra/cluster.py":2159
 * 
 *             peers_query = QueryMessage(query=self._SELECT_PEERS, consistency_level=ConsistencyLevel.ONE)
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=ConsistencyLevel.ONE)             # <<<<<<<<<<<<<<
 *             shared_results = connection.wait_for_responses(
 *                 peers_query, local_query, timeout=self._timeout)
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_LOCAL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_query, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConsistencyLevel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ONE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_consistency_level, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_local_query = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "cassandra/cluster.py":2160
 *             peers_query = QueryMessage(query=self._SELECT_PEERS, consistency_level=ConsistencyLevel.ONE)
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=ConsistencyLevel.ONE)
 *             shared_results = connection.wait_for_responses(             # <<<<<<<<<<<<<<
 *                 peers_query, local_query, timeout=self._timeout)
 * 
 */
      if (unlikely(!__pyx_v_connection)) { __Pyx_RaiseUnboundLocalError("connection"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L15_error;} }
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_wait_for_responses); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_5);

      /* "cassandra/cluster.py":2161
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=ConsistencyLevel.ONE)
 *             shared_results = connection.wait_for_responses(
 *                 peers_query, local_query, timeout=self._timeout)             # <<<<<<<<<<<<<<
 * 
 *             self._refresh_node_list_and_token_map(connection, preloaded_results=shared_results)
 */
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_peers_query);
      __Pyx_GIVEREF(__pyx_v_peers_query);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_peers_query);
      __Pyx_INCREF(__pyx_v_local_query);
      __Pyx_GIVEREF(__pyx_v_local_query);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_local_query);

      /* "cassandra/cluster.py":2160
 *             peers_query = QueryMessage(query=self._SELECT_PEERS, consistency_level=ConsistencyLevel.ONE)
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=ConsistencyLevel.ONE)
 *             shared_results = connection.wait_for_responses(             # <<<<<<<<<<<<<<
 *                 peers_query, local_query, timeout=self._timeout)
 * 
 */
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_1);

      /* "cassandra/cluster.py":2161
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=ConsistencyLevel.ONE)
 *             shared_results = connection.wait_for_responses(
 *                 peers_query, local_query, timeout=self._timeout)             # <<<<<<<<<<<<<<
 * 
 *             self._refresh_node_list_and_token_map(connection, preloaded_results=shared_results)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_timeout, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "cassandra/cluster.py":2160
 *             peers_query = QueryMessage(query=self._SELECT_PEERS, consistency_level=ConsistencyLevel.ONE)
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=ConsistencyLevel.ONE)
 *             shared_results = connection.wait_for_responses(             # <<<<<<<<<<<<<<
 *                 peers_query, local_query, timeout=self._timeout)
 * 
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_shared_results = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "cassandra/cluster.py":2163
 *                 peers_query, local_query, timeout=self._timeout)
 * 
 *             self._refresh_node_list_and_token_map(connection, preloaded_results=shared_results)             # <<<<<<<<<<<<<<
 *             self._refresh_schema(connection, preloaded_results=shared_results, schema_agreement_wait=-1)
 *         except Exception:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_refresh_node_list_and_token_map_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(!__pyx_v_connection)) { __Pyx_RaiseUnboundLocalError("connection"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L15_error;} }
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_connection);
      __Pyx_GIVEREF(__pyx_v_connection);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_connection);
      __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_preloaded_results, __pyx_v_shared_results) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cassandra/cluster.py":2164
 * 
 *             self._refresh_node_list_and_token_map(connection, preloaded_results=shared_results)
 *             self._refresh_schema(connection, preloaded_results=shared_results, schema_agreement_wait=-1)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             connection.close()
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_refresh_schema_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(!__pyx_v_connection)) { __Pyx_RaiseUnboundLocalError("connection"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L15_error;} }
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_connection);
      __Pyx_GIVEREF(__pyx_v_connection);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_connection);
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_preloaded_results, __pyx_v_shared_results) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_schema_agreement_wait, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L22_try_end;
    __pyx_L15_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2165
 *             self._refresh_node_list_and_token_map(connection, preloaded_results=shared_results)
 *             self._refresh_schema(connection, preloaded_results=shared_results, schema_agreement_wait=-1)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             connection.close()
 *             raise
 */
    __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_9) {
      __Pyx_AddTraceback("cassandra.cluster.ControlConnection._try_connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2165; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);

      /* "cassandra/cluster.py":2166
 *             self._refresh_schema(connection, preloaded_results=shared_results, schema_agreement_wait=-1)
 *         except Exception:
 *             connection.close()             # <<<<<<<<<<<<<<
 *             raise
 * 
 */
      if (unlikely(!__pyx_v_connection)) { __Pyx_RaiseUnboundLocalError("connection"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;} }
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_close); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_15 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_15)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_15);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
        }
      }
      if (__pyx_t_15) {
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_15); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      } else {
        __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cassandra/cluster.py":2167
 *         except Exception:
 *             connection.close()
 *             raise             # <<<<<<<<<<<<<<
 * 
 *         return connection
 */
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ErrRestore(__pyx_t_2, __pyx_t_1, __pyx_t_3);
      __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0; 
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
    }
    goto __pyx_L17_except_error;
    __pyx_L17_except_error:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L22_try_end:;
  }

  /* "cassandra/cluster.py":2169
 *             raise
 * 
 *         return connection             # <<<<<<<<<<<<<<
 * 
 *     def reconnect(self):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_connection)) { __Pyx_RaiseUnboundLocalError("connection"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __Pyx_INCREF(__pyx_v_connection);
  __pyx_r = __pyx_v_connection;
  goto __pyx_L0;

  /* "cassandra/cluster.py":2128
 *         raise NoHostAvailable("Unable to connect to any servers", errors)
 * 
 *     def _try_connect(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Creates a new Connection, registers for pushed events, and refreshes
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._try_connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_connection);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_self_weakref);
  __Pyx_XDECREF(__pyx_v_peers_query);
  __Pyx_XDECREF(__pyx_v_local_query);
  __Pyx_XDECREF(__pyx_v_shared_results);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2171
 *         return connection
 * 
 *     def reconnect(self):             # <<<<<<<<<<<<<<
 *         if self._is_shutdown:
 *             return
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_11reconnect(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_11reconnect = {"reconnect", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_11reconnect, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_11reconnect(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reconnect (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_10reconnect(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_10reconnect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reconnect", 0);

  /* "cassandra/cluster.py":2172
 * 
 *     def reconnect(self):
 *         if self._is_shutdown:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":2173
 *     def reconnect(self):
 *         if self._is_shutdown:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         self._submit(self._reconnect)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2175
 *             return
 * 
 *         self._submit(self._reconnect)             # <<<<<<<<<<<<<<
 * 
 *     def _reconnect(self):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_submit_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnect); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2171
 *         return connection
 * 
 *     def reconnect(self):             # <<<<<<<<<<<<<<
 *         if self._is_shutdown:
 *             return
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.reconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2177
 *         self._submit(self._reconnect)
 * 
 *     def _reconnect(self):             # <<<<<<<<<<<<<<
 *         log.debug("[control connection] Attempting to reconnect")
 *         try:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_13_reconnect(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_13_reconnect = {"_reconnect", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_13_reconnect, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_13_reconnect(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_reconnect (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_12_reconnect(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_12_reconnect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_schedule = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_reconnect", 0);

  /* "cassandra/cluster.py":2178
 * 
 *     def _reconnect(self):
 *         log.debug("[control connection] Attempting to reconnect")             # <<<<<<<<<<<<<<
 *         try:
 *             self._set_new_connection(self._reconnect_internal())
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__71, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2179
 *     def _reconnect(self):
 *         log.debug("[control connection] Attempting to reconnect")
 *         try:             # <<<<<<<<<<<<<<
 *             self._set_new_connection(self._reconnect_internal())
 *         except NoHostAvailable:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "cassandra/cluster.py":2180
 *         log.debug("[control connection] Attempting to reconnect")
 *         try:
 *             self._set_new_connection(self._reconnect_internal())             # <<<<<<<<<<<<<<
 *         except NoHostAvailable:
 *             # make a retry schedule (which includes backoff)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_new_connection); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnect_internal); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_8) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_7) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2181
 *         try:
 *             self._set_new_connection(self._reconnect_internal())
 *         except NoHostAvailable:             # <<<<<<<<<<<<<<
 *             # make a retry schedule (which includes backoff)
 *             schedule = self.cluster.reconnection_policy.new_schedule()
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_NoHostAvailable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_9) {
      __Pyx_AddTraceback("cassandra.cluster.ControlConnection._reconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_8);

      /* "cassandra/cluster.py":2183
 *         except NoHostAvailable:
 *             # make a retry schedule (which includes backoff)
 *             schedule = self.cluster.reconnection_policy.new_schedule()             # <<<<<<<<<<<<<<
 * 
 *             with self._reconnection_lock:
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_reconnection_policy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_new_schedule); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_10) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_10); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else {
        __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_schedule = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "cassandra/cluster.py":2185
 *             schedule = self.cluster.reconnection_policy.new_schedule()
 * 
 *             with self._reconnection_lock:             # <<<<<<<<<<<<<<
 * 
 *                 # cancel existing reconnection attempts
 */
      /*with:*/ {
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_lock); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_11 = __Pyx_PyObject_LookupSpecial(__pyx_t_6, __pyx_n_s_exit); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_10 = __Pyx_PyObject_LookupSpecial(__pyx_t_6, __pyx_n_s_enter); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_12 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        if (__pyx_t_12) {
          __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_12); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        } else {
          __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
        }
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        /*try:*/ {
          {
            __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
            __Pyx_XGOTREF(__pyx_t_13);
            __Pyx_XGOTREF(__pyx_t_14);
            __Pyx_XGOTREF(__pyx_t_15);
            /*try:*/ {

              /* "cassandra/cluster.py":2188
 * 
 *                 # cancel existing reconnection attempts
 *                 if self._reconnection_handler:             # <<<<<<<<<<<<<<
 *                     self._reconnection_handler.cancel()
 * 
 */
              __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_handler); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
              __Pyx_GOTREF(__pyx_t_6);
              __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (__pyx_t_16) {

                /* "cassandra/cluster.py":2189
 *                 # cancel existing reconnection attempts
 *                 if self._reconnection_handler:
 *                     self._reconnection_handler.cancel()             # <<<<<<<<<<<<<<
 * 
 *                 # when a connection is successfully made, _set_new_connection
 */
                __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_handler); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
                __Pyx_GOTREF(__pyx_t_7);
                __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_cancel); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
                __Pyx_GOTREF(__pyx_t_10);
                __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
                __pyx_t_7 = NULL;
                if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_10))) {
                  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_10);
                  if (likely(__pyx_t_7)) {
                    PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
                    __Pyx_INCREF(__pyx_t_7);
                    __Pyx_INCREF(function);
                    __Pyx_DECREF_SET(__pyx_t_10, function);
                  }
                }
                if (__pyx_t_7) {
                  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
                  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
                } else {
                  __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_10); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
                }
                __Pyx_GOTREF(__pyx_t_6);
                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
                goto __pyx_L27;
              }
              __pyx_L27:;

              /* "cassandra/cluster.py":2194
 *                 # will be called with the new connection and then our
 *                 # _reconnection_handler will be cleared out
 *                 self._reconnection_handler = _ControlReconnectionHandler(             # <<<<<<<<<<<<<<
 *                     self, self._cluster.scheduler, schedule,
 *                     self._get_and_set_reconnection_handler,
 */
              __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_ControlReconnectionHandler); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
              __Pyx_GOTREF(__pyx_t_6);

              /* "cassandra/cluster.py":2195
 *                 # _reconnection_handler will be cleared out
 *                 self._reconnection_handler = _ControlReconnectionHandler(
 *                     self, self._cluster.scheduler, schedule,             # <<<<<<<<<<<<<<
 *                     self._get_and_set_reconnection_handler,
 *                     new_handler=None)
 */
              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_scheduler); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
              __Pyx_GOTREF(__pyx_t_7);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

              /* "cassandra/cluster.py":2196
 *                 self._reconnection_handler = _ControlReconnectionHandler(
 *                     self, self._cluster.scheduler, schedule,
 *                     self._get_and_set_reconnection_handler,             # <<<<<<<<<<<<<<
 *                     new_handler=None)
 *                 self._reconnection_handler.start()
 */
              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_and_set_reconnection_handle); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
              __Pyx_GOTREF(__pyx_t_10);

              /* "cassandra/cluster.py":2194
 *                 # will be called with the new connection and then our
 *                 # _reconnection_handler will be cleared out
 *                 self._reconnection_handler = _ControlReconnectionHandler(             # <<<<<<<<<<<<<<
 *                     self, self._cluster.scheduler, schedule,
 *                     self._get_and_set_reconnection_handler,
 */
              __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_INCREF(__pyx_v_self);
              __Pyx_GIVEREF(__pyx_v_self);
              PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_self);
              __Pyx_GIVEREF(__pyx_t_7);
              PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_7);
              __Pyx_INCREF(__pyx_v_schedule);
              __Pyx_GIVEREF(__pyx_v_schedule);
              PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_v_schedule);
              __Pyx_GIVEREF(__pyx_t_10);
              PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_10);
              __pyx_t_7 = 0;
              __pyx_t_10 = 0;
              __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
              __Pyx_GOTREF(__pyx_t_10);

              /* "cassandra/cluster.py":2197
 *                     self, self._cluster.scheduler, schedule,
 *                     self._get_and_set_reconnection_handler,
 *                     new_handler=None)             # <<<<<<<<<<<<<<
 *                 self._reconnection_handler.start()
 *         except Exception:
 */
              if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_new_handler, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L19_error;}

              /* "cassandra/cluster.py":2194
 *                 # will be called with the new connection and then our
 *                 # _reconnection_handler will be cleared out
 *                 self._reconnection_handler = _ControlReconnectionHandler(             # <<<<<<<<<<<<<<
 *                     self, self._cluster.scheduler, schedule,
 *                     self._get_and_set_reconnection_handler,
 */
              __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_12, __pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
              __Pyx_GOTREF(__pyx_t_7);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_handler, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

              /* "cassandra/cluster.py":2198
 *                     self._get_and_set_reconnection_handler,
 *                     new_handler=None)
 *                 self._reconnection_handler.start()             # <<<<<<<<<<<<<<
 *         except Exception:
 *             log.debug("[control connection] error reconnecting", exc_info=True)
 */
              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_handler); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_start); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __pyx_t_10 = NULL;
              if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_12))) {
                __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12);
                if (likely(__pyx_t_10)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
                  __Pyx_INCREF(__pyx_t_10);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_12, function);
                }
              }
              if (__pyx_t_10) {
                __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              } else {
                __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
              }
              __Pyx_GOTREF(__pyx_t_7);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            }
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            goto __pyx_L26_try_end;
            __pyx_L19_error:;
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

            /* "cassandra/cluster.py":2185
 *             schedule = self.cluster.reconnection_policy.new_schedule()
 * 
 *             with self._reconnection_lock:             # <<<<<<<<<<<<<<
 * 
 *                 # cancel existing reconnection attempts
 */
            /*except:*/ {
              __Pyx_AddTraceback("cassandra.cluster.ControlConnection._reconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_12, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L21_except_error;}
              __Pyx_GOTREF(__pyx_t_7);
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_6 = PyTuple_Pack(3, __pyx_t_7, __pyx_t_12, __pyx_t_10); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L21_except_error;}
              __Pyx_GOTREF(__pyx_t_6);
              __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_6, NULL);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L21_except_error;}
              __Pyx_GOTREF(__pyx_t_17);
              __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_17);
              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
              if (__pyx_t_16 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L21_except_error;}
              __pyx_t_18 = ((!(__pyx_t_16 != 0)) != 0);
              if (__pyx_t_18) {
                __Pyx_GIVEREF(__pyx_t_7);
                __Pyx_GIVEREF(__pyx_t_12);
                __Pyx_XGIVEREF(__pyx_t_10);
                __Pyx_ErrRestore(__pyx_t_7, __pyx_t_12, __pyx_t_10);
                __pyx_t_7 = 0; __pyx_t_12 = 0; __pyx_t_10 = 0; 
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L21_except_error;}
              }
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              goto __pyx_L20_exception_handled;
            }
            __pyx_L21_except_error:;
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_XGIVEREF(__pyx_t_14);
            __Pyx_XGIVEREF(__pyx_t_15);
            __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
            goto __pyx_L5_except_error;
            __pyx_L20_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_XGIVEREF(__pyx_t_14);
            __Pyx_XGIVEREF(__pyx_t_15);
            __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
            __pyx_L26_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_11) {
              __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__72, NULL);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
              __Pyx_GOTREF(__pyx_t_15);
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            }
            goto __pyx_L18;
          }
          __pyx_L18:;
        }
        goto __pyx_L31;
        __pyx_L13_error:;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L5_except_error;
        __pyx_L31:;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L4_exception_handled;
    }

    /* "cassandra/cluster.py":2199
 *                     new_handler=None)
 *                 self._reconnection_handler.start()
 *         except Exception:             # <<<<<<<<<<<<<<
 *             log.debug("[control connection] error reconnecting", exc_info=True)
 *             raise
 */
    __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_9) {
      __Pyx_AddTraceback("cassandra.cluster.ControlConnection._reconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2199; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);

      /* "cassandra/cluster.py":2200
 *                 self._reconnection_handler.start()
 *         except Exception:
 *             log.debug("[control connection] error reconnecting", exc_info=True)             # <<<<<<<<<<<<<<
 *             raise
 * 
 */
      __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_debug); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_exc_info, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__73, __pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "cassandra/cluster.py":2201
 *         except Exception:
 *             log.debug("[control connection] error reconnecting", exc_info=True)
 *             raise             # <<<<<<<<<<<<<<
 * 
 *     def _get_and_set_reconnection_handler(self, new_handler):
 */
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_ErrRestore(__pyx_t_8, __pyx_t_2, __pyx_t_1);
      __pyx_t_8 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; 
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2201; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L10_try_end:;
  }

  /* "cassandra/cluster.py":2177
 *         self._submit(self._reconnect)
 * 
 *     def _reconnect(self):             # <<<<<<<<<<<<<<
 *         log.debug("[control connection] Attempting to reconnect")
 *         try:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._reconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_schedule);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2203
 *             raise
 * 
 *     def _get_and_set_reconnection_handler(self, new_handler):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the _ControlReconnectionHandler when a new connection
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_15_get_and_set_reconnection_handler(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_17ControlConnection_14_get_and_set_reconnection_handler[] = "\n        Called by the _ControlReconnectionHandler when a new connection\n        is successfully created.  Clears out the _reconnection_handler on\n        this ControlConnection.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_15_get_and_set_reconnection_handler = {"_get_and_set_reconnection_handler", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_15_get_and_set_reconnection_handler, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_17ControlConnection_14_get_and_set_reconnection_handler};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_15_get_and_set_reconnection_handler(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_new_handler = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_and_set_reconnection_handler (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_new_handler,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_new_handler)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_get_and_set_reconnection_handler", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_get_and_set_reconnection_handler") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_new_handler = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_and_set_reconnection_handler", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._get_and_set_reconnection_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_14_get_and_set_reconnection_handler(__pyx_self, __pyx_v_self, __pyx_v_new_handler);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_14_get_and_set_reconnection_handler(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_new_handler) {
  PyObject *__pyx_v_old = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_and_set_reconnection_handler", 0);

  /* "cassandra/cluster.py":2209
 *         this ControlConnection.
 *         """
 *         with self._reconnection_lock:             # <<<<<<<<<<<<<<
 *             old = self._reconnection_handler
 *             self._reconnection_handler = new_handler
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cassandra/cluster.py":2210
 *         """
 *         with self._reconnection_lock:
 *             old = self._reconnection_handler             # <<<<<<<<<<<<<<
 *             self._reconnection_handler = new_handler
 *             return old
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_handler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2210; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_v_old = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "cassandra/cluster.py":2211
 *         with self._reconnection_lock:
 *             old = self._reconnection_handler
 *             self._reconnection_handler = new_handler             # <<<<<<<<<<<<<<
 *             return old
 * 
 */
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_handler, __pyx_v_new_handler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L7_error;}

          /* "cassandra/cluster.py":2212
 *             old = self._reconnection_handler
 *             self._reconnection_handler = new_handler
 *             return old             # <<<<<<<<<<<<<<
 * 
 *     def _submit(self, *args, **kwargs):
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(__pyx_v_old);
          __pyx_r = __pyx_v_old;
          goto __pyx_L11_try_return;
        }
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":2209
 *         this ControlConnection.
 *         """
 *         with self._reconnection_lock:             # <<<<<<<<<<<<<<
 *             old = self._reconnection_handler
 *             self._reconnection_handler = new_handler
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.ControlConnection._get_and_set_reconnection_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_4);
            __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L4_return;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__74, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_8 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_2) {
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__75, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __pyx_r = __pyx_t_8;
        __pyx_t_8 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L18;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L18:;
  }

  /* "cassandra/cluster.py":2203
 *             raise
 * 
 *     def _get_and_set_reconnection_handler(self, new_handler):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the _ControlReconnectionHandler when a new connection
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._get_and_set_reconnection_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_old);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2214
 *             return old
 * 
 *     def _submit(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         try:
 *             if not self._cluster.is_shutdown:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_17_submit(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_17_submit = {"_submit", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_17_submit, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_17_submit(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_submit (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "_submit") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_submit", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._submit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_16_submit(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_16_submit(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_submit", 0);

  /* "cassandra/cluster.py":2215
 * 
 *     def _submit(self, *args, **kwargs):
 *         try:             # <<<<<<<<<<<<<<
 *             if not self._cluster.is_shutdown:
 *                 return self._cluster.executor.submit(*args, **kwargs)
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cassandra/cluster.py":2216
 *     def _submit(self, *args, **kwargs):
 *         try:
 *             if not self._cluster.is_shutdown:             # <<<<<<<<<<<<<<
 *                 return self._cluster.executor.submit(*args, **kwargs)
 *         except ReferenceError:
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = ((!__pyx_t_6) != 0);
      if (__pyx_t_7) {

        /* "cassandra/cluster.py":2217
 *         try:
 *             if not self._cluster.is_shutdown:
 *                 return self._cluster.executor.submit(*args, **kwargs)             # <<<<<<<<<<<<<<
 *         except ReferenceError:
 *             pass
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_executor); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_submit); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_8 = __pyx_v_kwargs;
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_r = __pyx_t_9;
        __pyx_t_9 = 0;
        goto __pyx_L7_try_return;
      }
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "cassandra/cluster.py":2218
 *             if not self._cluster.is_shutdown:
 *                 return self._cluster.executor.submit(*args, **kwargs)
 *         except ReferenceError:             # <<<<<<<<<<<<<<
 *             pass
 *         return None
 */
    __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_ReferenceError);
    if (__pyx_t_10) {
      PyErr_Restore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "cassandra/cluster.py":2220
 *         except ReferenceError:
 *             pass
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def shutdown(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "cassandra/cluster.py":2214
 *             return old
 * 
 *     def _submit(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         try:
 *             if not self._cluster.is_shutdown:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._submit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2222
 *         return None
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         # stop trying to reconnect (if we are)
 *         with self._reconnection_lock:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_19shutdown(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_19shutdown = {"shutdown", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_19shutdown, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_19shutdown(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shutdown (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_18shutdown(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_18shutdown(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shutdown", 0);

  /* "cassandra/cluster.py":2224
 *     def shutdown(self):
 *         # stop trying to reconnect (if we are)
 *         with self._reconnection_lock:             # <<<<<<<<<<<<<<
 *             if self._reconnection_handler:
 *                 self._reconnection_handler.cancel()
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cassandra/cluster.py":2225
 *         # stop trying to reconnect (if we are)
 *         with self._reconnection_lock:
 *             if self._reconnection_handler:             # <<<<<<<<<<<<<<
 *                 self._reconnection_handler.cancel()
 * 
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_handler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_9) {

            /* "cassandra/cluster.py":2226
 *         with self._reconnection_lock:
 *             if self._reconnection_handler:
 *                 self._reconnection_handler.cancel()             # <<<<<<<<<<<<<<
 * 
 *         with self._lock:
 */
            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_handler); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2226; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cancel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2226; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_t_3 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
              if (likely(__pyx_t_3)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                __Pyx_INCREF(__pyx_t_3);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_4, function);
              }
            }
            if (__pyx_t_3) {
              __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2226; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            } else {
              __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2226; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            }
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            goto __pyx_L15;
          }
          __pyx_L15:;
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":2224
 *     def shutdown(self):
 *         # stop trying to reconnect (if we are)
 *         with self._reconnection_lock:             # <<<<<<<<<<<<<<
 *             if self._reconnection_handler:
 *                 self._reconnection_handler.cancel()
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.ControlConnection.shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (__pyx_t_9 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_11 = ((!(__pyx_t_9 != 0)) != 0);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_4);
            __Pyx_XGIVEREF(__pyx_t_3);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_4, __pyx_t_3);
            __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__76, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L19;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L19:;
  }

  /* "cassandra/cluster.py":2228
 *                 self._reconnection_handler.cancel()
 * 
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self._is_shutdown:
 *                 return
 */
  /*with:*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lock); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_6);
        /*try:*/ {

          /* "cassandra/cluster.py":2229
 * 
 *         with self._lock:
 *             if self._is_shutdown:             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (__pyx_t_11) {

            /* "cassandra/cluster.py":2230
 *         with self._lock:
 *             if self._is_shutdown:
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 self._is_shutdown = True
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            goto __pyx_L28_try_return;
          }
          /*else*/ {

            /* "cassandra/cluster.py":2232
 *                 return
 *             else:
 *                 self._is_shutdown = True             # <<<<<<<<<<<<<<
 * 
 *             log.debug("Shutting down control connection")
 */
            if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown_2, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2232; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
          }

          /* "cassandra/cluster.py":2234
 *                 self._is_shutdown = True
 * 
 *             log.debug("Shutting down control connection")             # <<<<<<<<<<<<<<
 *             if self._connection:
 *                 self._connection.close()
 */
          __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2234; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2234; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__77, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2234; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "cassandra/cluster.py":2235
 * 
 *             log.debug("Shutting down control connection")
 *             if self._connection:             # <<<<<<<<<<<<<<
 *                 self._connection.close()
 *                 del self._connection
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (__pyx_t_11) {

            /* "cassandra/cluster.py":2236
 *             log.debug("Shutting down control connection")
 *             if self._connection:
 *                 self._connection.close()             # <<<<<<<<<<<<<<
 *                 del self._connection
 * 
 */
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2236; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2236; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_4 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
              if (likely(__pyx_t_4)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_1, function);
              }
            }
            if (__pyx_t_4) {
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2236; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            } else {
              __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2236; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
            }
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "cassandra/cluster.py":2237
 *             if self._connection:
 *                 self._connection.close()
 *                 del self._connection             # <<<<<<<<<<<<<<
 * 
 *     def refresh_schema(self, keyspace=None, table=None, usertype=None, function=None,
 */
            if (__Pyx_PyObject_DelAttrStr(__pyx_v_self, __pyx_n_s_connection_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2237; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
            goto __pyx_L33;
          }
          __pyx_L33:;
        }
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L31_try_end;
        __pyx_L24_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "cassandra/cluster.py":2228
 *                 self._reconnection_handler.cancel()
 * 
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self._is_shutdown:
 *                 return
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.ControlConnection.shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
          __pyx_t_9 = ((!(__pyx_t_11 != 0)) != 0);
          if (__pyx_t_9) {
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestore(__pyx_t_3, __pyx_t_1, __pyx_t_4);
            __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
          }
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L25_exception_handled;
        }
        __pyx_L26_except_error:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
        goto __pyx_L1_error;
        __pyx_L28_try_return:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
        goto __pyx_L21_return;
        __pyx_L25_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
        __pyx_L31_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__78, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        goto __pyx_L23;
      }
      __pyx_L21_return: {
        __pyx_t_6 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_2) {
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__79, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __pyx_r = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L0;
      }
      __pyx_L23:;
    }
    goto __pyx_L37;
    __pyx_L20_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L37:;
  }

  /* "cassandra/cluster.py":2222
 *         return None
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         # stop trying to reconnect (if we are)
 *         with self._reconnection_lock:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2239
 *                 del self._connection
 * 
 *     def refresh_schema(self, keyspace=None, table=None, usertype=None, function=None,             # <<<<<<<<<<<<<<
 *                        aggregate=None, schema_agreement_wait=None):
 *         if not self._meta_refresh_enabled:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_21refresh_schema(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_21refresh_schema = {"refresh_schema", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_21refresh_schema, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_21refresh_schema(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_keyspace = 0;
  PyObject *__pyx_v_table = 0;
  PyObject *__pyx_v_usertype = 0;
  PyObject *__pyx_v_function = 0;
  PyObject *__pyx_v_aggregate = 0;
  PyObject *__pyx_v_schema_agreement_wait = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refresh_schema (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_keyspace,&__pyx_n_s_table,&__pyx_n_s_usertype,&__pyx_n_s_function,&__pyx_n_s_aggregate,&__pyx_n_s_schema_agreement_wait,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    values[4] = ((PyObject *)((PyObject *)Py_None));

    /* "cassandra/cluster.py":2240
 * 
 *     def refresh_schema(self, keyspace=None, table=None, usertype=None, function=None,
 *                        aggregate=None, schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         if not self._meta_refresh_enabled:
 *             log.debug("[control connection] Skipping schema refresh because meta refresh is disabled")
 */
    values[5] = ((PyObject *)((PyObject *)Py_None));
    values[6] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_table);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_usertype);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_function);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_aggregate);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_schema_agreement_wait);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "refresh_schema") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2239; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_keyspace = values[1];
    __pyx_v_table = values[2];
    __pyx_v_usertype = values[3];
    __pyx_v_function = values[4];
    __pyx_v_aggregate = values[5];
    __pyx_v_schema_agreement_wait = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("refresh_schema", 0, 1, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2239; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.refresh_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_20refresh_schema(__pyx_self, __pyx_v_self, __pyx_v_keyspace, __pyx_v_table, __pyx_v_usertype, __pyx_v_function, __pyx_v_aggregate, __pyx_v_schema_agreement_wait);

  /* "cassandra/cluster.py":2239
 *                 del self._connection
 * 
 *     def refresh_schema(self, keyspace=None, table=None, usertype=None, function=None,             # <<<<<<<<<<<<<<
 *                        aggregate=None, schema_agreement_wait=None):
 *         if not self._meta_refresh_enabled:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_20refresh_schema(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_table, PyObject *__pyx_v_usertype, PyObject *__pyx_v_function, PyObject *__pyx_v_aggregate, PyObject *__pyx_v_schema_agreement_wait) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("refresh_schema", 0);

  /* "cassandra/cluster.py":2241
 *     def refresh_schema(self, keyspace=None, table=None, usertype=None, function=None,
 *                        aggregate=None, schema_agreement_wait=None):
 *         if not self._meta_refresh_enabled:             # <<<<<<<<<<<<<<
 *             log.debug("[control connection] Skipping schema refresh because meta refresh is disabled")
 *             return False
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_meta_refresh_enabled); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":2242
 *                        aggregate=None, schema_agreement_wait=None):
 *         if not self._meta_refresh_enabled:
 *             log.debug("[control connection] Skipping schema refresh because meta refresh is disabled")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__80, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2243
 *         if not self._meta_refresh_enabled:
 *             log.debug("[control connection] Skipping schema refresh because meta refresh is disabled")
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2245
 *             return False
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self._connection:
 *                 return self._refresh_schema(self._connection, keyspace, table, usertype, function,
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    /*try:*/ {

      /* "cassandra/cluster.py":2246
 * 
 *         try:
 *             if self._connection:             # <<<<<<<<<<<<<<
 *                 return self._refresh_schema(self._connection, keyspace, table, usertype, function,
 *                                             aggregate, schema_agreement_wait=schema_agreement_wait)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_3) {

        /* "cassandra/cluster.py":2247
 *         try:
 *             if self._connection:
 *                 return self._refresh_schema(self._connection, keyspace, table, usertype, function,             # <<<<<<<<<<<<<<
 *                                             aggregate, schema_agreement_wait=schema_agreement_wait)
 *         except ReferenceError:
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_refresh_schema_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_4);

        /* "cassandra/cluster.py":2248
 *             if self._connection:
 *                 return self._refresh_schema(self._connection, keyspace, table, usertype, function,
 *                                             aggregate, schema_agreement_wait=schema_agreement_wait)             # <<<<<<<<<<<<<<
 *         except ReferenceError:
 *             pass  # our weak reference to the Cluster is no good
 */
        __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
        __Pyx_INCREF(__pyx_v_keyspace);
        __Pyx_GIVEREF(__pyx_v_keyspace);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_keyspace);
        __Pyx_INCREF(__pyx_v_table);
        __Pyx_GIVEREF(__pyx_v_table);
        PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_table);
        __Pyx_INCREF(__pyx_v_usertype);
        __Pyx_GIVEREF(__pyx_v_usertype);
        PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_v_usertype);
        __Pyx_INCREF(__pyx_v_function);
        __Pyx_GIVEREF(__pyx_v_function);
        PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_function);
        __Pyx_INCREF(__pyx_v_aggregate);
        __Pyx_GIVEREF(__pyx_v_aggregate);
        PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_v_aggregate);
        __pyx_t_4 = 0;

        /* "cassandra/cluster.py":2247
 *         try:
 *             if self._connection:
 *                 return self._refresh_schema(self._connection, keyspace, table, usertype, function,             # <<<<<<<<<<<<<<
 *                                             aggregate, schema_agreement_wait=schema_agreement_wait)
 *         except ReferenceError:
 */
        __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_4);

        /* "cassandra/cluster.py":2248
 *             if self._connection:
 *                 return self._refresh_schema(self._connection, keyspace, table, usertype, function,
 *                                             aggregate, schema_agreement_wait=schema_agreement_wait)             # <<<<<<<<<<<<<<
 *         except ReferenceError:
 *             pass  # our weak reference to the Cluster is no good
 */
        if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_schema_agreement_wait, __pyx_v_schema_agreement_wait) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; __pyx_clineno = __LINE__; goto __pyx_L4_error;}

        /* "cassandra/cluster.py":2247
 *         try:
 *             if self._connection:
 *                 return self._refresh_schema(self._connection, keyspace, table, usertype, function,             # <<<<<<<<<<<<<<
 *                                             aggregate, schema_agreement_wait=schema_agreement_wait)
 *         except ReferenceError:
 */
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_r = __pyx_t_9;
        __pyx_t_9 = 0;
        goto __pyx_L8_try_return;
      }
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "cassandra/cluster.py":2249
 *                 return self._refresh_schema(self._connection, keyspace, table, usertype, function,
 *                                             aggregate, schema_agreement_wait=schema_agreement_wait)
 *         except ReferenceError:             # <<<<<<<<<<<<<<
 *             pass  # our weak reference to the Cluster is no good
 *         except Exception:
 */
    __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_ReferenceError);
    if (__pyx_t_10) {
      PyErr_Restore(0,0,0);
      goto __pyx_L5_exception_handled;
    }

    /* "cassandra/cluster.py":2251
 *         except ReferenceError:
 *             pass  # our weak reference to the Cluster is no good
 *         except Exception:             # <<<<<<<<<<<<<<
 *             log.debug("[control connection] Error refreshing schema", exc_info=True)
 *             self._signal_error()
 */
    __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_10) {
      __Pyx_AddTraceback("cassandra.cluster.ControlConnection.refresh_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_4, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2251; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_8);

      /* "cassandra/cluster.py":2252
 *             pass  # our weak reference to the Cluster is no good
 *         except Exception:
 *             log.debug("[control connection] Error refreshing schema", exc_info=True)             # <<<<<<<<<<<<<<
 *             self._signal_error()
 *         return False
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2252; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2252; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2252; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_exc_info, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2252; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__81, __pyx_t_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2252; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "cassandra/cluster.py":2253
 *         except Exception:
 *             log.debug("[control connection] Error refreshing schema", exc_info=True)
 *             self._signal_error()             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_signal_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (__pyx_t_11) {
        __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L8_try_return:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    goto __pyx_L0;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    __pyx_L11_try_end:;
  }

  /* "cassandra/cluster.py":2254
 *             log.debug("[control connection] Error refreshing schema", exc_info=True)
 *             self._signal_error()
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def _refresh_schema(self, connection, keyspace=None, table=None, usertype=None, function=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "cassandra/cluster.py":2239
 *                 del self._connection
 * 
 *     def refresh_schema(self, keyspace=None, table=None, usertype=None, function=None,             # <<<<<<<<<<<<<<
 *                        aggregate=None, schema_agreement_wait=None):
 *         if not self._meta_refresh_enabled:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.refresh_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2256
 *         return False
 * 
 *     def _refresh_schema(self, connection, keyspace=None, table=None, usertype=None, function=None,             # <<<<<<<<<<<<<<
 *                         aggregate=None, preloaded_results=None, schema_agreement_wait=None):
 *         if self._cluster.is_shutdown:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_23_refresh_schema(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_23_refresh_schema = {"_refresh_schema", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_23_refresh_schema, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_23_refresh_schema(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_connection = 0;
  PyObject *__pyx_v_keyspace = 0;
  PyObject *__pyx_v_table = 0;
  PyObject *__pyx_v_usertype = 0;
  PyObject *__pyx_v_function = 0;
  PyObject *__pyx_v_aggregate = 0;
  PyObject *__pyx_v_preloaded_results = 0;
  PyObject *__pyx_v_schema_agreement_wait = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_refresh_schema (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_connection,&__pyx_n_s_keyspace,&__pyx_n_s_table,&__pyx_n_s_usertype,&__pyx_n_s_function,&__pyx_n_s_aggregate,&__pyx_n_s_preloaded_results,&__pyx_n_s_schema_agreement_wait,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    values[4] = ((PyObject *)((PyObject *)Py_None));
    values[5] = ((PyObject *)((PyObject *)Py_None));

    /* "cassandra/cluster.py":2257
 * 
 *     def _refresh_schema(self, connection, keyspace=None, table=None, usertype=None, function=None,
 *                         aggregate=None, preloaded_results=None, schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         if self._cluster.is_shutdown:
 *             return False
 */
    values[6] = ((PyObject *)((PyObject *)Py_None));
    values[7] = ((PyObject *)((PyObject *)Py_None));
    values[8] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_connection)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_refresh_schema", 0, 2, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2256; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_table);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_usertype);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_function);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_aggregate);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_preloaded_results);
          if (value) { values[7] = value; kw_args--; }
        }
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_schema_agreement_wait);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_refresh_schema") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2256; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_connection = values[1];
    __pyx_v_keyspace = values[2];
    __pyx_v_table = values[3];
    __pyx_v_usertype = values[4];
    __pyx_v_function = values[5];
    __pyx_v_aggregate = values[6];
    __pyx_v_preloaded_results = values[7];
    __pyx_v_schema_agreement_wait = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_refresh_schema", 0, 2, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2256; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._refresh_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_22_refresh_schema(__pyx_self, __pyx_v_self, __pyx_v_connection, __pyx_v_keyspace, __pyx_v_table, __pyx_v_usertype, __pyx_v_function, __pyx_v_aggregate, __pyx_v_preloaded_results, __pyx_v_schema_agreement_wait);

  /* "cassandra/cluster.py":2256
 *         return False
 * 
 *     def _refresh_schema(self, connection, keyspace=None, table=None, usertype=None, function=None,             # <<<<<<<<<<<<<<
 *                         aggregate=None, preloaded_results=None, schema_agreement_wait=None):
 *         if self._cluster.is_shutdown:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2272
 *         cl = ConsistencyLevel.ONE
 *         if table:
 *             def _handle_results(success, result):             # <<<<<<<<<<<<<<
 *                 if success:
 *                     return dict_factory(*result.results) if result else {}
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_15_refresh_schema_1_handle_results(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_15_refresh_schema_1_handle_results = {"_handle_results", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_15_refresh_schema_1_handle_results, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_15_refresh_schema_1_handle_results(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_success = 0;
  PyObject *__pyx_v_result = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handle_results (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_success,&__pyx_n_s_result,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_success)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_handle_results", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2272; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_handle_results") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2272; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_success = values[0];
    __pyx_v_result = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_handle_results", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2272; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._refresh_schema._handle_results", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema__handle_results(__pyx_self, __pyx_v_success, __pyx_v_result);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema__handle_results(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_success, PyObject *__pyx_v_result) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handle_results", 0);

  /* "cassandra/cluster.py":2273
 *         if table:
 *             def _handle_results(success, result):
 *                 if success:             # <<<<<<<<<<<<<<
 *                     return dict_factory(*result.results) if result else {}
 *                 else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_success); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cassandra/cluster.py":2274
 *             def _handle_results(success, result):
 *                 if success:
 *                     return dict_factory(*result.results) if result else {}             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise result
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_result); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_results); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
    } else {
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cassandra/cluster.py":2276
 *                     return dict_factory(*result.results) if result else {}
 *                 else:
 *                     raise result             # <<<<<<<<<<<<<<
 * 
 *             # a particular table changed
 */
    __Pyx_Raise(__pyx_v_result, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":2272
 *         cl = ConsistencyLevel.ONE
 *         if table:
 *             def _handle_results(success, result):             # <<<<<<<<<<<<<<
 *                 if success:
 *                     return dict_factory(*result.results) if result else {}
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._refresh_schema._handle_results", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_9cassandra_7cluster_17ControlConnection_15_refresh_schema_4generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "cassandra/cluster.py":2261
 *             return False
 * 
 *         assert sum(1 for arg in (table, usertype, function, aggregate) if arg) <= 1             # <<<<<<<<<<<<<<
 * 
 *         agreed = self.wait_for_schema_agreement(connection,
 */

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema_2genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_13_genexpr(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_13_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_9cassandra_7cluster_17ControlConnection_15_refresh_schema_4generator3, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_ControlConnection__refresh_schem); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._refresh_schema.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_9cassandra_7cluster_17ControlConnection_15_refresh_schema_4generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L7_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_table)) { __Pyx_RaiseClosureNameError("table"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_usertype)) { __Pyx_RaiseClosureNameError("usertype"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_function)) { __Pyx_RaiseClosureNameError("function"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_aggregate)) { __Pyx_RaiseClosureNameError("aggregate"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_table);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_table);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_table);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_usertype);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_usertype);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_usertype);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_function);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_function);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_function);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_aggregate);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_aggregate);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_aggregate);
  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_3 >= 4) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_arg);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_arg, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_arg); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {
      __Pyx_INCREF(__pyx_int_1);
      __pyx_r = __pyx_int_1;
      __Pyx_XGIVEREF(__pyx_t_2);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 1;
      return __pyx_r;
      __pyx_L7_resume_from_yield:;
      __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
      __pyx_cur_scope->__pyx_t_0 = 0;
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
      if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}
static PyObject *__pyx_gb_9cassandra_7cluster_17ControlConnection_15_refresh_schema_7generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "cassandra/cluster.py":2308
 *             # user defined function within this keyspace changed
 *             where_clause = " WHERE keyspace_name = '%s' AND function_name = '%s' AND signature = [%s]" \
 *                            % (keyspace, function.name, ','.join("'%s'" % t for t in function.type_signature))             # <<<<<<<<<<<<<<
 *             functions_query = QueryMessage(query=self._SELECT_FUNCTIONS + where_clause, consistency_level=cl)
 *             functions_result = connection.wait_for_response(functions_query)
 */

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema_5genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_14_genexpr(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_14_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_9cassandra_7cluster_17ControlConnection_15_refresh_schema_7generator4, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_ControlConnection__refresh_schem); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._refresh_schema.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_9cassandra_7cluster_17ControlConnection_15_refresh_schema_7generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_function)) { __Pyx_RaiseClosureNameError("function"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_function, __pyx_n_s_type_signature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_t);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_t, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_2, __pyx_cur_scope->__pyx_v_t); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}
static PyObject *__pyx_gb_9cassandra_7cluster_17ControlConnection_15_refresh_schema_10generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "cassandra/cluster.py":2317
 *             # user defined aggregate within this keyspace changed
 *             where_clause = " WHERE keyspace_name = '%s' AND aggregate_name = '%s' AND signature = [%s]" \
 *                            % (keyspace, aggregate.name, ','.join("'%s'" % t for t in aggregate.type_signature))             # <<<<<<<<<<<<<<
 *             aggregates_query = QueryMessage(query=self._SELECT_AGGREGATES + where_clause, consistency_level=cl)
 *             aggregates_result = connection.wait_for_response(aggregates_query)
 */

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema_8genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_15_genexpr(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_15_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_9cassandra_7cluster_17ControlConnection_15_refresh_schema_10generator5, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_ControlConnection__refresh_schem); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._refresh_schema.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_9cassandra_7cluster_17ControlConnection_15_refresh_schema_10generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_aggregate)) { __Pyx_RaiseClosureNameError("aggregate"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_aggregate, __pyx_n_s_type_signature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_t);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_t, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_2, __pyx_cur_scope->__pyx_v_t); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "cassandra/cluster.py":2256
 *         return False
 * 
 *     def _refresh_schema(self, connection, keyspace=None, table=None, usertype=None, function=None,             # <<<<<<<<<<<<<<
 *                         aggregate=None, preloaded_results=None, schema_agreement_wait=None):
 *         if self._cluster.is_shutdown:
 */

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_22_refresh_schema(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_connection, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_table, PyObject *__pyx_v_usertype, PyObject *__pyx_v_function, PyObject *__pyx_v_aggregate, PyObject *__pyx_v_preloaded_results, PyObject *__pyx_v_schema_agreement_wait) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *__pyx_cur_scope;
  PyObject *__pyx_v_agreed = NULL;
  PyObject *__pyx_v_cl = NULL;
  PyObject *__pyx_v__handle_results = 0;
  PyObject *__pyx_v_where_clause = NULL;
  PyObject *__pyx_v_cf_query = NULL;
  PyObject *__pyx_v_col_query = NULL;
  PyObject *__pyx_v_triggers_query = NULL;
  PyObject *__pyx_v_cf_success = NULL;
  PyObject *__pyx_v_cf_result = NULL;
  PyObject *__pyx_v_col_success = NULL;
  PyObject *__pyx_v_col_result = NULL;
  PyObject *__pyx_v_triggers_success = NULL;
  PyObject *__pyx_v_triggers_result = NULL;
  PyObject *__pyx_v_types_query = NULL;
  PyObject *__pyx_v_types_result = NULL;
  PyObject *__pyx_v_functions_query = NULL;
  PyObject *__pyx_v_functions_result = NULL;
  PyObject *__pyx_v_aggregates_query = NULL;
  PyObject *__pyx_v_aggregates_result = NULL;
  PyObject *__pyx_v_ks_query = NULL;
  PyObject *__pyx_v_ks_result = NULL;
  PyObject *__pyx_v_queries = NULL;
  PyObject *__pyx_v_responses = NULL;
  PyObject *__pyx_v_ks_success = NULL;
  PyObject *__pyx_v_types_success = NULL;
  PyObject *__pyx_v_functions_success = NULL;
  PyObject *__pyx_v_aggregates_success = NULL;
  PyObject *__pyx_v_trigger_success = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_refresh_schema", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_table = __pyx_v_table;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_table);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_table);
  __pyx_cur_scope->__pyx_v_usertype = __pyx_v_usertype;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_usertype);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_usertype);
  __pyx_cur_scope->__pyx_v_function = __pyx_v_function;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_function);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_function);
  __pyx_cur_scope->__pyx_v_aggregate = __pyx_v_aggregate;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_aggregate);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_aggregate);

  /* "cassandra/cluster.py":2258
 *     def _refresh_schema(self, connection, keyspace=None, table=None, usertype=None, function=None,
 *                         aggregate=None, preloaded_results=None, schema_agreement_wait=None):
 *         if self._cluster.is_shutdown:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":2259
 *                         aggregate=None, preloaded_results=None, schema_agreement_wait=None):
 *         if self._cluster.is_shutdown:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         assert sum(1 for arg in (table, usertype, function, aggregate) if arg) <= 1
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2261
 *             return False
 * 
 *         assert sum(1 for arg in (table, usertype, function, aggregate) if arg) <= 1             # <<<<<<<<<<<<<<
 * 
 *         agreed = self.wait_for_schema_agreement(connection,
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = __pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema_2genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_sum, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_1, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "cassandra/cluster.py":2263
 *         assert sum(1 for arg in (table, usertype, function, aggregate) if arg) <= 1
 * 
 *         agreed = self.wait_for_schema_agreement(connection,             # <<<<<<<<<<<<<<
 *                                                 preloaded_results=preloaded_results,
 *                                                 wait_time=schema_agreement_wait)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_wait_for_schema_agreement); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_connection);
  __Pyx_GIVEREF(__pyx_v_connection);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_connection);
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "cassandra/cluster.py":2264
 * 
 *         agreed = self.wait_for_schema_agreement(connection,
 *                                                 preloaded_results=preloaded_results,             # <<<<<<<<<<<<<<
 *                                                 wait_time=schema_agreement_wait)
 *         if not agreed:
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_preloaded_results, __pyx_v_preloaded_results) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2265
 *         agreed = self.wait_for_schema_agreement(connection,
 *                                                 preloaded_results=preloaded_results,
 *                                                 wait_time=schema_agreement_wait)             # <<<<<<<<<<<<<<
 *         if not agreed:
 *             log.debug("Skipping schema refresh due to lack of schema agreement")
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_wait_time, __pyx_v_schema_agreement_wait) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2263
 *         assert sum(1 for arg in (table, usertype, function, aggregate) if arg) <= 1
 * 
 *         agreed = self.wait_for_schema_agreement(connection,             # <<<<<<<<<<<<<<
 *                                                 preloaded_results=preloaded_results,
 *                                                 wait_time=schema_agreement_wait)
 */
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_agreed = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cassandra/cluster.py":2266
 *                                                 preloaded_results=preloaded_results,
 *                                                 wait_time=schema_agreement_wait)
 *         if not agreed:             # <<<<<<<<<<<<<<
 *             log.debug("Skipping schema refresh due to lack of schema agreement")
 *             return False
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_agreed); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((!__pyx_t_3) != 0);
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":2267
 *                                                 wait_time=schema_agreement_wait)
 *         if not agreed:
 *             log.debug("Skipping schema refresh due to lack of schema agreement")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__82, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2268
 *         if not agreed:
 *             log.debug("Skipping schema refresh due to lack of schema agreement")
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         cl = ConsistencyLevel.ONE
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2270
 *             return False
 * 
 *         cl = ConsistencyLevel.ONE             # <<<<<<<<<<<<<<
 *         if table:
 *             def _handle_results(success, result):
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConsistencyLevel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ONE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_cl = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cassandra/cluster.py":2271
 * 
 *         cl = ConsistencyLevel.ONE
 *         if table:             # <<<<<<<<<<<<<<
 *             def _handle_results(success, result):
 *                 if success:
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_table); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":2272
 *         cl = ConsistencyLevel.ONE
 *         if table:
 *             def _handle_results(success, result):             # <<<<<<<<<<<<<<
 *                 if success:
 *                     return dict_factory(*result.results) if result else {}
 */
    __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_15_refresh_schema_1_handle_results, 0, __pyx_n_s_ControlConnection__refresh_schem_2, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v__handle_results = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2279
 * 
 *             # a particular table changed
 *             where_clause = " WHERE keyspace_name = '%s' AND columnfamily_name = '%s'" % (keyspace, table)             # <<<<<<<<<<<<<<
 *             cf_query = QueryMessage(query=self._SELECT_COLUMN_FAMILIES + where_clause, consistency_level=cl)
 *             col_query = QueryMessage(query=self._SELECT_COLUMNS + where_clause, consistency_level=cl)
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_keyspace);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_table);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_table);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_cur_scope->__pyx_v_table);
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_WHERE_keyspace_name_s_AND_colum, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_where_clause = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2280
 *             # a particular table changed
 *             where_clause = " WHERE keyspace_name = '%s' AND columnfamily_name = '%s'" % (keyspace, table)
 *             cf_query = QueryMessage(query=self._SELECT_COLUMN_FAMILIES + where_clause, consistency_level=cl)             # <<<<<<<<<<<<<<
 *             col_query = QueryMessage(query=self._SELECT_COLUMNS + where_clause, consistency_level=cl)
 *             triggers_query = QueryMessage(query=self._SELECT_TRIGGERS + where_clause, consistency_level=cl)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_COLUMN_FAMILIES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_where_clause); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_query, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_cf_query = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2281
 *             where_clause = " WHERE keyspace_name = '%s' AND columnfamily_name = '%s'" % (keyspace, table)
 *             cf_query = QueryMessage(query=self._SELECT_COLUMN_FAMILIES + where_clause, consistency_level=cl)
 *             col_query = QueryMessage(query=self._SELECT_COLUMNS + where_clause, consistency_level=cl)             # <<<<<<<<<<<<<<
 *             triggers_query = QueryMessage(query=self._SELECT_TRIGGERS + where_clause, consistency_level=cl)
 *             (cf_success, cf_result), (col_success, col_result), (triggers_success, triggers_result) \
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_COLUMNS); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_v_where_clause); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_query, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_col_query = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2282
 *             cf_query = QueryMessage(query=self._SELECT_COLUMN_FAMILIES + where_clause, consistency_level=cl)
 *             col_query = QueryMessage(query=self._SELECT_COLUMNS + where_clause, consistency_level=cl)
 *             triggers_query = QueryMessage(query=self._SELECT_TRIGGERS + where_clause, consistency_level=cl)             # <<<<<<<<<<<<<<
 *             (cf_success, cf_result), (col_success, col_result), (triggers_success, triggers_result) \
 *                 = connection.wait_for_responses(cf_query, col_query, triggers_query, timeout=self._timeout, fail_on_error=False)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_TRIGGERS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_v_where_clause); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_query, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_triggers_query = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2284
 *             triggers_query = QueryMessage(query=self._SELECT_TRIGGERS + where_clause, consistency_level=cl)
 *             (cf_success, cf_result), (col_success, col_result), (triggers_success, triggers_result) \
 *                 = connection.wait_for_responses(cf_query, col_query, triggers_query, timeout=self._timeout, fail_on_error=False)             # <<<<<<<<<<<<<<
 * 
 *             log.debug("[control connection] Fetched table info for %s.%s, rebuilding metadata", keyspace, table)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_wait_for_responses); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_cf_query);
    __Pyx_GIVEREF(__pyx_v_cf_query);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_cf_query);
    __Pyx_INCREF(__pyx_v_col_query);
    __Pyx_GIVEREF(__pyx_v_col_query);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_col_query);
    __Pyx_INCREF(__pyx_v_triggers_query);
    __Pyx_GIVEREF(__pyx_v_triggers_query);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_triggers_query);
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_timeout, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_fail_on_error, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 2; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L7_unpacking_done:;
    }

    /* "cassandra/cluster.py":2283
 *             col_query = QueryMessage(query=self._SELECT_COLUMNS + where_clause, consistency_level=cl)
 *             triggers_query = QueryMessage(query=self._SELECT_TRIGGERS + where_clause, consistency_level=cl)
 *             (cf_success, cf_result), (col_success, col_result), (triggers_success, triggers_result) \             # <<<<<<<<<<<<<<
 *                 = connection.wait_for_responses(cf_query, col_query, triggers_query, timeout=self._timeout, fail_on_error=False)
 * 
 */
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L9_unpacking_done;
      __pyx_L8_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L9_unpacking_done:;
    }
    __pyx_v_cf_success = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_cf_result = __pyx_t_9;
    __pyx_t_9 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L11_unpacking_done;
      __pyx_L10_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L11_unpacking_done:;
    }
    __pyx_v_col_success = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_col_result = __pyx_t_7;
    __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L13_unpacking_done;
      __pyx_L12_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L13_unpacking_done:;
    }
    __pyx_v_triggers_success = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_triggers_result = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "cassandra/cluster.py":2286
 *                 = connection.wait_for_responses(cf_query, col_query, triggers_query, timeout=self._timeout, fail_on_error=False)
 * 
 *             log.debug("[control connection] Fetched table info for %s.%s, rebuilding metadata", keyspace, table)             # <<<<<<<<<<<<<<
 *             cf_result = _handle_results(cf_success, cf_result)
 *             col_result = _handle_results(col_success, col_result)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_11 = 1;
      }
    }
    __pyx_t_2 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_control_connection_Fetched_tabl);
    __Pyx_GIVEREF(__pyx_kp_s_control_connection_Fetched_tabl);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_11, __pyx_kp_s_control_connection_Fetched_tabl);
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_11, __pyx_v_keyspace);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_table);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_table);
    PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_11, __pyx_cur_scope->__pyx_v_table);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2287
 * 
 *             log.debug("[control connection] Fetched table info for %s.%s, rebuilding metadata", keyspace, table)
 *             cf_result = _handle_results(cf_success, cf_result)             # <<<<<<<<<<<<<<
 *             col_result = _handle_results(col_success, col_result)
 * 
 */
    __pyx_t_1 = __pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema__handle_results(__pyx_v__handle_results, __pyx_v_cf_success, __pyx_v_cf_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_cf_result, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2288
 *             log.debug("[control connection] Fetched table info for %s.%s, rebuilding metadata", keyspace, table)
 *             cf_result = _handle_results(cf_success, cf_result)
 *             col_result = _handle_results(col_success, col_result)             # <<<<<<<<<<<<<<
 * 
 *             # handle the triggers table not existing in Cassandra 1.2
 */
    __pyx_t_1 = __pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema__handle_results(__pyx_v__handle_results, __pyx_v_col_success, __pyx_v_col_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_col_result, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2291
 * 
 *             # handle the triggers table not existing in Cassandra 1.2
 *             if not triggers_success and isinstance(triggers_result, InvalidRequest):             # <<<<<<<<<<<<<<
 *                 triggers_result = {}
 *             else:
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_triggers_success); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = ((!__pyx_t_3) != 0);
    if (__pyx_t_12) {
    } else {
      __pyx_t_6 = __pyx_t_12;
      goto __pyx_L15_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_InvalidRequest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = PyObject_IsInstance(__pyx_v_triggers_result, __pyx_t_1); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = (__pyx_t_12 != 0);
    __pyx_t_6 = __pyx_t_3;
    __pyx_L15_bool_binop_done:;
    if (__pyx_t_6) {

      /* "cassandra/cluster.py":2292
 *             # handle the triggers table not existing in Cassandra 1.2
 *             if not triggers_success and isinstance(triggers_result, InvalidRequest):
 *                 triggers_result = {}             # <<<<<<<<<<<<<<
 *             else:
 *                 triggers_result = _handle_results(triggers_success, triggers_result)
 */
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_triggers_result, __pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L14;
    }
    /*else*/ {

      /* "cassandra/cluster.py":2294
 *                 triggers_result = {}
 *             else:
 *                 triggers_result = _handle_results(triggers_success, triggers_result)             # <<<<<<<<<<<<<<
 * 
 *             self._cluster.metadata.table_changed(keyspace, table, cf_result, col_result, triggers_result)
 */
      __pyx_t_1 = __pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema__handle_results(__pyx_v__handle_results, __pyx_v_triggers_success, __pyx_v_triggers_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_triggers_result, __pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L14:;

    /* "cassandra/cluster.py":2296
 *                 triggers_result = _handle_results(triggers_success, triggers_result)
 * 
 *             self._cluster.metadata.table_changed(keyspace, table, cf_result, col_result, triggers_result)             # <<<<<<<<<<<<<<
 *         elif usertype:
 *             # user defined types within this keyspace changed
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_metadata); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_table_changed); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_11 = 1;
      }
    }
    __pyx_t_5 = PyTuple_New(5+__pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_11, __pyx_v_keyspace);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_table);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_table);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_11, __pyx_cur_scope->__pyx_v_table);
    __Pyx_INCREF(__pyx_v_cf_result);
    __Pyx_GIVEREF(__pyx_v_cf_result);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_11, __pyx_v_cf_result);
    __Pyx_INCREF(__pyx_v_col_result);
    __Pyx_GIVEREF(__pyx_v_col_result);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_11, __pyx_v_col_result);
    __Pyx_INCREF(__pyx_v_triggers_result);
    __Pyx_GIVEREF(__pyx_v_triggers_result);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_11, __pyx_v_triggers_result);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L5;
  }

  /* "cassandra/cluster.py":2297
 * 
 *             self._cluster.metadata.table_changed(keyspace, table, cf_result, col_result, triggers_result)
 *         elif usertype:             # <<<<<<<<<<<<<<
 *             # user defined types within this keyspace changed
 *             where_clause = " WHERE keyspace_name = '%s' AND type_name = '%s'" % (keyspace, usertype)
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_usertype); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":2299
 *         elif usertype:
 *             # user defined types within this keyspace changed
 *             where_clause = " WHERE keyspace_name = '%s' AND type_name = '%s'" % (keyspace, usertype)             # <<<<<<<<<<<<<<
 *             types_query = QueryMessage(query=self._SELECT_USERTYPES + where_clause, consistency_level=cl)
 *             types_result = connection.wait_for_response(types_query)
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_keyspace);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_usertype);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_usertype);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_usertype);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_WHERE_keyspace_name_s_AND_type, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_where_clause = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2300
 *             # user defined types within this keyspace changed
 *             where_clause = " WHERE keyspace_name = '%s' AND type_name = '%s'" % (keyspace, usertype)
 *             types_query = QueryMessage(query=self._SELECT_USERTYPES + where_clause, consistency_level=cl)             # <<<<<<<<<<<<<<
 *             types_result = connection.wait_for_response(types_query)
 *             log.debug("[control connection] Fetched user type info for %s.%s, rebuilding metadata", keyspace, usertype)
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_USERTYPES); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_v_where_clause); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_query, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_types_query = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2301
 *             where_clause = " WHERE keyspace_name = '%s' AND type_name = '%s'" % (keyspace, usertype)
 *             types_query = QueryMessage(query=self._SELECT_USERTYPES + where_clause, consistency_level=cl)
 *             types_result = connection.wait_for_response(types_query)             # <<<<<<<<<<<<<<
 *             log.debug("[control connection] Fetched user type info for %s.%s, rebuilding metadata", keyspace, usertype)
 *             types_result = dict_factory(*types_result.results) if types_result.results else {}
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_wait_for_response); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_types_query); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_types_query);
      __Pyx_GIVEREF(__pyx_v_types_query);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_types_query);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_types_result = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2302
 *             types_query = QueryMessage(query=self._SELECT_USERTYPES + where_clause, consistency_level=cl)
 *             types_result = connection.wait_for_response(types_query)
 *             log.debug("[control connection] Fetched user type info for %s.%s, rebuilding metadata", keyspace, usertype)             # <<<<<<<<<<<<<<
 *             types_result = dict_factory(*types_result.results) if types_result.results else {}
 *             self._cluster.metadata.usertype_changed(keyspace, usertype, types_result)
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_11 = 1;
      }
    }
    __pyx_t_4 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_control_connection_Fetched_user);
    __Pyx_GIVEREF(__pyx_kp_s_control_connection_Fetched_user);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_11, __pyx_kp_s_control_connection_Fetched_user);
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_11, __pyx_v_keyspace);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_usertype);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_usertype);
    PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_11, __pyx_cur_scope->__pyx_v_usertype);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2303
 *             types_result = connection.wait_for_response(types_query)
 *             log.debug("[control connection] Fetched user type info for %s.%s, rebuilding metadata", keyspace, usertype)
 *             types_result = dict_factory(*types_result.results) if types_result.results else {}             # <<<<<<<<<<<<<<
 *             self._cluster.metadata.usertype_changed(keyspace, usertype, types_result)
 *         elif function:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_types_result, __pyx_n_s_results); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_6) {
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_types_result, __pyx_n_s_results); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
    } else {
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __Pyx_DECREF_SET(__pyx_v_types_result, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2304
 *             log.debug("[control connection] Fetched user type info for %s.%s, rebuilding metadata", keyspace, usertype)
 *             types_result = dict_factory(*types_result.results) if types_result.results else {}
 *             self._cluster.metadata.usertype_changed(keyspace, usertype, types_result)             # <<<<<<<<<<<<<<
 *         elif function:
 *             # user defined function within this keyspace changed
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_metadata); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_usertype_changed); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_11 = 1;
      }
    }
    __pyx_t_5 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_11, __pyx_v_keyspace);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_usertype);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_usertype);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_11, __pyx_cur_scope->__pyx_v_usertype);
    __Pyx_INCREF(__pyx_v_types_result);
    __Pyx_GIVEREF(__pyx_v_types_result);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_11, __pyx_v_types_result);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L5;
  }

  /* "cassandra/cluster.py":2305
 *             types_result = dict_factory(*types_result.results) if types_result.results else {}
 *             self._cluster.metadata.usertype_changed(keyspace, usertype, types_result)
 *         elif function:             # <<<<<<<<<<<<<<
 *             # user defined function within this keyspace changed
 *             where_clause = " WHERE keyspace_name = '%s' AND function_name = '%s' AND signature = [%s]" \
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_function); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":2308
 *             # user defined function within this keyspace changed
 *             where_clause = " WHERE keyspace_name = '%s' AND function_name = '%s' AND signature = [%s]" \
 *                            % (keyspace, function.name, ','.join("'%s'" % t for t in function.type_signature))             # <<<<<<<<<<<<<<
 *             functions_query = QueryMessage(query=self._SELECT_FUNCTIONS + where_clause, consistency_level=cl)
 *             functions_result = connection.wait_for_response(functions_query)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_function, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema_5genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyString_Join(__pyx_kp_s__85, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_5);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_WHERE_keyspace_name_s_AND_funct, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_where_clause = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2309
 *             where_clause = " WHERE keyspace_name = '%s' AND function_name = '%s' AND signature = [%s]" \
 *                            % (keyspace, function.name, ','.join("'%s'" % t for t in function.type_signature))
 *             functions_query = QueryMessage(query=self._SELECT_FUNCTIONS + where_clause, consistency_level=cl)             # <<<<<<<<<<<<<<
 *             functions_result = connection.wait_for_response(functions_query)
 *             log.debug("[control connection] Fetched user function info for %s.%s, rebuilding metadata", keyspace, function.signature)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_FUNCTIONS); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_where_clause); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_query, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_functions_query = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2310
 *                            % (keyspace, function.name, ','.join("'%s'" % t for t in function.type_signature))
 *             functions_query = QueryMessage(query=self._SELECT_FUNCTIONS + where_clause, consistency_level=cl)
 *             functions_result = connection.wait_for_response(functions_query)             # <<<<<<<<<<<<<<
 *             log.debug("[control connection] Fetched user function info for %s.%s, rebuilding metadata", keyspace, function.signature)
 *             functions_result = dict_factory(*functions_result.results) if functions_result.results else {}
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_wait_for_response); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_functions_query); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_functions_query);
      __Pyx_GIVEREF(__pyx_v_functions_query);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_functions_query);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_functions_result = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2311
 *             functions_query = QueryMessage(query=self._SELECT_FUNCTIONS + where_clause, consistency_level=cl)
 *             functions_result = connection.wait_for_response(functions_query)
 *             log.debug("[control connection] Fetched user function info for %s.%s, rebuilding metadata", keyspace, function.signature)             # <<<<<<<<<<<<<<
 *             functions_result = dict_factory(*functions_result.results) if functions_result.results else {}
 *             self._cluster.metadata.function_changed(keyspace, function, functions_result)
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_function, __pyx_n_s_signature); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_11 = 1;
      }
    }
    __pyx_t_9 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_control_connection_Fetched_user_2);
    __Pyx_GIVEREF(__pyx_kp_s_control_connection_Fetched_user_2);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_11, __pyx_kp_s_control_connection_Fetched_user_2);
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_11, __pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_11, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2312
 *             functions_result = connection.wait_for_response(functions_query)
 *             log.debug("[control connection] Fetched user function info for %s.%s, rebuilding metadata", keyspace, function.signature)
 *             functions_result = dict_factory(*functions_result.results) if functions_result.results else {}             # <<<<<<<<<<<<<<
 *             self._cluster.metadata.function_changed(keyspace, function, functions_result)
 *         elif aggregate:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_functions_result, __pyx_n_s_results); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_6) {
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_functions_result, __pyx_n_s_results); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_4 = PySequence_Tuple(__pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = __pyx_t_9;
      __pyx_t_9 = 0;
    } else {
      __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __pyx_t_9;
      __pyx_t_9 = 0;
    }
    __Pyx_DECREF_SET(__pyx_v_functions_result, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2313
 *             log.debug("[control connection] Fetched user function info for %s.%s, rebuilding metadata", keyspace, function.signature)
 *             functions_result = dict_factory(*functions_result.results) if functions_result.results else {}
 *             self._cluster.metadata.function_changed(keyspace, function, functions_result)             # <<<<<<<<<<<<<<
 *         elif aggregate:
 *             # user defined aggregate within this keyspace changed
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_metadata); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_function_changed); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_11 = 1;
      }
    }
    __pyx_t_2 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_11, __pyx_v_keyspace);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_function);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_function);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_11, __pyx_cur_scope->__pyx_v_function);
    __Pyx_INCREF(__pyx_v_functions_result);
    __Pyx_GIVEREF(__pyx_v_functions_result);
    PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_11, __pyx_v_functions_result);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L5;
  }

  /* "cassandra/cluster.py":2314
 *             functions_result = dict_factory(*functions_result.results) if functions_result.results else {}
 *             self._cluster.metadata.function_changed(keyspace, function, functions_result)
 *         elif aggregate:             # <<<<<<<<<<<<<<
 *             # user defined aggregate within this keyspace changed
 *             where_clause = " WHERE keyspace_name = '%s' AND aggregate_name = '%s' AND signature = [%s]" \
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_aggregate); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":2317
 *             # user defined aggregate within this keyspace changed
 *             where_clause = " WHERE keyspace_name = '%s' AND aggregate_name = '%s' AND signature = [%s]" \
 *                            % (keyspace, aggregate.name, ','.join("'%s'" % t for t in aggregate.type_signature))             # <<<<<<<<<<<<<<
 *             aggregates_query = QueryMessage(query=self._SELECT_AGGREGATES + where_clause, consistency_level=cl)
 *             aggregates_result = connection.wait_for_response(aggregates_query)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_aggregate, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __pyx_pf_9cassandra_7cluster_17ControlConnection_15_refresh_schema_8genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__85, __pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_2);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_WHERE_keyspace_name_s_AND_aggre, __pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_where_clause = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2318
 *             where_clause = " WHERE keyspace_name = '%s' AND aggregate_name = '%s' AND signature = [%s]" \
 *                            % (keyspace, aggregate.name, ','.join("'%s'" % t for t in aggregate.type_signature))
 *             aggregates_query = QueryMessage(query=self._SELECT_AGGREGATES + where_clause, consistency_level=cl)             # <<<<<<<<<<<<<<
 *             aggregates_result = connection.wait_for_response(aggregates_query)
 *             log.debug("[control connection] Fetched user aggregate info for %s.%s, rebuilding metadata", keyspace, aggregate.signature)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_AGGREGATES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_v_where_clause); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_query, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_aggregates_query = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2319
 *                            % (keyspace, aggregate.name, ','.join("'%s'" % t for t in aggregate.type_signature))
 *             aggregates_query = QueryMessage(query=self._SELECT_AGGREGATES + where_clause, consistency_level=cl)
 *             aggregates_result = connection.wait_for_response(aggregates_query)             # <<<<<<<<<<<<<<
 *             log.debug("[control connection] Fetched user aggregate info for %s.%s, rebuilding metadata", keyspace, aggregate.signature)
 *             aggregates_result = dict_factory(*aggregates_result.results) if aggregates_result.results else {}
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_wait_for_response); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_aggregates_query); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_aggregates_query);
      __Pyx_GIVEREF(__pyx_v_aggregates_query);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_aggregates_query);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_aggregates_result = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2320
 *             aggregates_query = QueryMessage(query=self._SELECT_AGGREGATES + where_clause, consistency_level=cl)
 *             aggregates_result = connection.wait_for_response(aggregates_query)
 *             log.debug("[control connection] Fetched user aggregate info for %s.%s, rebuilding metadata", keyspace, aggregate.signature)             # <<<<<<<<<<<<<<
 *             aggregates_result = dict_factory(*aggregates_result.results) if aggregates_result.results else {}
 *             self._cluster.metadata.aggregate_changed(keyspace, aggregate, aggregates_result)
 */
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_aggregate, __pyx_n_s_signature); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_11 = 1;
      }
    }
    __pyx_t_5 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_control_connection_Fetched_user_3);
    __Pyx_GIVEREF(__pyx_kp_s_control_connection_Fetched_user_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_11, __pyx_kp_s_control_connection_Fetched_user_3);
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_11, __pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_11, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2321
 *             aggregates_result = connection.wait_for_response(aggregates_query)
 *             log.debug("[control connection] Fetched user aggregate info for %s.%s, rebuilding metadata", keyspace, aggregate.signature)
 *             aggregates_result = dict_factory(*aggregates_result.results) if aggregates_result.results else {}             # <<<<<<<<<<<<<<
 *             self._cluster.metadata.aggregate_changed(keyspace, aggregate, aggregates_result)
 *         elif keyspace:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_aggregates_result, __pyx_n_s_results); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_6) {
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_aggregates_result, __pyx_n_s_results); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_4 = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __Pyx_DECREF_SET(__pyx_v_aggregates_result, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2322
 *             log.debug("[control connection] Fetched user aggregate info for %s.%s, rebuilding metadata", keyspace, aggregate.signature)
 *             aggregates_result = dict_factory(*aggregates_result.results) if aggregates_result.results else {}
 *             self._cluster.metadata.aggregate_changed(keyspace, aggregate, aggregates_result)             # <<<<<<<<<<<<<<
 *         elif keyspace:
 *             # only the keyspace itself changed (such as replication settings)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_metadata); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_aggregate_changed); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_11 = 1;
      }
    }
    __pyx_t_1 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_11, __pyx_v_keyspace);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_aggregate);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_aggregate);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_11, __pyx_cur_scope->__pyx_v_aggregate);
    __Pyx_INCREF(__pyx_v_aggregates_result);
    __Pyx_GIVEREF(__pyx_v_aggregates_result);
    PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_11, __pyx_v_aggregates_result);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L5;
  }

  /* "cassandra/cluster.py":2323
 *             aggregates_result = dict_factory(*aggregates_result.results) if aggregates_result.results else {}
 *             self._cluster.metadata.aggregate_changed(keyspace, aggregate, aggregates_result)
 *         elif keyspace:             # <<<<<<<<<<<<<<
 *             # only the keyspace itself changed (such as replication settings)
 *             where_clause = " WHERE keyspace_name = '%s'" % (keyspace,)
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_keyspace); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":2325
 *         elif keyspace:
 *             # only the keyspace itself changed (such as replication settings)
 *             where_clause = " WHERE keyspace_name = '%s'" % (keyspace,)             # <<<<<<<<<<<<<<
 *             ks_query = QueryMessage(query=self._SELECT_KEYSPACES + where_clause, consistency_level=cl)
 *             ks_result = connection.wait_for_response(ks_query)
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_keyspace);
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_WHERE_keyspace_name_s, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_where_clause = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2326
 *             # only the keyspace itself changed (such as replication settings)
 *             where_clause = " WHERE keyspace_name = '%s'" % (keyspace,)
 *             ks_query = QueryMessage(query=self._SELECT_KEYSPACES + where_clause, consistency_level=cl)             # <<<<<<<<<<<<<<
 *             ks_result = connection.wait_for_response(ks_query)
 *             log.debug("[control connection] Fetched keyspace info for %s, rebuilding metadata", keyspace)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_KEYSPACES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_v_where_clause); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_query, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_ks_query = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "cassandra/cluster.py":2327
 *             where_clause = " WHERE keyspace_name = '%s'" % (keyspace,)
 *             ks_query = QueryMessage(query=self._SELECT_KEYSPACES + where_clause, consistency_level=cl)
 *             ks_result = connection.wait_for_response(ks_query)             # <<<<<<<<<<<<<<
 *             log.debug("[control connection] Fetched keyspace info for %s, rebuilding metadata", keyspace)
 *             ks_result = dict_factory(*ks_result.results) if ks_result.results else {}
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_wait_for_response); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_ks_query); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
    } else {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_ks_query);
      __Pyx_GIVEREF(__pyx_v_ks_query);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_ks_query);
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_ks_result = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "cassandra/cluster.py":2328
 *             ks_query = QueryMessage(query=self._SELECT_KEYSPACES + where_clause, consistency_level=cl)
 *             ks_result = connection.wait_for_response(ks_query)
 *             log.debug("[control connection] Fetched keyspace info for %s, rebuilding metadata", keyspace)             # <<<<<<<<<<<<<<
 *             ks_result = dict_factory(*ks_result.results) if ks_result.results else {}
 *             self._cluster.metadata.keyspace_changed(keyspace, ks_result)
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_11 = 1;
      }
    }
    __pyx_t_5 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_control_connection_Fetched_keys);
    __Pyx_GIVEREF(__pyx_kp_s_control_connection_Fetched_keys);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_11, __pyx_kp_s_control_connection_Fetched_keys);
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_11, __pyx_v_keyspace);
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "cassandra/cluster.py":2329
 *             ks_result = connection.wait_for_response(ks_query)
 *             log.debug("[control connection] Fetched keyspace info for %s, rebuilding metadata", keyspace)
 *             ks_result = dict_factory(*ks_result.results) if ks_result.results else {}             # <<<<<<<<<<<<<<
 *             self._cluster.metadata.keyspace_changed(keyspace, ks_result)
 *         else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_ks_result, __pyx_n_s_results); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_6) {
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_ks_result, __pyx_n_s_results); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __Pyx_DECREF_SET(__pyx_v_ks_result, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "cassandra/cluster.py":2330
 *             log.debug("[control connection] Fetched keyspace info for %s, rebuilding metadata", keyspace)
 *             ks_result = dict_factory(*ks_result.results) if ks_result.results else {}
 *             self._cluster.metadata.keyspace_changed(keyspace, ks_result)             # <<<<<<<<<<<<<<
 *         else:
 *             # build everything from scratch
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_metadata); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_keyspace_changed); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_11 = 1;
      }
    }
    __pyx_t_1 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_keyspace);
    __Pyx_GIVEREF(__pyx_v_keyspace);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_11, __pyx_v_keyspace);
    __Pyx_INCREF(__pyx_v_ks_result);
    __Pyx_GIVEREF(__pyx_v_ks_result);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_11, __pyx_v_ks_result);
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "cassandra/cluster.py":2334
 *             # build everything from scratch
 *             queries = [
 *                 QueryMessage(query=self._SELECT_KEYSPACES, consistency_level=cl),             # <<<<<<<<<<<<<<
 *                 QueryMessage(query=self._SELECT_COLUMN_FAMILIES, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_COLUMNS, consistency_level=cl),
 */
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_KEYSPACES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_query, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2335
 *             queries = [
 *                 QueryMessage(query=self._SELECT_KEYSPACES, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_COLUMN_FAMILIES, consistency_level=cl),             # <<<<<<<<<<<<<<
 *                 QueryMessage(query=self._SELECT_COLUMNS, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_USERTYPES, consistency_level=cl),
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_COLUMN_FAMILIES); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_query, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "cassandra/cluster.py":2336
 *                 QueryMessage(query=self._SELECT_KEYSPACES, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_COLUMN_FAMILIES, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_COLUMNS, consistency_level=cl),             # <<<<<<<<<<<<<<
 *                 QueryMessage(query=self._SELECT_USERTYPES, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_FUNCTIONS, consistency_level=cl),
 */
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_COLUMNS); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_query, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2337
 *                 QueryMessage(query=self._SELECT_COLUMN_FAMILIES, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_COLUMNS, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_USERTYPES, consistency_level=cl),             # <<<<<<<<<<<<<<
 *                 QueryMessage(query=self._SELECT_FUNCTIONS, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_AGGREGATES, consistency_level=cl),
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_USERTYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_query, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "cassandra/cluster.py":2338
 *                 QueryMessage(query=self._SELECT_COLUMNS, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_USERTYPES, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_FUNCTIONS, consistency_level=cl),             # <<<<<<<<<<<<<<
 *                 QueryMessage(query=self._SELECT_AGGREGATES, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_TRIGGERS, consistency_level=cl)
 */
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_FUNCTIONS); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_query, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2339
 *                 QueryMessage(query=self._SELECT_USERTYPES, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_FUNCTIONS, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_AGGREGATES, consistency_level=cl),             # <<<<<<<<<<<<<<
 *                 QueryMessage(query=self._SELECT_TRIGGERS, consistency_level=cl)
 *             ]
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_AGGREGATES); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_query, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "cassandra/cluster.py":2340
 *                 QueryMessage(query=self._SELECT_FUNCTIONS, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_AGGREGATES, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_TRIGGERS, consistency_level=cl)             # <<<<<<<<<<<<<<
 *             ]
 * 
 */
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_TRIGGERS); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_query, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2333
 *         else:
 *             # build everything from scratch
 *             queries = [             # <<<<<<<<<<<<<<
 *                 QueryMessage(query=self._SELECT_KEYSPACES, consistency_level=cl),
 *                 QueryMessage(query=self._SELECT_COLUMN_FAMILIES, consistency_level=cl),
 */
    __pyx_t_5 = PyList_New(7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyList_SET_ITEM(__pyx_t_5, 2, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_7);
    PyList_SET_ITEM(__pyx_t_5, 3, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_10);
    PyList_SET_ITEM(__pyx_t_5, 4, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_13);
    PyList_SET_ITEM(__pyx_t_5, 5, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_14);
    PyList_SET_ITEM(__pyx_t_5, 6, __pyx_t_14);
    __pyx_t_1 = 0;
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_t_7 = 0;
    __pyx_t_10 = 0;
    __pyx_t_13 = 0;
    __pyx_t_14 = 0;
    __pyx_v_queries = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2343
 *             ]
 * 
 *             responses = connection.wait_for_responses(*queries, timeout=self._timeout, fail_on_error=False)             # <<<<<<<<<<<<<<
 *             (ks_success, ks_result), (cf_success, cf_result), \
 *                 (col_success, col_result), (types_success, types_result), \
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_wait_for_responses); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_14 = PySequence_Tuple(__pyx_v_queries); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_timeout, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_fail_on_error, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_v_responses = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "cassandra/cluster.py":2348
 *                 (functions_success, functions_result), \
 *                 (aggregates_success, aggregates_result), \
 *                 (trigger_success, triggers_result) = responses             # <<<<<<<<<<<<<<
 * 
 *             if ks_success:
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_responses))) || (PyList_CheckExact(__pyx_v_responses))) {
      PyObject* sequence = __pyx_v_responses;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 7)) {
        if (size > 7) __Pyx_RaiseTooManyValuesError(7);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 4); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 5); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 6); 
      } else {
        __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_14 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 4); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 5); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 6); 
      }
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[7] = {&__pyx_t_10,&__pyx_t_13,&__pyx_t_14,&__pyx_t_5,&__pyx_t_7,&__pyx_t_2,&__pyx_t_4};
        for (i=0; i < 7; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[7] = {&__pyx_t_10,&__pyx_t_13,&__pyx_t_14,&__pyx_t_5,&__pyx_t_7,&__pyx_t_2,&__pyx_t_4};
      __pyx_t_1 = PyObject_GetIter(__pyx_v_responses); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext;
      for (index=0; index < 7; index++) {
        PyObject* item = __pyx_t_8(__pyx_t_1); if (unlikely(!item)) goto __pyx_L17_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_1), 7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L18_unpacking_done;
      __pyx_L17_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L18_unpacking_done:;
    }

    /* "cassandra/cluster.py":2344
 * 
 *             responses = connection.wait_for_responses(*queries, timeout=self._timeout, fail_on_error=False)
 *             (ks_success, ks_result), (cf_success, cf_result), \             # <<<<<<<<<<<<<<
 *                 (col_success, col_result), (types_success, types_result), \
 *                 (functions_success, functions_result), \
 */
    if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
      PyObject* sequence = __pyx_t_10;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_15 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_15)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_1)) goto __pyx_L19_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_9)) goto __pyx_L19_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_15), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L20_unpacking_done;
      __pyx_L19_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L20_unpacking_done:;
    }
    __pyx_v_ks_success = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_ks_result = __pyx_t_9;
    __pyx_t_9 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_13))) || (PyList_CheckExact(__pyx_t_13))) {
      PyObject* sequence = __pyx_t_13;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      #endif
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_15 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_15)->tp_iternext;
      index = 0; __pyx_t_9 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_9)) goto __pyx_L21_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_1)) goto __pyx_L21_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_15), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L22_unpacking_done;
      __pyx_L21_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L22_unpacking_done:;
    }
    __pyx_v_cf_success = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_cf_result = __pyx_t_1;
    __pyx_t_1 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
      PyObject* sequence = __pyx_t_14;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_15 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_15)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_1)) goto __pyx_L23_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_9)) goto __pyx_L23_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_15), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L24_unpacking_done;
      __pyx_L23_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L24_unpacking_done:;
    }

    /* "cassandra/cluster.py":2345
 *             responses = connection.wait_for_responses(*queries, timeout=self._timeout, fail_on_error=False)
 *             (ks_success, ks_result), (cf_success, cf_result), \
 *                 (col_success, col_result), (types_success, types_result), \             # <<<<<<<<<<<<<<
 *                 (functions_success, functions_result), \
 *                 (aggregates_success, aggregates_result), \
 */
    __pyx_v_col_success = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_col_result = __pyx_t_9;
    __pyx_t_9 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_15 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_15)->tp_iternext;
      index = 0; __pyx_t_9 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_9)) goto __pyx_L25_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_1)) goto __pyx_L25_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_15), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L26_unpacking_done;
      __pyx_L25_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L26_unpacking_done:;
    }
    __pyx_v_types_success = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_types_result = __pyx_t_1;
    __pyx_t_1 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_15 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_15)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_1)) goto __pyx_L27_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_9)) goto __pyx_L27_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_15), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L28_unpacking_done;
      __pyx_L27_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L28_unpacking_done:;
    }

    /* "cassandra/cluster.py":2346
 *             (ks_success, ks_result), (cf_success, cf_result), \
 *                 (col_success, col_result), (types_success, types_result), \
 *                 (functions_success, functions_result), \             # <<<<<<<<<<<<<<
 *                 (aggregates_success, aggregates_result), \
 *                 (trigger_success, triggers_result) = responses
 */
    __pyx_v_functions_success = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_functions_result = __pyx_t_9;
    __pyx_t_9 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_15 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_15)->tp_iternext;
      index = 0; __pyx_t_9 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_9)) goto __pyx_L29_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_1)) goto __pyx_L29_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_15), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L30_unpacking_done;
      __pyx_L29_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L30_unpacking_done:;
    }

    /* "cassandra/cluster.py":2347
 *                 (col_success, col_result), (types_success, types_result), \
 *                 (functions_success, functions_result), \
 *                 (aggregates_success, aggregates_result), \             # <<<<<<<<<<<<<<
 *                 (trigger_success, triggers_result) = responses
 * 
 */
    __pyx_v_aggregates_success = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_aggregates_result = __pyx_t_1;
    __pyx_t_1 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_15 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_15)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_1)) goto __pyx_L31_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_9)) goto __pyx_L31_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_15), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L32_unpacking_done;
      __pyx_L31_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L32_unpacking_done:;
    }

    /* "cassandra/cluster.py":2348
 *                 (functions_success, functions_result), \
 *                 (aggregates_success, aggregates_result), \
 *                 (trigger_success, triggers_result) = responses             # <<<<<<<<<<<<<<
 * 
 *             if ks_success:
 */
    __pyx_v_trigger_success = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_triggers_result = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "cassandra/cluster.py":2350
 *                 (trigger_success, triggers_result) = responses
 * 
 *             if ks_success:             # <<<<<<<<<<<<<<
 *                 ks_result = dict_factory(*ks_result.results)
 *             else:
 */
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_ks_success); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_6) {

      /* "cassandra/cluster.py":2351
 * 
 *             if ks_success:
 *                 ks_result = dict_factory(*ks_result.results)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ks_result
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ks_result, __pyx_n_s_results); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_ks_result, __pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L33;
    }
    /*else*/ {

      /* "cassandra/cluster.py":2353
 *                 ks_result = dict_factory(*ks_result.results)
 *             else:
 *                 raise ks_result             # <<<<<<<<<<<<<<
 * 
 *             if cf_success:
 */
      __Pyx_Raise(__pyx_v_ks_result, 0, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L33:;

    /* "cassandra/cluster.py":2355
 *                 raise ks_result
 * 
 *             if cf_success:             # <<<<<<<<<<<<<<
 *                 cf_result = dict_factory(*cf_result.results)
 *             else:
 */
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_cf_success); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_6) {

      /* "cassandra/cluster.py":2356
 * 
 *             if cf_success:
 *                 cf_result = dict_factory(*cf_result.results)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise cf_result
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_cf_result, __pyx_n_s_results); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = PySequence_Tuple(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_cf_result, __pyx_t_7);
      __pyx_t_7 = 0;
      goto __pyx_L34;
    }
    /*else*/ {

      /* "cassandra/cluster.py":2358
 *                 cf_result = dict_factory(*cf_result.results)
 *             else:
 *                 raise cf_result             # <<<<<<<<<<<<<<
 * 
 *             if col_success:
 */
      __Pyx_Raise(__pyx_v_cf_result, 0, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L34:;

    /* "cassandra/cluster.py":2360
 *                 raise cf_result
 * 
 *             if col_success:             # <<<<<<<<<<<<<<
 *                 col_result = dict_factory(*col_result.results)
 *             else:
 */
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_col_success); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_6) {

      /* "cassandra/cluster.py":2361
 * 
 *             if col_success:
 *                 col_result = dict_factory(*col_result.results)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise col_result
 */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_col_result, __pyx_n_s_results); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_col_result, __pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L35;
    }
    /*else*/ {

      /* "cassandra/cluster.py":2363
 *                 col_result = dict_factory(*col_result.results)
 *             else:
 *                 raise col_result             # <<<<<<<<<<<<<<
 * 
 *             # if we're connected to Cassandra < 2.0, the trigges table will not exist
 */
      __Pyx_Raise(__pyx_v_col_result, 0, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L35:;

    /* "cassandra/cluster.py":2366
 * 
 *             # if we're connected to Cassandra < 2.0, the trigges table will not exist
 *             if trigger_success:             # <<<<<<<<<<<<<<
 *                 triggers_result = dict_factory(*triggers_result.results)
 *             else:
 */
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_trigger_success); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_6) {

      /* "cassandra/cluster.py":2367
 *             # if we're connected to Cassandra < 2.0, the trigges table will not exist
 *             if trigger_success:
 *                 triggers_result = dict_factory(*triggers_result.results)             # <<<<<<<<<<<<<<
 *             else:
 *                 if isinstance(triggers_result, InvalidRequest):
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_triggers_result, __pyx_n_s_results); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_triggers_result, __pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L36;
    }
    /*else*/ {

      /* "cassandra/cluster.py":2369
 *                 triggers_result = dict_factory(*triggers_result.results)
 *             else:
 *                 if isinstance(triggers_result, InvalidRequest):             # <<<<<<<<<<<<<<
 *                     log.debug("[control connection] triggers table not found")
 *                     triggers_result = {}
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_InvalidRequest); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PyObject_IsInstance(__pyx_v_triggers_result, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = (__pyx_t_6 != 0);
      if (__pyx_t_3) {

        /* "cassandra/cluster.py":2370
 *             else:
 *                 if isinstance(triggers_result, InvalidRequest):
 *                     log.debug("[control connection] triggers table not found")             # <<<<<<<<<<<<<<
 *                     triggers_result = {}
 *                 elif isinstance(triggers_result, Unauthorized):
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__86, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "cassandra/cluster.py":2371
 *                 if isinstance(triggers_result, InvalidRequest):
 *                     log.debug("[control connection] triggers table not found")
 *                     triggers_result = {}             # <<<<<<<<<<<<<<
 *                 elif isinstance(triggers_result, Unauthorized):
 *                     log.warning("[control connection] this version of Cassandra does not allow access to schema_triggers metadata with authorization enabled (CASSANDRA-7967); "
 */
        __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_triggers_result, __pyx_t_2);
        __pyx_t_2 = 0;
        goto __pyx_L37;
      }

      /* "cassandra/cluster.py":2372
 *                     log.debug("[control connection] triggers table not found")
 *                     triggers_result = {}
 *                 elif isinstance(triggers_result, Unauthorized):             # <<<<<<<<<<<<<<
 *                     log.warning("[control connection] this version of Cassandra does not allow access to schema_triggers metadata with authorization enabled (CASSANDRA-7967); "
 *                                 "The driver will operate normally, but will not reflect triggers in the local metadata model, or schema strings.")
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Unauthorized); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_IsInstance(__pyx_v_triggers_result, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = (__pyx_t_3 != 0);
      if (__pyx_t_6) {

        /* "cassandra/cluster.py":2373
 *                     triggers_result = {}
 *                 elif isinstance(triggers_result, Unauthorized):
 *                     log.warning("[control connection] this version of Cassandra does not allow access to schema_triggers metadata with authorization enabled (CASSANDRA-7967); "             # <<<<<<<<<<<<<<
 *                                 "The driver will operate normally, but will not reflect triggers in the local metadata model, or schema strings.")
 *                     triggers_result = {}
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_warning); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__87, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "cassandra/cluster.py":2375
 *                     log.warning("[control connection] this version of Cassandra does not allow access to schema_triggers metadata with authorization enabled (CASSANDRA-7967); "
 *                                 "The driver will operate normally, but will not reflect triggers in the local metadata model, or schema strings.")
 *                     triggers_result = {}             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise triggers_result
 */
        __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_triggers_result, __pyx_t_2);
        __pyx_t_2 = 0;
        goto __pyx_L37;
      }
      /*else*/ {

        /* "cassandra/cluster.py":2377
 *                     triggers_result = {}
 *                 else:
 *                     raise triggers_result             # <<<<<<<<<<<<<<
 * 
 *             # if we're connected to Cassandra < 2.1, the usertypes table will not exist
 */
        __Pyx_Raise(__pyx_v_triggers_result, 0, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L37:;
    }
    __pyx_L36:;

    /* "cassandra/cluster.py":2380
 * 
 *             # if we're connected to Cassandra < 2.1, the usertypes table will not exist
 *             if types_success:             # <<<<<<<<<<<<<<
 *                 types_result = dict_factory(*types_result.results) if types_result.results else {}
 *             else:
 */
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_types_success); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_6) {

      /* "cassandra/cluster.py":2381
 *             # if we're connected to Cassandra < 2.1, the usertypes table will not exist
 *             if types_success:
 *                 types_result = dict_factory(*types_result.results) if types_result.results else {}             # <<<<<<<<<<<<<<
 *             else:
 *                 if isinstance(types_result, InvalidRequest):
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_types_result, __pyx_n_s_results); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_6) {
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_types_result, __pyx_n_s_results); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_2 = __pyx_t_4;
        __pyx_t_4 = 0;
      } else {
        __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = __pyx_t_4;
        __pyx_t_4 = 0;
      }
      __Pyx_DECREF_SET(__pyx_v_types_result, __pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L38;
    }
    /*else*/ {

      /* "cassandra/cluster.py":2383
 *                 types_result = dict_factory(*types_result.results) if types_result.results else {}
 *             else:
 *                 if isinstance(types_result, InvalidRequest):             # <<<<<<<<<<<<<<
 *                     log.debug("[control connection] user types table not found")
 *                     types_result = {}
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_InvalidRequest); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PyObject_IsInstance(__pyx_v_types_result, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = (__pyx_t_6 != 0);
      if (__pyx_t_3) {

        /* "cassandra/cluster.py":2384
 *             else:
 *                 if isinstance(types_result, InvalidRequest):
 *                     log.debug("[control connection] user types table not found")             # <<<<<<<<<<<<<<
 *                     types_result = {}
 *                 else:
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__88, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "cassandra/cluster.py":2385
 *                 if isinstance(types_result, InvalidRequest):
 *                     log.debug("[control connection] user types table not found")
 *                     types_result = {}             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise types_result
 */
        __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_types_result, __pyx_t_2);
        __pyx_t_2 = 0;
        goto __pyx_L39;
      }
      /*else*/ {

        /* "cassandra/cluster.py":2387
 *                     types_result = {}
 *                 else:
 *                     raise types_result             # <<<<<<<<<<<<<<
 * 
 *             # functions were introduced in Cassandra 2.2
 */
        __Pyx_Raise(__pyx_v_types_result, 0, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L39:;
    }
    __pyx_L38:;

    /* "cassandra/cluster.py":2390
 * 
 *             # functions were introduced in Cassandra 2.2
 *             if functions_success:             # <<<<<<<<<<<<<<
 *                 functions_result = dict_factory(*functions_result.results) if functions_result.results else {}
 *             else:
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_functions_success); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {

      /* "cassandra/cluster.py":2391
 *             # functions were introduced in Cassandra 2.2
 *             if functions_success:
 *                 functions_result = dict_factory(*functions_result.results) if functions_result.results else {}             # <<<<<<<<<<<<<<
 *             else:
 *                 if isinstance(functions_result, InvalidRequest):
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_functions_result, __pyx_n_s_results); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {
        __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_functions_result, __pyx_n_s_results); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_2 = __pyx_t_5;
        __pyx_t_5 = 0;
      } else {
        __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = __pyx_t_5;
        __pyx_t_5 = 0;
      }
      __Pyx_DECREF_SET(__pyx_v_functions_result, __pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L40;
    }
    /*else*/ {

      /* "cassandra/cluster.py":2393
 *                 functions_result = dict_factory(*functions_result.results) if functions_result.results else {}
 *             else:
 *                 if isinstance(functions_result, InvalidRequest):             # <<<<<<<<<<<<<<
 *                     log.debug("[control connection] user functions table not found")
 *                     functions_result = {}
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_InvalidRequest); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_IsInstance(__pyx_v_functions_result, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = (__pyx_t_3 != 0);
      if (__pyx_t_6) {

        /* "cassandra/cluster.py":2394
 *             else:
 *                 if isinstance(functions_result, InvalidRequest):
 *                     log.debug("[control connection] user functions table not found")             # <<<<<<<<<<<<<<
 *                     functions_result = {}
 *                 else:
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__89, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "cassandra/cluster.py":2395
 *                 if isinstance(functions_result, InvalidRequest):
 *                     log.debug("[control connection] user functions table not found")
 *                     functions_result = {}             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise functions_result
 */
        __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_functions_result, __pyx_t_2);
        __pyx_t_2 = 0;
        goto __pyx_L41;
      }
      /*else*/ {

        /* "cassandra/cluster.py":2397
 *                     functions_result = {}
 *                 else:
 *                     raise functions_result             # <<<<<<<<<<<<<<
 * 
 *             # aggregates were introduced in Cassandra 2.2
 */
        __Pyx_Raise(__pyx_v_functions_result, 0, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L41:;
    }
    __pyx_L40:;

    /* "cassandra/cluster.py":2400
 * 
 *             # aggregates were introduced in Cassandra 2.2
 *             if aggregates_success:             # <<<<<<<<<<<<<<
 *                 aggregates_result = dict_factory(*aggregates_result.results) if aggregates_result.results else {}
 *             else:
 */
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_aggregates_success); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_6) {

      /* "cassandra/cluster.py":2401
 *             # aggregates were introduced in Cassandra 2.2
 *             if aggregates_success:
 *                 aggregates_result = dict_factory(*aggregates_result.results) if aggregates_result.results else {}             # <<<<<<<<<<<<<<
 *             else:
 *                 if isinstance(aggregates_result, InvalidRequest):
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_aggregates_result, __pyx_n_s_results); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_aggregates_result, __pyx_n_s_results); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = PySequence_Tuple(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_2 = __pyx_t_7;
        __pyx_t_7 = 0;
      } else {
        __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_2 = __pyx_t_7;
        __pyx_t_7 = 0;
      }
      __Pyx_DECREF_SET(__pyx_v_aggregates_result, __pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L42;
    }
    /*else*/ {

      /* "cassandra/cluster.py":2403
 *                 aggregates_result = dict_factory(*aggregates_result.results) if aggregates_result.results else {}
 *             else:
 *                 if isinstance(aggregates_result, InvalidRequest):             # <<<<<<<<<<<<<<
 *                     log.debug("[control connection] user aggregates table not found")
 *                     aggregates_result = {}
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_InvalidRequest); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PyObject_IsInstance(__pyx_v_aggregates_result, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = (__pyx_t_6 != 0);
      if (__pyx_t_3) {

        /* "cassandra/cluster.py":2404
 *             else:
 *                 if isinstance(aggregates_result, InvalidRequest):
 *                     log.debug("[control connection] user aggregates table not found")             # <<<<<<<<<<<<<<
 *                     aggregates_result = {}
 *                 else:
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__90, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "cassandra/cluster.py":2405
 *                 if isinstance(aggregates_result, InvalidRequest):
 *                     log.debug("[control connection] user aggregates table not found")
 *                     aggregates_result = {}             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise aggregates_result
 */
        __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_aggregates_result, __pyx_t_2);
        __pyx_t_2 = 0;
        goto __pyx_L43;
      }
      /*else*/ {

        /* "cassandra/cluster.py":2407
 *                     aggregates_result = {}
 *                 else:
 *                     raise aggregates_result             # <<<<<<<<<<<<<<
 * 
 *             log.debug("[control connection] Fetched schema, rebuilding metadata")
 */
        __Pyx_Raise(__pyx_v_aggregates_result, 0, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L43:;
    }
    __pyx_L42:;

    /* "cassandra/cluster.py":2409
 *                     raise aggregates_result
 * 
 *             log.debug("[control connection] Fetched schema, rebuilding metadata")             # <<<<<<<<<<<<<<
 *             self._cluster.metadata.rebuild_schema(ks_result, types_result, functions_result,
 *                                                   aggregates_result, cf_result, col_result, triggers_result)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__91, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2410
 * 
 *             log.debug("[control connection] Fetched schema, rebuilding metadata")
 *             self._cluster.metadata.rebuild_schema(ks_result, types_result, functions_result,             # <<<<<<<<<<<<<<
 *                                                   aggregates_result, cf_result, col_result, triggers_result)
 *         return True
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_metadata); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_rebuild_schema); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2411
 *             log.debug("[control connection] Fetched schema, rebuilding metadata")
 *             self._cluster.metadata.rebuild_schema(ks_result, types_result, functions_result,
 *                                                   aggregates_result, cf_result, col_result, triggers_result)             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
    __pyx_t_4 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_11 = 1;
      }
    }
    __pyx_t_5 = PyTuple_New(7+__pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_ks_result);
    __Pyx_GIVEREF(__pyx_v_ks_result);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_11, __pyx_v_ks_result);
    __Pyx_INCREF(__pyx_v_types_result);
    __Pyx_GIVEREF(__pyx_v_types_result);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_11, __pyx_v_types_result);
    __Pyx_INCREF(__pyx_v_functions_result);
    __Pyx_GIVEREF(__pyx_v_functions_result);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_11, __pyx_v_functions_result);
    __Pyx_INCREF(__pyx_v_aggregates_result);
    __Pyx_GIVEREF(__pyx_v_aggregates_result);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_11, __pyx_v_aggregates_result);
    __Pyx_INCREF(__pyx_v_cf_result);
    __Pyx_GIVEREF(__pyx_v_cf_result);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_11, __pyx_v_cf_result);
    __Pyx_INCREF(__pyx_v_col_result);
    __Pyx_GIVEREF(__pyx_v_col_result);
    PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_11, __pyx_v_col_result);
    __Pyx_INCREF(__pyx_v_triggers_result);
    __Pyx_GIVEREF(__pyx_v_triggers_result);
    PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_11, __pyx_v_triggers_result);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L5:;

  /* "cassandra/cluster.py":2412
 *             self._cluster.metadata.rebuild_schema(ks_result, types_result, functions_result,
 *                                                   aggregates_result, cf_result, col_result, triggers_result)
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def refresh_node_list_and_token_map(self, force_token_rebuild=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "cassandra/cluster.py":2256
 *         return False
 * 
 *     def _refresh_schema(self, connection, keyspace=None, table=None, usertype=None, function=None,             # <<<<<<<<<<<<<<
 *                         aggregate=None, preloaded_results=None, schema_agreement_wait=None):
 *         if self._cluster.is_shutdown:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._refresh_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_agreed);
  __Pyx_XDECREF(__pyx_v_cl);
  __Pyx_XDECREF(__pyx_v__handle_results);
  __Pyx_XDECREF(__pyx_v_where_clause);
  __Pyx_XDECREF(__pyx_v_cf_query);
  __Pyx_XDECREF(__pyx_v_col_query);
  __Pyx_XDECREF(__pyx_v_triggers_query);
  __Pyx_XDECREF(__pyx_v_cf_success);
  __Pyx_XDECREF(__pyx_v_cf_result);
  __Pyx_XDECREF(__pyx_v_col_success);
  __Pyx_XDECREF(__pyx_v_col_result);
  __Pyx_XDECREF(__pyx_v_triggers_success);
  __Pyx_XDECREF(__pyx_v_triggers_result);
  __Pyx_XDECREF(__pyx_v_types_query);
  __Pyx_XDECREF(__pyx_v_types_result);
  __Pyx_XDECREF(__pyx_v_functions_query);
  __Pyx_XDECREF(__pyx_v_functions_result);
  __Pyx_XDECREF(__pyx_v_aggregates_query);
  __Pyx_XDECREF(__pyx_v_aggregates_result);
  __Pyx_XDECREF(__pyx_v_ks_query);
  __Pyx_XDECREF(__pyx_v_ks_result);
  __Pyx_XDECREF(__pyx_v_queries);
  __Pyx_XDECREF(__pyx_v_responses);
  __Pyx_XDECREF(__pyx_v_ks_success);
  __Pyx_XDECREF(__pyx_v_types_success);
  __Pyx_XDECREF(__pyx_v_functions_success);
  __Pyx_XDECREF(__pyx_v_aggregates_success);
  __Pyx_XDECREF(__pyx_v_trigger_success);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2414
 *         return True
 * 
 *     def refresh_node_list_and_token_map(self, force_token_rebuild=False):             # <<<<<<<<<<<<<<
 *         if not self._meta_refresh_enabled:
 *             log.debug("[control connection] Skipping node list refresh because meta refresh is disabled")
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_25refresh_node_list_and_token_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_25refresh_node_list_and_token_map = {"refresh_node_list_and_token_map", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_25refresh_node_list_and_token_map, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_25refresh_node_list_and_token_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_force_token_rebuild = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refresh_node_list_and_token_map (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_force_token_rebuild,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_force_token_rebuild);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "refresh_node_list_and_token_map") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_force_token_rebuild = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("refresh_node_list_and_token_map", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.refresh_node_list_and_token_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_24refresh_node_list_and_token_map(__pyx_self, __pyx_v_self, __pyx_v_force_token_rebuild);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_24refresh_node_list_and_token_map(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_force_token_rebuild) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("refresh_node_list_and_token_map", 0);

  /* "cassandra/cluster.py":2415
 * 
 *     def refresh_node_list_and_token_map(self, force_token_rebuild=False):
 *         if not self._meta_refresh_enabled:             # <<<<<<<<<<<<<<
 *             log.debug("[control connection] Skipping node list refresh because meta refresh is disabled")
 *             return False
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_meta_refresh_enabled); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":2416
 *     def refresh_node_list_and_token_map(self, force_token_rebuild=False):
 *         if not self._meta_refresh_enabled:
 *             log.debug("[control connection] Skipping node list refresh because meta refresh is disabled")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__92, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2417
 *         if not self._meta_refresh_enabled:
 *             log.debug("[control connection] Skipping node list refresh because meta refresh is disabled")
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2419
 *             return False
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self._connection:
 *                 self._refresh_node_list_and_token_map(self._connection, force_token_rebuild=force_token_rebuild)
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    /*try:*/ {

      /* "cassandra/cluster.py":2420
 * 
 *         try:
 *             if self._connection:             # <<<<<<<<<<<<<<
 *                 self._refresh_node_list_and_token_map(self._connection, force_token_rebuild=force_token_rebuild)
 *                 return True
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2420; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2420; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_3) {

        /* "cassandra/cluster.py":2421
 *         try:
 *             if self._connection:
 *                 self._refresh_node_list_and_token_map(self._connection, force_token_rebuild=force_token_rebuild)             # <<<<<<<<<<<<<<
 *                 return True
 *         except ReferenceError:
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_refresh_node_list_and_token_map_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_4);
        if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_force_token_rebuild, __pyx_v_force_token_rebuild) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "cassandra/cluster.py":2422
 *             if self._connection:
 *                 self._refresh_node_list_and_token_map(self._connection, force_token_rebuild=force_token_rebuild)
 *                 return True             # <<<<<<<<<<<<<<
 *         except ReferenceError:
 *             pass  # our weak reference to the Cluster is no good
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_True);
        __pyx_r = Py_True;
        goto __pyx_L8_try_return;
      }
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "cassandra/cluster.py":2423
 *                 self._refresh_node_list_and_token_map(self._connection, force_token_rebuild=force_token_rebuild)
 *                 return True
 *         except ReferenceError:             # <<<<<<<<<<<<<<
 *             pass  # our weak reference to the Cluster is no good
 *         except Exception:
 */
    __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_ReferenceError);
    if (__pyx_t_10) {
      PyErr_Restore(0,0,0);
      goto __pyx_L5_exception_handled;
    }

    /* "cassandra/cluster.py":2425
 *         except ReferenceError:
 *             pass  # our weak reference to the Cluster is no good
 *         except Exception:             # <<<<<<<<<<<<<<
 *             log.debug("[control connection] Error refreshing node list and token map", exc_info=True)
 *             self._signal_error()
 */
    __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_10) {
      __Pyx_AddTraceback("cassandra.cluster.ControlConnection.refresh_node_list_and_token_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_4, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2425; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_8);

      /* "cassandra/cluster.py":2426
 *             pass  # our weak reference to the Cluster is no good
 *         except Exception:
 *             log.debug("[control connection] Error refreshing node list and token map", exc_info=True)             # <<<<<<<<<<<<<<
 *             self._signal_error()
 *         return False
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_exc_info, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__93, __pyx_t_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "cassandra/cluster.py":2427
 *         except Exception:
 *             log.debug("[control connection] Error refreshing node list and token map", exc_info=True)
 *             self._signal_error()             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_signal_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2427; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (__pyx_t_11) {
        __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2427; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2427; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L8_try_return:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    goto __pyx_L0;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    __pyx_L11_try_end:;
  }

  /* "cassandra/cluster.py":2428
 *             log.debug("[control connection] Error refreshing node list and token map", exc_info=True)
 *             self._signal_error()
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def _refresh_node_list_and_token_map(self, connection, preloaded_results=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "cassandra/cluster.py":2414
 *         return True
 * 
 *     def refresh_node_list_and_token_map(self, force_token_rebuild=False):             # <<<<<<<<<<<<<<
 *         if not self._meta_refresh_enabled:
 *             log.debug("[control connection] Skipping node list refresh because meta refresh is disabled")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.refresh_node_list_and_token_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2430
 *         return False
 * 
 *     def _refresh_node_list_and_token_map(self, connection, preloaded_results=None,             # <<<<<<<<<<<<<<
 *                                          force_token_rebuild=False):
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_27_refresh_node_list_and_token_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_27_refresh_node_list_and_token_map = {"_refresh_node_list_and_token_map", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_27_refresh_node_list_and_token_map, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_27_refresh_node_list_and_token_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_connection = 0;
  PyObject *__pyx_v_preloaded_results = 0;
  PyObject *__pyx_v_force_token_rebuild = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_refresh_node_list_and_token_map (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_connection,&__pyx_n_s_preloaded_results,&__pyx_n_s_force_token_rebuild,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));

    /* "cassandra/cluster.py":2431
 * 
 *     def _refresh_node_list_and_token_map(self, connection, preloaded_results=None,
 *                                          force_token_rebuild=False):             # <<<<<<<<<<<<<<
 * 
 *         if preloaded_results:
 */
    values[3] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_connection)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_refresh_node_list_and_token_map", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_preloaded_results);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_force_token_rebuild);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_refresh_node_list_and_token_map") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_connection = values[1];
    __pyx_v_preloaded_results = values[2];
    __pyx_v_force_token_rebuild = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_refresh_node_list_and_token_map", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._refresh_node_list_and_token_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_26_refresh_node_list_and_token_map(__pyx_self, __pyx_v_self, __pyx_v_connection, __pyx_v_preloaded_results, __pyx_v_force_token_rebuild);

  /* "cassandra/cluster.py":2430
 *         return False
 * 
 *     def _refresh_node_list_and_token_map(self, connection, preloaded_results=None,             # <<<<<<<<<<<<<<
 *                                          force_token_rebuild=False):
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_26_refresh_node_list_and_token_map(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_connection, PyObject *__pyx_v_preloaded_results, PyObject *__pyx_v_force_token_rebuild) {
  PyObject *__pyx_v_peers_result = NULL;
  PyObject *__pyx_v_local_result = NULL;
  PyObject *__pyx_v_cl = NULL;
  PyObject *__pyx_v_peers_query = NULL;
  PyObject *__pyx_v_local_query = NULL;
  PyObject *__pyx_v_partitioner = NULL;
  PyObject *__pyx_v_token_map = NULL;
  PyObject *__pyx_v_local_rows = NULL;
  PyObject *__pyx_v_local_row = NULL;
  PyObject *__pyx_v_cluster_name = NULL;
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_datacenter = NULL;
  PyObject *__pyx_v_rack = NULL;
  PyObject *__pyx_v_tokens = NULL;
  PyObject *__pyx_v_should_rebuild_token_map = NULL;
  PyObject *__pyx_v_found_hosts = NULL;
  PyObject *__pyx_v_row = NULL;
  PyObject *__pyx_v_addr = NULL;
  CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
  PyObject *__pyx_v_old_host = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_refresh_node_list_and_token_map", 0);

  /* "cassandra/cluster.py":2433
 *                                          force_token_rebuild=False):
 * 
 *         if preloaded_results:             # <<<<<<<<<<<<<<
 *             log.debug("[control connection] Refreshing node list and token map using preloaded results")
 *             peers_result = preloaded_results[0]
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_preloaded_results); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cassandra/cluster.py":2434
 * 
 *         if preloaded_results:
 *             log.debug("[control connection] Refreshing node list and token map using preloaded results")             # <<<<<<<<<<<<<<
 *             peers_result = preloaded_results[0]
 *             local_result = preloaded_results[1]
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__94, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2435
 *         if preloaded_results:
 *             log.debug("[control connection] Refreshing node list and token map using preloaded results")
 *             peers_result = preloaded_results[0]             # <<<<<<<<<<<<<<
 *             local_result = preloaded_results[1]
 *         else:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_preloaded_results, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2435; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_peers_result = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2436
 *             log.debug("[control connection] Refreshing node list and token map using preloaded results")
 *             peers_result = preloaded_results[0]
 *             local_result = preloaded_results[1]             # <<<<<<<<<<<<<<
 *         else:
 *             log.debug("[control connection] Refreshing node list and token map")
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_preloaded_results, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_local_result = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cassandra/cluster.py":2438
 *             local_result = preloaded_results[1]
 *         else:
 *             log.debug("[control connection] Refreshing node list and token map")             # <<<<<<<<<<<<<<
 *             cl = ConsistencyLevel.ONE
 *             peers_query = QueryMessage(query=self._SELECT_PEERS, consistency_level=cl)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__95, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2439
 *         else:
 *             log.debug("[control connection] Refreshing node list and token map")
 *             cl = ConsistencyLevel.ONE             # <<<<<<<<<<<<<<
 *             peers_query = QueryMessage(query=self._SELECT_PEERS, consistency_level=cl)
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=cl)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConsistencyLevel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ONE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_cl = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "cassandra/cluster.py":2440
 *             log.debug("[control connection] Refreshing node list and token map")
 *             cl = ConsistencyLevel.ONE
 *             peers_query = QueryMessage(query=self._SELECT_PEERS, consistency_level=cl)             # <<<<<<<<<<<<<<
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=cl)
 *             peers_result, local_result = connection.wait_for_responses(
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_PEERS); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_query, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_peers_query = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2441
 *             cl = ConsistencyLevel.ONE
 *             peers_query = QueryMessage(query=self._SELECT_PEERS, consistency_level=cl)
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=cl)             # <<<<<<<<<<<<<<
 *             peers_result, local_result = connection.wait_for_responses(
 *                 peers_query, local_query, timeout=self._timeout)
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_LOCAL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_query, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_local_query = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "cassandra/cluster.py":2442
 *             peers_query = QueryMessage(query=self._SELECT_PEERS, consistency_level=cl)
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=cl)
 *             peers_result, local_result = connection.wait_for_responses(             # <<<<<<<<<<<<<<
 *                 peers_query, local_query, timeout=self._timeout)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_wait_for_responses); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "cassandra/cluster.py":2443
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=cl)
 *             peers_result, local_result = connection.wait_for_responses(
 *                 peers_query, local_query, timeout=self._timeout)             # <<<<<<<<<<<<<<
 * 
 *         peers_result = dict_factory(*peers_result.results)
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_peers_query);
    __Pyx_GIVEREF(__pyx_v_peers_query);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_peers_query);
    __Pyx_INCREF(__pyx_v_local_query);
    __Pyx_GIVEREF(__pyx_v_local_query);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_local_query);

    /* "cassandra/cluster.py":2442
 *             peers_query = QueryMessage(query=self._SELECT_PEERS, consistency_level=cl)
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=cl)
 *             peers_result, local_result = connection.wait_for_responses(             # <<<<<<<<<<<<<<
 *                 peers_query, local_query, timeout=self._timeout)
 * 
 */
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "cassandra/cluster.py":2443
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=cl)
 *             peers_result, local_result = connection.wait_for_responses(
 *                 peers_query, local_query, timeout=self._timeout)             # <<<<<<<<<<<<<<
 * 
 *         peers_result = dict_factory(*peers_result.results)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_timeout, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2442
 *             peers_query = QueryMessage(query=self._SELECT_PEERS, consistency_level=cl)
 *             local_query = QueryMessage(query=self._SELECT_LOCAL, consistency_level=cl)
 *             peers_result, local_result = connection.wait_for_responses(             # <<<<<<<<<<<<<<
 *                 peers_query, local_query, timeout=self._timeout)
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_peers_result = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_local_result = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":2445
 *                 peers_query, local_query, timeout=self._timeout)
 * 
 *         peers_result = dict_factory(*peers_result.results)             # <<<<<<<<<<<<<<
 * 
 *         partitioner = None
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_peers_result, __pyx_n_s_results); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_peers_result, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2447
 *         peers_result = dict_factory(*peers_result.results)
 * 
 *         partitioner = None             # <<<<<<<<<<<<<<
 *         token_map = {}
 * 
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_partitioner = Py_None;

  /* "cassandra/cluster.py":2448
 * 
 *         partitioner = None
 *         token_map = {}             # <<<<<<<<<<<<<<
 * 
 *         if local_result.results:
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_token_map = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2450
 *         token_map = {}
 * 
 *         if local_result.results:             # <<<<<<<<<<<<<<
 *             local_rows = dict_factory(*(local_result.results))
 *             local_row = local_rows[0]
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_local_result, __pyx_n_s_results); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cassandra/cluster.py":2451
 * 
 *         if local_result.results:
 *             local_rows = dict_factory(*(local_result.results))             # <<<<<<<<<<<<<<
 *             local_row = local_rows[0]
 *             cluster_name = local_row["cluster_name"]
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_local_result, __pyx_n_s_results); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_local_rows = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2452
 *         if local_result.results:
 *             local_rows = dict_factory(*(local_result.results))
 *             local_row = local_rows[0]             # <<<<<<<<<<<<<<
 *             cluster_name = local_row["cluster_name"]
 *             self._cluster.metadata.cluster_name = cluster_name
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_local_rows, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2452; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_local_row = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2453
 *             local_rows = dict_factory(*(local_result.results))
 *             local_row = local_rows[0]
 *             cluster_name = local_row["cluster_name"]             # <<<<<<<<<<<<<<
 *             self._cluster.metadata.cluster_name = cluster_name
 * 
 */
    __pyx_t_4 = PyObject_GetItem(__pyx_v_local_row, __pyx_n_s_cluster_name); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2453; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_cluster_name = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2454
 *             local_row = local_rows[0]
 *             cluster_name = local_row["cluster_name"]
 *             self._cluster.metadata.cluster_name = cluster_name             # <<<<<<<<<<<<<<
 * 
 *             host = self._cluster.metadata.get_host(connection.host)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_metadata); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_5, __pyx_n_s_cluster_name, __pyx_v_cluster_name) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2456
 *             self._cluster.metadata.cluster_name = cluster_name
 * 
 *             host = self._cluster.metadata.get_host(connection.host)             # <<<<<<<<<<<<<<
 *             if host:
 *                 datacenter = local_row.get("data_center")
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_metadata); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_host); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_host); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_host = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2457
 * 
 *             host = self._cluster.metadata.get_host(connection.host)
 *             if host:             # <<<<<<<<<<<<<<
 *                 datacenter = local_row.get("data_center")
 *                 rack = local_row.get("rack")
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_host); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {

      /* "cassandra/cluster.py":2458
 *             host = self._cluster.metadata.get_host(connection.host)
 *             if host:
 *                 datacenter = local_row.get("data_center")             # <<<<<<<<<<<<<<
 *                 rack = local_row.get("rack")
 *                 self._update_location_info(host, datacenter, rack)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_local_row, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__96, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_datacenter = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "cassandra/cluster.py":2459
 *             if host:
 *                 datacenter = local_row.get("data_center")
 *                 rack = local_row.get("rack")             # <<<<<<<<<<<<<<
 *                 self._update_location_info(host, datacenter, rack)
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_local_row, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__97, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_rack = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "cassandra/cluster.py":2460
 *                 datacenter = local_row.get("data_center")
 *                 rack = local_row.get("rack")
 *                 self._update_location_info(host, datacenter, rack)             # <<<<<<<<<<<<<<
 * 
 *             partitioner = local_row.get("partitioner")
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_update_location_info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_8 = 1;
        }
      }
      __pyx_t_2 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_8, __pyx_v_host);
      __Pyx_INCREF(__pyx_v_datacenter);
      __Pyx_GIVEREF(__pyx_v_datacenter);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_8, __pyx_v_datacenter);
      __Pyx_INCREF(__pyx_v_rack);
      __Pyx_GIVEREF(__pyx_v_rack);
      PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_8, __pyx_v_rack);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "cassandra/cluster.py":2462
 *                 self._update_location_info(host, datacenter, rack)
 * 
 *             partitioner = local_row.get("partitioner")             # <<<<<<<<<<<<<<
 *             tokens = local_row.get("tokens")
 *             if partitioner and tokens:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_local_row, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__98, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_partitioner, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2463
 * 
 *             partitioner = local_row.get("partitioner")
 *             tokens = local_row.get("tokens")             # <<<<<<<<<<<<<<
 *             if partitioner and tokens:
 *                 token_map[host] = tokens
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_local_row, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__99, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_tokens = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2464
 *             partitioner = local_row.get("partitioner")
 *             tokens = local_row.get("tokens")
 *             if partitioner and tokens:             # <<<<<<<<<<<<<<
 *                 token_map[host] = tokens
 * 
 */
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_partitioner); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_9) {
    } else {
      __pyx_t_1 = __pyx_t_9;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_tokens); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_t_9;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cassandra/cluster.py":2465
 *             tokens = local_row.get("tokens")
 *             if partitioner and tokens:
 *                 token_map[host] = tokens             # <<<<<<<<<<<<<<
 * 
 *         # Check metadata.partitioner to see if we haven't built anything yet. If
 */
      if (unlikely(PyDict_SetItem(__pyx_v_token_map, __pyx_v_host, __pyx_v_tokens) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "cassandra/cluster.py":2470
 *         # every node in the cluster was in the contact points, we won't discover
 *         # any new nodes, so we need this additional check.  (See PYTHON-90)
 *         should_rebuild_token_map = force_token_rebuild or self._cluster.metadata.partitioner is None             # <<<<<<<<<<<<<<
 *         found_hosts = set()
 *         for row in peers_result:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_force_token_rebuild); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_1) {
  } else {
    __Pyx_INCREF(__pyx_v_force_token_rebuild);
    __pyx_t_5 = __pyx_v_force_token_rebuild;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_metadata); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_partitioner); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = (__pyx_t_4 == Py_None);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_L11_bool_binop_done:;
  __pyx_v_should_rebuild_token_map = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cassandra/cluster.py":2471
 *         # any new nodes, so we need this additional check.  (See PYTHON-90)
 *         should_rebuild_token_map = force_token_rebuild or self._cluster.metadata.partitioner is None
 *         found_hosts = set()             # <<<<<<<<<<<<<<
 *         for row in peers_result:
 *             addr = row.get("rpc_address")
 */
  __pyx_t_5 = PySet_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_found_hosts = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "cassandra/cluster.py":2472
 *         should_rebuild_token_map = force_token_rebuild or self._cluster.metadata.partitioner is None
 *         found_hosts = set()
 *         for row in peers_result:             # <<<<<<<<<<<<<<
 *             addr = row.get("rpc_address")
 * 
 */
  if (likely(PyList_CheckExact(__pyx_v_peers_result)) || PyTuple_CheckExact(__pyx_v_peers_result)) {
    __pyx_t_5 = __pyx_v_peers_result; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_peers_result); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_10(__pyx_t_5);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2473
 *         found_hosts = set()
 *         for row in peers_result:
 *             addr = row.get("rpc_address")             # <<<<<<<<<<<<<<
 * 
 *             if not addr or addr in ["0.0.0.0", "::"]:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__100, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_addr, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2475
 *             addr = row.get("rpc_address")
 * 
 *             if not addr or addr in ["0.0.0.0", "::"]:             # <<<<<<<<<<<<<<
 *                 addr = row.get("peer")
 * 
 */
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_addr); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = ((!__pyx_t_9) != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_1 = __pyx_t_11;
      goto __pyx_L16_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_v_addr);
    __pyx_t_2 = __pyx_v_addr;
    __pyx_t_9 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s_0_0_0_0, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_9) {
    } else {
      __pyx_t_11 = __pyx_t_9;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_9 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__101, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = __pyx_t_9;
    __pyx_L18_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = (__pyx_t_11 != 0);
    __pyx_t_1 = __pyx_t_9;
    __pyx_L16_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cassandra/cluster.py":2476
 * 
 *             if not addr or addr in ["0.0.0.0", "::"]:
 *                 addr = row.get("peer")             # <<<<<<<<<<<<<<
 * 
 *             tokens = row.get("tokens")
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__102, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_addr, __pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L15;
    }
    __pyx_L15:;

    /* "cassandra/cluster.py":2478
 *                 addr = row.get("peer")
 * 
 *             tokens = row.get("tokens")             # <<<<<<<<<<<<<<
 *             if not tokens:
 *                 log.warning("Excluding host (%s) with no tokens in system.peers table of %s." % (addr, connection.host))
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__103, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_tokens, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2479
 * 
 *             tokens = row.get("tokens")
 *             if not tokens:             # <<<<<<<<<<<<<<
 *                 log.warning("Excluding host (%s) with no tokens in system.peers table of %s." % (addr, connection.host))
 *                 continue
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_tokens); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = ((!__pyx_t_1) != 0);
    if (__pyx_t_9) {

      /* "cassandra/cluster.py":2480
 *             tokens = row.get("tokens")
 *             if not tokens:
 *                 log.warning("Excluding host (%s) with no tokens in system.peers table of %s." % (addr, connection.host))             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_warning); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_host); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_addr);
      __Pyx_GIVEREF(__pyx_v_addr);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_addr);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Excluding_host_s_with_no_tokens, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (!__pyx_t_3) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "cassandra/cluster.py":2481
 *             if not tokens:
 *                 log.warning("Excluding host (%s) with no tokens in system.peers table of %s." % (addr, connection.host))
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             found_hosts.add(addr)
 */
      goto __pyx_L13_continue;
    }

    /* "cassandra/cluster.py":2483
 *                 continue
 * 
 *             found_hosts.add(addr)             # <<<<<<<<<<<<<<
 * 
 *             host = self._cluster.metadata.get_host(addr)
 */
    __pyx_t_13 = PySet_Add(__pyx_v_found_hosts, __pyx_v_addr); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "cassandra/cluster.py":2485
 *             found_hosts.add(addr)
 * 
 *             host = self._cluster.metadata.get_host(addr)             # <<<<<<<<<<<<<<
 *             datacenter = row.get("data_center")
 *             rack = row.get("rack")
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_metadata); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_get_host); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_12) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_12); __pyx_t_12 = NULL;
      __Pyx_INCREF(__pyx_v_addr);
      __Pyx_GIVEREF(__pyx_v_addr);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_addr);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_host, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2486
 * 
 *             host = self._cluster.metadata.get_host(addr)
 *             datacenter = row.get("data_center")             # <<<<<<<<<<<<<<
 *             rack = row.get("rack")
 *             if host is None:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__104, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_datacenter, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "cassandra/cluster.py":2487
 *             host = self._cluster.metadata.get_host(addr)
 *             datacenter = row.get("data_center")
 *             rack = row.get("rack")             # <<<<<<<<<<<<<<
 *             if host is None:
 *                 log.debug("[control connection] Found new host to connect to: %s", addr)
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_get); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__105, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_rack, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2488
 *             datacenter = row.get("data_center")
 *             rack = row.get("rack")
 *             if host is None:             # <<<<<<<<<<<<<<
 *                 log.debug("[control connection] Found new host to connect to: %s", addr)
 *                 host, _ = self._cluster.add_host(addr, datacenter, rack, signal=True, refresh_nodes=False)
 */
    __pyx_t_9 = (__pyx_v_host == Py_None);
    __pyx_t_1 = (__pyx_t_9 != 0);
    if (__pyx_t_1) {

      /* "cassandra/cluster.py":2489
 *             rack = row.get("rack")
 *             if host is None:
 *                 log.debug("[control connection] Found new host to connect to: %s", addr)             # <<<<<<<<<<<<<<
 *                 host, _ = self._cluster.add_host(addr, datacenter, rack, signal=True, refresh_nodes=False)
 *                 should_rebuild_token_map = True
 */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      __pyx_t_14 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_14 = 1;
        }
      }
      __pyx_t_12 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_control_connection_Found_new_ho);
      __Pyx_GIVEREF(__pyx_kp_s_control_connection_Found_new_ho);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_14, __pyx_kp_s_control_connection_Found_new_ho);
      __Pyx_INCREF(__pyx_v_addr);
      __Pyx_GIVEREF(__pyx_v_addr);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_14, __pyx_v_addr);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "cassandra/cluster.py":2490
 *             if host is None:
 *                 log.debug("[control connection] Found new host to connect to: %s", addr)
 *                 host, _ = self._cluster.add_host(addr, datacenter, rack, signal=True, refresh_nodes=False)             # <<<<<<<<<<<<<<
 *                 should_rebuild_token_map = True
 *             else:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_add_host); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_addr);
      __Pyx_GIVEREF(__pyx_v_addr);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_addr);
      __Pyx_INCREF(__pyx_v_datacenter);
      __Pyx_GIVEREF(__pyx_v_datacenter);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_datacenter);
      __Pyx_INCREF(__pyx_v_rack);
      __Pyx_GIVEREF(__pyx_v_rack);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_rack);
      __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_signal, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_refresh_nodes, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_12); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
        PyObject* sequence = __pyx_t_7;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_12 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_2);
        #else
        __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        #endif
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_12 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_12)) goto __pyx_L22_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_12);
        index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L22_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_6 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L23_unpacking_done;
        __pyx_L22_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_6 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L23_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_host, __pyx_t_12);
      __pyx_t_12 = 0;
      __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "cassandra/cluster.py":2491
 *                 log.debug("[control connection] Found new host to connect to: %s", addr)
 *                 host, _ = self._cluster.add_host(addr, datacenter, rack, signal=True, refresh_nodes=False)
 *                 should_rebuild_token_map = True             # <<<<<<<<<<<<<<
 *             else:
 *                 should_rebuild_token_map |= self._update_location_info(host, datacenter, rack)
 */
      __Pyx_INCREF(Py_True);
      __Pyx_DECREF_SET(__pyx_v_should_rebuild_token_map, Py_True);
      goto __pyx_L21;
    }
    /*else*/ {

      /* "cassandra/cluster.py":2493
 *                 should_rebuild_token_map = True
 *             else:
 *                 should_rebuild_token_map |= self._update_location_info(host, datacenter, rack)             # <<<<<<<<<<<<<<
 * 
 *             if partitioner and tokens:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_update_location_info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_12 = NULL;
      __pyx_t_14 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_14 = 1;
        }
      }
      __pyx_t_4 = PyTuple_New(3+__pyx_t_14); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_12) {
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_12); __pyx_t_12 = NULL;
      }
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_14, __pyx_v_host);
      __Pyx_INCREF(__pyx_v_datacenter);
      __Pyx_GIVEREF(__pyx_v_datacenter);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_14, __pyx_v_datacenter);
      __Pyx_INCREF(__pyx_v_rack);
      __Pyx_GIVEREF(__pyx_v_rack);
      PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_14, __pyx_v_rack);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_InPlaceOr(__pyx_v_should_rebuild_token_map, __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_should_rebuild_token_map, __pyx_t_2);
      __pyx_t_2 = 0;
    }
    __pyx_L21:;

    /* "cassandra/cluster.py":2495
 *                 should_rebuild_token_map |= self._update_location_info(host, datacenter, rack)
 * 
 *             if partitioner and tokens:             # <<<<<<<<<<<<<<
 *                 token_map[host] = tokens
 * 
 */
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_partitioner); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_9) {
    } else {
      __pyx_t_1 = __pyx_t_9;
      goto __pyx_L25_bool_binop_done;
    }
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_tokens); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_t_9;
    __pyx_L25_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cassandra/cluster.py":2496
 * 
 *             if partitioner and tokens:
 *                 token_map[host] = tokens             # <<<<<<<<<<<<<<
 * 
 *         for old_host in self._cluster.metadata.all_hosts():
 */
      if (unlikely(PyDict_SetItem(__pyx_v_token_map, __pyx_v_host, __pyx_v_tokens) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L24;
    }
    __pyx_L24:;

    /* "cassandra/cluster.py":2472
 *         should_rebuild_token_map = force_token_rebuild or self._cluster.metadata.partitioner is None
 *         found_hosts = set()
 *         for row in peers_result:             # <<<<<<<<<<<<<<
 *             addr = row.get("rpc_address")
 * 
 */
    __pyx_L13_continue:;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cassandra/cluster.py":2498
 *                 token_map[host] = tokens
 * 
 *         for old_host in self._cluster.metadata.all_hosts():             # <<<<<<<<<<<<<<
 *             if old_host.address != connection.host and old_host.address not in found_hosts:
 *                 should_rebuild_token_map = True
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_metadata); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_all_hosts); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_7) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else {
    __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
    __pyx_t_2 = __pyx_t_5; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_10(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_old_host, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2499
 * 
 *         for old_host in self._cluster.metadata.all_hosts():
 *             if old_host.address != connection.host and old_host.address not in found_hosts:             # <<<<<<<<<<<<<<
 *                 should_rebuild_token_map = True
 *                 if old_host.address not in self._cluster.contact_points:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_old_host, __pyx_n_s_address); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_host); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_9) {
    } else {
      __pyx_t_1 = __pyx_t_9;
      goto __pyx_L30_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_old_host, __pyx_n_s_address); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_t_4, __pyx_v_found_hosts, Py_NE)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = (__pyx_t_9 != 0);
    __pyx_t_1 = __pyx_t_11;
    __pyx_L30_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cassandra/cluster.py":2500
 *         for old_host in self._cluster.metadata.all_hosts():
 *             if old_host.address != connection.host and old_host.address not in found_hosts:
 *                 should_rebuild_token_map = True             # <<<<<<<<<<<<<<
 *                 if old_host.address not in self._cluster.contact_points:
 *                     log.debug("[control connection] Found host that has been removed: %r", old_host)
 */
      __Pyx_INCREF(Py_True);
      __Pyx_DECREF_SET(__pyx_v_should_rebuild_token_map, Py_True);

      /* "cassandra/cluster.py":2501
 *             if old_host.address != connection.host and old_host.address not in found_hosts:
 *                 should_rebuild_token_map = True
 *                 if old_host.address not in self._cluster.contact_points:             # <<<<<<<<<<<<<<
 *                     log.debug("[control connection] Found host that has been removed: %r", old_host)
 *                     self._cluster.remove_host(old_host)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_old_host, __pyx_n_s_address); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_contact_points); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_t_4, __pyx_t_5, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_11 = (__pyx_t_1 != 0);
      if (__pyx_t_11) {

        /* "cassandra/cluster.py":2502
 *                 should_rebuild_token_map = True
 *                 if old_host.address not in self._cluster.contact_points:
 *                     log.debug("[control connection] Found host that has been removed: %r", old_host)             # <<<<<<<<<<<<<<
 *                     self._cluster.remove_host(old_host)
 * 
 */
        __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = NULL;
        __pyx_t_14 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_14 = 1;
          }
        }
        __pyx_t_12 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_s_control_connection_Found_host_t);
        __Pyx_GIVEREF(__pyx_kp_s_control_connection_Found_host_t);
        PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_14, __pyx_kp_s_control_connection_Found_host_t);
        __Pyx_INCREF(__pyx_v_old_host);
        __Pyx_GIVEREF(__pyx_v_old_host);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_14, __pyx_v_old_host);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "cassandra/cluster.py":2503
 *                 if old_host.address not in self._cluster.contact_points:
 *                     log.debug("[control connection] Found host that has been removed: %r", old_host)
 *                     self._cluster.remove_host(old_host)             # <<<<<<<<<<<<<<
 * 
 *         log.debug("[control connection] Finished fetching ring info")
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_remove_host); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
          }
        }
        if (!__pyx_t_7) {
          __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_old_host); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
        } else {
          __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
          __Pyx_INCREF(__pyx_v_old_host);
          __Pyx_GIVEREF(__pyx_v_old_host);
          PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_old_host);
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L32;
      }
      __pyx_L32:;
      goto __pyx_L29;
    }
    __pyx_L29:;

    /* "cassandra/cluster.py":2498
 *                 token_map[host] = tokens
 * 
 *         for old_host in self._cluster.metadata.all_hosts():             # <<<<<<<<<<<<<<
 *             if old_host.address != connection.host and old_host.address not in found_hosts:
 *                 should_rebuild_token_map = True
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2505
 *                     self._cluster.remove_host(old_host)
 * 
 *         log.debug("[control connection] Finished fetching ring info")             # <<<<<<<<<<<<<<
 *         if partitioner and should_rebuild_token_map:
 *             log.debug("[control connection] Rebuilding token map due to topology changes")
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__106, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2506
 * 
 *         log.debug("[control connection] Finished fetching ring info")
 *         if partitioner and should_rebuild_token_map:             # <<<<<<<<<<<<<<
 *             log.debug("[control connection] Rebuilding token map due to topology changes")
 *             self._cluster.metadata.rebuild_token_map(partitioner, token_map)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_partitioner); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {
  } else {
    __pyx_t_11 = __pyx_t_1;
    goto __pyx_L34_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_should_rebuild_token_map); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = __pyx_t_1;
  __pyx_L34_bool_binop_done:;
  if (__pyx_t_11) {

    /* "cassandra/cluster.py":2507
 *         log.debug("[control connection] Finished fetching ring info")
 *         if partitioner and should_rebuild_token_map:
 *             log.debug("[control connection] Rebuilding token map due to topology changes")             # <<<<<<<<<<<<<<
 *             self._cluster.metadata.rebuild_token_map(partitioner, token_map)
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__107, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2508
 *         if partitioner and should_rebuild_token_map:
 *             log.debug("[control connection] Rebuilding token map due to topology changes")
 *             self._cluster.metadata.rebuild_token_map(partitioner, token_map)             # <<<<<<<<<<<<<<
 * 
 *     def _update_location_info(self, host, datacenter, rack):
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_metadata); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_rebuild_token_map); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_8 = 1;
      }
    }
    __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_12) {
      __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_12); __pyx_t_12 = NULL;
    }
    __Pyx_INCREF(__pyx_v_partitioner);
    __Pyx_GIVEREF(__pyx_v_partitioner);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_v_partitioner);
    __Pyx_INCREF(__pyx_v_token_map);
    __Pyx_GIVEREF(__pyx_v_token_map);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_v_token_map);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L33;
  }
  __pyx_L33:;

  /* "cassandra/cluster.py":2430
 *         return False
 * 
 *     def _refresh_node_list_and_token_map(self, connection, preloaded_results=None,             # <<<<<<<<<<<<<<
 *                                          force_token_rebuild=False):
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._refresh_node_list_and_token_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_peers_result);
  __Pyx_XDECREF(__pyx_v_local_result);
  __Pyx_XDECREF(__pyx_v_cl);
  __Pyx_XDECREF(__pyx_v_peers_query);
  __Pyx_XDECREF(__pyx_v_local_query);
  __Pyx_XDECREF(__pyx_v_partitioner);
  __Pyx_XDECREF(__pyx_v_token_map);
  __Pyx_XDECREF(__pyx_v_local_rows);
  __Pyx_XDECREF(__pyx_v_local_row);
  __Pyx_XDECREF(__pyx_v_cluster_name);
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_datacenter);
  __Pyx_XDECREF(__pyx_v_rack);
  __Pyx_XDECREF(__pyx_v_tokens);
  __Pyx_XDECREF(__pyx_v_should_rebuild_token_map);
  __Pyx_XDECREF(__pyx_v_found_hosts);
  __Pyx_XDECREF(__pyx_v_row);
  __Pyx_XDECREF(__pyx_v_addr);
  __Pyx_XDECREF(__pyx_v__);
  __Pyx_XDECREF(__pyx_v_old_host);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2510
 *             self._cluster.metadata.rebuild_token_map(partitioner, token_map)
 * 
 *     def _update_location_info(self, host, datacenter, rack):             # <<<<<<<<<<<<<<
 *         if host.datacenter == datacenter and host.rack == rack:
 *             return False
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_29_update_location_info(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_29_update_location_info = {"_update_location_info", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_29_update_location_info, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_29_update_location_info(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_datacenter = 0;
  PyObject *__pyx_v_rack = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_update_location_info (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,&__pyx_n_s_datacenter,&__pyx_n_s_rack,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_update_location_info", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_datacenter)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_update_location_info", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rack)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_update_location_info", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_update_location_info") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
    __pyx_v_datacenter = values[2];
    __pyx_v_rack = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_update_location_info", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._update_location_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_28_update_location_info(__pyx_self, __pyx_v_self, __pyx_v_host, __pyx_v_datacenter, __pyx_v_rack);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_28_update_location_info(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_datacenter, PyObject *__pyx_v_rack) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_update_location_info", 0);

  /* "cassandra/cluster.py":2511
 * 
 *     def _update_location_info(self, host, datacenter, rack):
 *         if host.datacenter == datacenter and host.rack == rack:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_datacenter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_datacenter, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_rack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_rack, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cassandra/cluster.py":2512
 *     def _update_location_info(self, host, datacenter, rack):
 *         if host.datacenter == datacenter and host.rack == rack:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         # If the dc/rack information changes, we need to update the load balancing policy.
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2517
 *         # For that, we remove and re-add the node against the policy. Not the most elegant, and assumes
 *         # that the policy will update correctly, but in practice this should work.
 *         self._cluster.load_balancing_policy.on_down(host)             # <<<<<<<<<<<<<<
 *         host.set_location_info(datacenter, rack)
 *         self._cluster.load_balancing_policy.on_up(host)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_load_balancing_policy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_on_down); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_host); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_host);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2518
 *         # that the policy will update correctly, but in practice this should work.
 *         self._cluster.load_balancing_policy.on_down(host)
 *         host.set_location_info(datacenter, rack)             # <<<<<<<<<<<<<<
 *         self._cluster.load_balancing_policy.on_up(host)
 *         return True
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_set_location_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_6) {
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_INCREF(__pyx_v_datacenter);
  __Pyx_GIVEREF(__pyx_v_datacenter);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_datacenter);
  __Pyx_INCREF(__pyx_v_rack);
  __Pyx_GIVEREF(__pyx_v_rack);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_rack);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2519
 *         self._cluster.load_balancing_policy.on_down(host)
 *         host.set_location_info(datacenter, rack)
 *         self._cluster.load_balancing_policy.on_up(host)             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_load_balancing_policy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_on_up); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_host); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_host);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2520
 *         host.set_location_info(datacenter, rack)
 *         self._cluster.load_balancing_policy.on_up(host)
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def _delay_for_event_type(self, event_type, delay_window):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "cassandra/cluster.py":2510
 *             self._cluster.metadata.rebuild_token_map(partitioner, token_map)
 * 
 *     def _update_location_info(self, host, datacenter, rack):             # <<<<<<<<<<<<<<
 *         if host.datacenter == datacenter and host.rack == rack:
 *             return False
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._update_location_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2522
 *         return True
 * 
 *     def _delay_for_event_type(self, event_type, delay_window):             # <<<<<<<<<<<<<<
 *         # this serves to order processing correlated events (received within the window)
 *         # the window and randomization still have the desired effect of skew across client instances
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_31_delay_for_event_type(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_31_delay_for_event_type = {"_delay_for_event_type", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_31_delay_for_event_type, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_31_delay_for_event_type(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_event_type = 0;
  PyObject *__pyx_v_delay_window = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_delay_for_event_type (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_event_type,&__pyx_n_s_delay_window,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_event_type)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_delay_for_event_type", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2522; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_delay_window)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_delay_for_event_type", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2522; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_delay_for_event_type") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2522; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_event_type = values[1];
    __pyx_v_delay_window = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_delay_for_event_type", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2522; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._delay_for_event_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_30_delay_for_event_type(__pyx_self, __pyx_v_self, __pyx_v_event_type, __pyx_v_delay_window);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_30_delay_for_event_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_event_type, PyObject *__pyx_v_delay_window) {
  PyObject *__pyx_v_next_time = NULL;
  PyObject *__pyx_v_now = NULL;
  PyObject *__pyx_v_this_time = NULL;
  PyObject *__pyx_v_delay = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_delay_for_event_type", 0);

  /* "cassandra/cluster.py":2525
 *         # this serves to order processing correlated events (received within the window)
 *         # the window and randomization still have the desired effect of skew across client instances
 *         next_time = self._event_schedule_times.get(event_type, 0)             # <<<<<<<<<<<<<<
 *         now = self._time.time()
 *         if now <= next_time:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_event_schedule_times); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_2) {
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_INCREF(__pyx_v_event_type);
  __Pyx_GIVEREF(__pyx_v_event_type);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_event_type);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_int_0);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_next_time = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2526
 *         # the window and randomization still have the desired effect of skew across client instances
 *         next_time = self._event_schedule_times.get(event_type, 0)
 *         now = self._time.time()             # <<<<<<<<<<<<<<
 *         if now <= next_time:
 *             this_time = next_time + 0.01
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_time_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_time); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_now = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2527
 *         next_time = self._event_schedule_times.get(event_type, 0)
 *         now = self._time.time()
 *         if now <= next_time:             # <<<<<<<<<<<<<<
 *             this_time = next_time + 0.01
 *             delay = this_time - now
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_now, __pyx_v_next_time, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":2528
 *         now = self._time.time()
 *         if now <= next_time:
 *             this_time = next_time + 0.01             # <<<<<<<<<<<<<<
 *             delay = this_time - now
 *         else:
 */
    __pyx_t_1 = PyNumber_Add(__pyx_v_next_time, __pyx_float_0_01); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_this_time = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2529
 *         if now <= next_time:
 *             this_time = next_time + 0.01
 *             delay = this_time - now             # <<<<<<<<<<<<<<
 *         else:
 *             delay = random() * delay_window
 */
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_this_time, __pyx_v_now); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_delay = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cassandra/cluster.py":2531
 *             delay = this_time - now
 *         else:
 *             delay = random() * delay_window             # <<<<<<<<<<<<<<
 *             this_time = now + delay
 *         self._event_schedule_times[event_type] = this_time
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_random); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_v_delay_window); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_delay = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2532
 *         else:
 *             delay = random() * delay_window
 *             this_time = now + delay             # <<<<<<<<<<<<<<
 *         self._event_schedule_times[event_type] = this_time
 *         return delay
 */
    __pyx_t_5 = PyNumber_Add(__pyx_v_now, __pyx_v_delay); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_this_time = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":2533
 *             delay = random() * delay_window
 *             this_time = now + delay
 *         self._event_schedule_times[event_type] = this_time             # <<<<<<<<<<<<<<
 *         return delay
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_event_schedule_times); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_v_event_type, __pyx_v_this_time) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cassandra/cluster.py":2534
 *             this_time = now + delay
 *         self._event_schedule_times[event_type] = this_time
 *         return delay             # <<<<<<<<<<<<<<
 * 
 *     def _handle_topology_change(self, event):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_delay);
  __pyx_r = __pyx_v_delay;
  goto __pyx_L0;

  /* "cassandra/cluster.py":2522
 *         return True
 * 
 *     def _delay_for_event_type(self, event_type, delay_window):             # <<<<<<<<<<<<<<
 *         # this serves to order processing correlated events (received within the window)
 *         # the window and randomization still have the desired effect of skew across client instances
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._delay_for_event_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_next_time);
  __Pyx_XDECREF(__pyx_v_now);
  __Pyx_XDECREF(__pyx_v_this_time);
  __Pyx_XDECREF(__pyx_v_delay);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2536
 *         return delay
 * 
 *     def _handle_topology_change(self, event):             # <<<<<<<<<<<<<<
 *         change_type = event["change_type"]
 *         addr, port = event["address"]
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_33_handle_topology_change(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_33_handle_topology_change = {"_handle_topology_change", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_33_handle_topology_change, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_33_handle_topology_change(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_event = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handle_topology_change (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_event,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_event)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_handle_topology_change", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_handle_topology_change") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_event = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_handle_topology_change", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._handle_topology_change", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_32_handle_topology_change(__pyx_self, __pyx_v_self, __pyx_v_event);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_32_handle_topology_change(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_event) {
  PyObject *__pyx_v_change_type = NULL;
  PyObject *__pyx_v_addr = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_port = NULL;
  PyObject *__pyx_v_delay = NULL;
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handle_topology_change", 0);

  /* "cassandra/cluster.py":2537
 * 
 *     def _handle_topology_change(self, event):
 *         change_type = event["change_type"]             # <<<<<<<<<<<<<<
 *         addr, port = event["address"]
 *         if change_type == "NEW_NODE" or change_type == "MOVED_NODE":
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_event, __pyx_n_s_change_type); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2537; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_change_type = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2538
 *     def _handle_topology_change(self, event):
 *         change_type = event["change_type"]
 *         addr, port = event["address"]             # <<<<<<<<<<<<<<
 *         if change_type == "NEW_NODE" or change_type == "MOVED_NODE":
 *             if self._topology_event_refresh_window >= 0:
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_event, __pyx_n_s_address); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_addr = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_port = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cassandra/cluster.py":2539
 *         change_type = event["change_type"]
 *         addr, port = event["address"]
 *         if change_type == "NEW_NODE" or change_type == "MOVED_NODE":             # <<<<<<<<<<<<<<
 *             if self._topology_event_refresh_window >= 0:
 *                 delay = self._delay_for_event_type('topology_change', self._topology_event_refresh_window)
 */
  __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_v_change_type, __pyx_n_s_NEW_NODE, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_v_change_type, __pyx_n_s_MOVED_NODE, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = __pyx_t_7;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":2540
 *         addr, port = event["address"]
 *         if change_type == "NEW_NODE" or change_type == "MOVED_NODE":
 *             if self._topology_event_refresh_window >= 0:             # <<<<<<<<<<<<<<
 *                 delay = self._delay_for_event_type('topology_change', self._topology_event_refresh_window)
 *                 self._cluster.scheduler.schedule_unique(delay, self.refresh_node_list_and_token_map)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_topology_event_refresh_window_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_6) {

      /* "cassandra/cluster.py":2541
 *         if change_type == "NEW_NODE" or change_type == "MOVED_NODE":
 *             if self._topology_event_refresh_window >= 0:
 *                 delay = self._delay_for_event_type('topology_change', self._topology_event_refresh_window)             # <<<<<<<<<<<<<<
 *                 self._cluster.scheduler.schedule_unique(delay, self.refresh_node_list_and_token_map)
 *         elif change_type == "REMOVED_NODE":
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_delay_for_event_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_topology_event_refresh_window_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_8 = 1;
        }
      }
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_n_s_topology_change);
      __Pyx_GIVEREF(__pyx_n_s_topology_change);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_n_s_topology_change);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_delay = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "cassandra/cluster.py":2542
 *             if self._topology_event_refresh_window >= 0:
 *                 delay = self._delay_for_event_type('topology_change', self._topology_event_refresh_window)
 *                 self._cluster.scheduler.schedule_unique(delay, self.refresh_node_list_and_token_map)             # <<<<<<<<<<<<<<
 *         elif change_type == "REMOVED_NODE":
 *             host = self._cluster.metadata.get_host(addr)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_scheduler); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_schedule_unique); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_refresh_node_list_and_token_map); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_8 = 1;
        }
      }
      __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_delay);
      __Pyx_GIVEREF(__pyx_v_delay);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_v_delay);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L5;
  }

  /* "cassandra/cluster.py":2543
 *                 delay = self._delay_for_event_type('topology_change', self._topology_event_refresh_window)
 *                 self._cluster.scheduler.schedule_unique(delay, self.refresh_node_list_and_token_map)
 *         elif change_type == "REMOVED_NODE":             # <<<<<<<<<<<<<<
 *             host = self._cluster.metadata.get_host(addr)
 *             self._cluster.scheduler.schedule_unique(0, self._cluster.remove_host, host)
 */
  __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_v_change_type, __pyx_n_s_REMOVED_NODE, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":2544
 *                 self._cluster.scheduler.schedule_unique(delay, self.refresh_node_list_and_token_map)
 *         elif change_type == "REMOVED_NODE":
 *             host = self._cluster.metadata.get_host(addr)             # <<<<<<<<<<<<<<
 *             self._cluster.scheduler.schedule_unique(0, self._cluster.remove_host, host)
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_metadata); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_addr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_addr);
      __Pyx_GIVEREF(__pyx_v_addr);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_addr);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_host = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "cassandra/cluster.py":2545
 *         elif change_type == "REMOVED_NODE":
 *             host = self._cluster.metadata.get_host(addr)
 *             self._cluster.scheduler.schedule_unique(0, self._cluster.remove_host, host)             # <<<<<<<<<<<<<<
 * 
 *     def _handle_status_change(self, event):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_scheduler); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_schedule_unique); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_remove_host); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_8 = 1;
      }
    }
    __pyx_t_2 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_8, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_8, __pyx_v_host);
    __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "cassandra/cluster.py":2536
 *         return delay
 * 
 *     def _handle_topology_change(self, event):             # <<<<<<<<<<<<<<
 *         change_type = event["change_type"]
 *         addr, port = event["address"]
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._handle_topology_change", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_change_type);
  __Pyx_XDECREF(__pyx_v_addr);
  __Pyx_XDECREF(__pyx_v_port);
  __Pyx_XDECREF(__pyx_v_delay);
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2547
 *             self._cluster.scheduler.schedule_unique(0, self._cluster.remove_host, host)
 * 
 *     def _handle_status_change(self, event):             # <<<<<<<<<<<<<<
 *         change_type = event["change_type"]
 *         addr, port = event["address"]
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_35_handle_status_change(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_35_handle_status_change = {"_handle_status_change", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_35_handle_status_change, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_35_handle_status_change(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_event = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handle_status_change (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_event,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_event)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_handle_status_change", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_handle_status_change") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_event = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_handle_status_change", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._handle_status_change", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_34_handle_status_change(__pyx_self, __pyx_v_self, __pyx_v_event);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_34_handle_status_change(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_event) {
  PyObject *__pyx_v_change_type = NULL;
  PyObject *__pyx_v_addr = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_port = NULL;
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_delay = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handle_status_change", 0);

  /* "cassandra/cluster.py":2548
 * 
 *     def _handle_status_change(self, event):
 *         change_type = event["change_type"]             # <<<<<<<<<<<<<<
 *         addr, port = event["address"]
 *         host = self._cluster.metadata.get_host(addr)
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_event, __pyx_n_s_change_type); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_change_type = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2549
 *     def _handle_status_change(self, event):
 *         change_type = event["change_type"]
 *         addr, port = event["address"]             # <<<<<<<<<<<<<<
 *         host = self._cluster.metadata.get_host(addr)
 *         if change_type == "UP":
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_event, __pyx_n_s_address); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_addr = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_port = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cassandra/cluster.py":2550
 *         change_type = event["change_type"]
 *         addr, port = event["address"]
 *         host = self._cluster.metadata.get_host(addr)             # <<<<<<<<<<<<<<
 *         if change_type == "UP":
 *             delay = 1 + self._delay_for_event_type('status_change', 0.5)  # randomness to avoid thundering herd problem on events
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_metadata); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_host); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_addr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_addr);
    __Pyx_GIVEREF(__pyx_v_addr);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_addr);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_host = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2551
 *         addr, port = event["address"]
 *         host = self._cluster.metadata.get_host(addr)
 *         if change_type == "UP":             # <<<<<<<<<<<<<<
 *             delay = 1 + self._delay_for_event_type('status_change', 0.5)  # randomness to avoid thundering herd problem on events
 *             if host is None:
 */
  __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_v_change_type, __pyx_n_s_UP, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_6) {

    /* "cassandra/cluster.py":2552
 *         host = self._cluster.metadata.get_host(addr)
 *         if change_type == "UP":
 *             delay = 1 + self._delay_for_event_type('status_change', 0.5)  # randomness to avoid thundering herd problem on events             # <<<<<<<<<<<<<<
 *             if host is None:
 *                 # this is the first time we've seen the node
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_delay_for_event_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__108, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_delay = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2553
 *         if change_type == "UP":
 *             delay = 1 + self._delay_for_event_type('status_change', 0.5)  # randomness to avoid thundering herd problem on events
 *             if host is None:             # <<<<<<<<<<<<<<
 *                 # this is the first time we've seen the node
 *                 self._cluster.scheduler.schedule_unique(delay, self.refresh_node_list_and_token_map)
 */
    __pyx_t_6 = (__pyx_v_host == Py_None);
    __pyx_t_7 = (__pyx_t_6 != 0);
    if (__pyx_t_7) {

      /* "cassandra/cluster.py":2555
 *             if host is None:
 *                 # this is the first time we've seen the node
 *                 self._cluster.scheduler.schedule_unique(delay, self.refresh_node_list_and_token_map)             # <<<<<<<<<<<<<<
 *             else:
 *                 self._cluster.scheduler.schedule_unique(delay, self._cluster.on_up, host)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_scheduler); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_schedule_unique); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_refresh_node_list_and_token_map); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_8 = 1;
        }
      }
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_delay);
      __Pyx_GIVEREF(__pyx_v_delay);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_delay);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "cassandra/cluster.py":2557
 *                 self._cluster.scheduler.schedule_unique(delay, self.refresh_node_list_and_token_map)
 *             else:
 *                 self._cluster.scheduler.schedule_unique(delay, self._cluster.on_up, host)             # <<<<<<<<<<<<<<
 *         elif change_type == "DOWN":
 *             # Note that there is a slight risk we can receive the event late and thus
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_scheduler); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_schedule_unique); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_on_up); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_8 = 1;
        }
      }
      __pyx_t_2 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_INCREF(__pyx_v_delay);
      __Pyx_GIVEREF(__pyx_v_delay);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_8, __pyx_v_delay);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_8, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_8, __pyx_v_host);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }

  /* "cassandra/cluster.py":2558
 *             else:
 *                 self._cluster.scheduler.schedule_unique(delay, self._cluster.on_up, host)
 *         elif change_type == "DOWN":             # <<<<<<<<<<<<<<
 *             # Note that there is a slight risk we can receive the event late and thus
 *             # mark the host down even though we already had reconnected successfully.
 */
  __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_v_change_type, __pyx_n_s_DOWN, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_7) {

    /* "cassandra/cluster.py":2563
 *             # But it is unlikely, and don't have too much consequence since we'll try reconnecting
 *             # right away, so we favor the detection to make the Host.is_up more accurate.
 *             if host is not None:             # <<<<<<<<<<<<<<
 *                 # this will be run by the scheduler
 *                 self._cluster.on_down(host, is_host_addition=False)
 */
    __pyx_t_7 = (__pyx_v_host != Py_None);
    __pyx_t_6 = (__pyx_t_7 != 0);
    if (__pyx_t_6) {

      /* "cassandra/cluster.py":2565
 *             if host is not None:
 *                 # this will be run by the scheduler
 *                 self._cluster.on_down(host, is_host_addition=False)             # <<<<<<<<<<<<<<
 * 
 *     def _handle_schema_change(self, event):
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_on_down); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_host);
      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_is_host_addition, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "cassandra/cluster.py":2547
 *             self._cluster.scheduler.schedule_unique(0, self._cluster.remove_host, host)
 * 
 *     def _handle_status_change(self, event):             # <<<<<<<<<<<<<<
 *         change_type = event["change_type"]
 *         addr, port = event["address"]
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._handle_status_change", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_change_type);
  __Pyx_XDECREF(__pyx_v_addr);
  __Pyx_XDECREF(__pyx_v_port);
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_delay);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2567
 *                 self._cluster.on_down(host, is_host_addition=False)
 * 
 *     def _handle_schema_change(self, event):             # <<<<<<<<<<<<<<
 *         if self._schema_event_refresh_window < 0:
 *             return
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_37_handle_schema_change(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_37_handle_schema_change = {"_handle_schema_change", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_37_handle_schema_change, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_37_handle_schema_change(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_event = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_handle_schema_change (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_event,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_event)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_handle_schema_change", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_handle_schema_change") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_event = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_handle_schema_change", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._handle_schema_change", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_36_handle_schema_change(__pyx_self, __pyx_v_self, __pyx_v_event);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_36_handle_schema_change(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_event) {
  PyObject *__pyx_v_keyspace = NULL;
  PyObject *__pyx_v_table = NULL;
  PyObject *__pyx_v_usertype = NULL;
  PyObject *__pyx_v_function = NULL;
  PyObject *__pyx_v_aggregate = NULL;
  PyObject *__pyx_v_delay = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_handle_schema_change", 0);

  /* "cassandra/cluster.py":2568
 * 
 *     def _handle_schema_change(self, event):
 *         if self._schema_event_refresh_window < 0:             # <<<<<<<<<<<<<<
 *             return
 *         keyspace = event.get('keyspace')
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_schema_event_refresh_window_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":2569
 *     def _handle_schema_change(self, event):
 *         if self._schema_event_refresh_window < 0:
 *             return             # <<<<<<<<<<<<<<
 *         keyspace = event.get('keyspace')
 *         table = event.get('table')
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2570
 *         if self._schema_event_refresh_window < 0:
 *             return
 *         keyspace = event.get('keyspace')             # <<<<<<<<<<<<<<
 *         table = event.get('table')
 *         usertype = event.get('type')
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_event, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__109, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_keyspace = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2571
 *             return
 *         keyspace = event.get('keyspace')
 *         table = event.get('table')             # <<<<<<<<<<<<<<
 *         usertype = event.get('type')
 *         function = event.get('function')
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_event, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__110, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_table = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2572
 *         keyspace = event.get('keyspace')
 *         table = event.get('table')
 *         usertype = event.get('type')             # <<<<<<<<<<<<<<
 *         function = event.get('function')
 *         aggregate = event.get('aggregate')
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_event, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__111, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_usertype = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2573
 *         table = event.get('table')
 *         usertype = event.get('type')
 *         function = event.get('function')             # <<<<<<<<<<<<<<
 *         aggregate = event.get('aggregate')
 *         delay = self._delay_for_event_type('schema_change', self._schema_event_refresh_window)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_event, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__112, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_function = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2574
 *         usertype = event.get('type')
 *         function = event.get('function')
 *         aggregate = event.get('aggregate')             # <<<<<<<<<<<<<<
 *         delay = self._delay_for_event_type('schema_change', self._schema_event_refresh_window)
 *         self._cluster.scheduler.schedule_unique(delay, self.refresh_schema, keyspace, table, usertype, function, aggregate)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_event, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__113, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_aggregate = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2575
 *         function = event.get('function')
 *         aggregate = event.get('aggregate')
 *         delay = self._delay_for_event_type('schema_change', self._schema_event_refresh_window)             # <<<<<<<<<<<<<<
 *         self._cluster.scheduler.schedule_unique(delay, self.refresh_schema, keyspace, table, usertype, function, aggregate)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_delay_for_event_type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_schema_event_refresh_window_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_n_s_schema_change);
  __Pyx_GIVEREF(__pyx_n_s_schema_change);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_n_s_schema_change);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_delay = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2576
 *         aggregate = event.get('aggregate')
 *         delay = self._delay_for_event_type('schema_change', self._schema_event_refresh_window)
 *         self._cluster.scheduler.schedule_unique(delay, self.refresh_schema, keyspace, table, usertype, function, aggregate)             # <<<<<<<<<<<<<<
 * 
 *     def wait_for_schema_agreement(self, connection=None, preloaded_results=None, wait_time=None):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_scheduler); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_schedule_unique); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_refresh_schema); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(7+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_v_delay);
  __Pyx_GIVEREF(__pyx_v_delay);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_delay);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_7);
  __Pyx_INCREF(__pyx_v_keyspace);
  __Pyx_GIVEREF(__pyx_v_keyspace);
  PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_v_keyspace);
  __Pyx_INCREF(__pyx_v_table);
  __Pyx_GIVEREF(__pyx_v_table);
  PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_6, __pyx_v_table);
  __Pyx_INCREF(__pyx_v_usertype);
  __Pyx_GIVEREF(__pyx_v_usertype);
  PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_6, __pyx_v_usertype);
  __Pyx_INCREF(__pyx_v_function);
  __Pyx_GIVEREF(__pyx_v_function);
  PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_6, __pyx_v_function);
  __Pyx_INCREF(__pyx_v_aggregate);
  __Pyx_GIVEREF(__pyx_v_aggregate);
  PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_6, __pyx_v_aggregate);
  __pyx_t_7 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2567
 *                 self._cluster.on_down(host, is_host_addition=False)
 * 
 *     def _handle_schema_change(self, event):             # <<<<<<<<<<<<<<
 *         if self._schema_event_refresh_window < 0:
 *             return
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._handle_schema_change", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_keyspace);
  __Pyx_XDECREF(__pyx_v_table);
  __Pyx_XDECREF(__pyx_v_usertype);
  __Pyx_XDECREF(__pyx_v_function);
  __Pyx_XDECREF(__pyx_v_aggregate);
  __Pyx_XDECREF(__pyx_v_delay);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2578
 *         self._cluster.scheduler.schedule_unique(delay, self.refresh_schema, keyspace, table, usertype, function, aggregate)
 * 
 *     def wait_for_schema_agreement(self, connection=None, preloaded_results=None, wait_time=None):             # <<<<<<<<<<<<<<
 * 
 *         total_timeout = wait_time if wait_time is not None else self._cluster.max_schema_agreement_wait
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_39wait_for_schema_agreement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_39wait_for_schema_agreement = {"wait_for_schema_agreement", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_39wait_for_schema_agreement, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_39wait_for_schema_agreement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_connection = 0;
  PyObject *__pyx_v_preloaded_results = 0;
  PyObject *__pyx_v_wait_time = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wait_for_schema_agreement (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_connection,&__pyx_n_s_preloaded_results,&__pyx_n_s_wait_time,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_connection);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_preloaded_results);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_wait_time);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wait_for_schema_agreement") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_connection = values[1];
    __pyx_v_preloaded_results = values[2];
    __pyx_v_wait_time = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("wait_for_schema_agreement", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.wait_for_schema_agreement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_38wait_for_schema_agreement(__pyx_self, __pyx_v_self, __pyx_v_connection, __pyx_v_preloaded_results, __pyx_v_wait_time);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_38wait_for_schema_agreement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_connection, PyObject *__pyx_v_preloaded_results, PyObject *__pyx_v_wait_time) {
  PyObject *__pyx_v_total_timeout = NULL;
  PyObject *__pyx_v_peers_result = NULL;
  PyObject *__pyx_v_local_result = NULL;
  PyObject *__pyx_v_schema_mismatches = NULL;
  PyObject *__pyx_v_start = NULL;
  PyObject *__pyx_v_elapsed = NULL;
  PyObject *__pyx_v_cl = NULL;
  PyObject *__pyx_v_peers_query = NULL;
  PyObject *__pyx_v_local_query = NULL;
  PyObject *__pyx_v_timeout = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *(*__pyx_t_16)(PyObject *);
  int __pyx_t_17;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("wait_for_schema_agreement", 0);
  __Pyx_INCREF(__pyx_v_connection);

  /* "cassandra/cluster.py":2580
 *     def wait_for_schema_agreement(self, connection=None, preloaded_results=None, wait_time=None):
 * 
 *         total_timeout = wait_time if wait_time is not None else self._cluster.max_schema_agreement_wait             # <<<<<<<<<<<<<<
 *         if total_timeout <= 0:
 *             return True
 */
  __pyx_t_2 = (__pyx_v_wait_time != Py_None);
  if ((__pyx_t_2 != 0)) {
    __Pyx_INCREF(__pyx_v_wait_time);
    __pyx_t_1 = __pyx_v_wait_time;
  } else {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max_schema_agreement_wait); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_v_total_timeout = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2581
 * 
 *         total_timeout = wait_time if wait_time is not None else self._cluster.max_schema_agreement_wait
 *         if total_timeout <= 0:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_total_timeout, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":2582
 *         total_timeout = wait_time if wait_time is not None else self._cluster.max_schema_agreement_wait
 *         if total_timeout <= 0:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         # Each schema change typically generates two schema refreshes, one
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2588
 *         # a lock is just a simple way to cut down on the number of schema queries
 *         # we'll make.
 *         with self._schema_agreement_lock:             # <<<<<<<<<<<<<<
 *             if self._is_shutdown:
 *                 return
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_schema_agreement_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "cassandra/cluster.py":2589
 *         # we'll make.
 *         with self._schema_agreement_lock:
 *             if self._is_shutdown:             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_2) {

            /* "cassandra/cluster.py":2590
 *         with self._schema_agreement_lock:
 *             if self._is_shutdown:
 *                 return             # <<<<<<<<<<<<<<
 * 
 *             if not connection:
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            goto __pyx_L12_try_return;
          }

          /* "cassandra/cluster.py":2592
 *                 return
 * 
 *             if not connection:             # <<<<<<<<<<<<<<
 *                 connection = self._connection
 * 
 */
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_connection); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2592; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __pyx_t_10 = ((!__pyx_t_2) != 0);
          if (__pyx_t_10) {

            /* "cassandra/cluster.py":2593
 * 
 *             if not connection:
 *                 connection = self._connection             # <<<<<<<<<<<<<<
 * 
 *             if preloaded_results:
 */
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF_SET(__pyx_v_connection, __pyx_t_1);
            __pyx_t_1 = 0;
            goto __pyx_L17;
          }
          __pyx_L17:;

          /* "cassandra/cluster.py":2595
 *                 connection = self._connection
 * 
 *             if preloaded_results:             # <<<<<<<<<<<<<<
 *                 log.debug("[control connection] Attempting to use preloaded results for schema agreement")
 * 
 */
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_preloaded_results); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2595; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          if (__pyx_t_10) {

            /* "cassandra/cluster.py":2596
 * 
 *             if preloaded_results:
 *                 log.debug("[control connection] Attempting to use preloaded results for schema agreement")             # <<<<<<<<<<<<<<
 * 
 *                 peers_result = preloaded_results[0]
 */
            __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2596; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2596; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__114, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2596; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "cassandra/cluster.py":2598
 *                 log.debug("[control connection] Attempting to use preloaded results for schema agreement")
 * 
 *                 peers_result = preloaded_results[0]             # <<<<<<<<<<<<<<
 *                 local_result = preloaded_results[1]
 *                 schema_mismatches = self._get_schema_mismatches(peers_result, local_result, connection.host)
 */
            __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_preloaded_results, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2598; __pyx_clineno = __LINE__; goto __pyx_L8_error;};
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_v_peers_result = __pyx_t_1;
            __pyx_t_1 = 0;

            /* "cassandra/cluster.py":2599
 * 
 *                 peers_result = preloaded_results[0]
 *                 local_result = preloaded_results[1]             # <<<<<<<<<<<<<<
 *                 schema_mismatches = self._get_schema_mismatches(peers_result, local_result, connection.host)
 *                 if schema_mismatches is None:
 */
            __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_preloaded_results, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2599; __pyx_clineno = __LINE__; goto __pyx_L8_error;};
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_v_local_result = __pyx_t_1;
            __pyx_t_1 = 0;

            /* "cassandra/cluster.py":2600
 *                 peers_result = preloaded_results[0]
 *                 local_result = preloaded_results[1]
 *                 schema_mismatches = self._get_schema_mismatches(peers_result, local_result, connection.host)             # <<<<<<<<<<<<<<
 *                 if schema_mismatches is None:
 *                     return True
 */
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_schema_mismatches); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2600; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_host); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2600; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_6 = NULL;
            __pyx_t_11 = 0;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
              if (likely(__pyx_t_6)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                __Pyx_INCREF(__pyx_t_6);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_4, function);
                __pyx_t_11 = 1;
              }
            }
            __pyx_t_12 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2600; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_12);
            if (__pyx_t_6) {
              __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_6); __pyx_t_6 = NULL;
            }
            __Pyx_INCREF(__pyx_v_peers_result);
            __Pyx_GIVEREF(__pyx_v_peers_result);
            PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_v_peers_result);
            __Pyx_INCREF(__pyx_v_local_result);
            __Pyx_GIVEREF(__pyx_v_local_result);
            PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_local_result);
            __Pyx_GIVEREF(__pyx_t_3);
            PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_t_3);
            __pyx_t_3 = 0;
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2600; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_v_schema_mismatches = __pyx_t_1;
            __pyx_t_1 = 0;

            /* "cassandra/cluster.py":2601
 *                 local_result = preloaded_results[1]
 *                 schema_mismatches = self._get_schema_mismatches(peers_result, local_result, connection.host)
 *                 if schema_mismatches is None:             # <<<<<<<<<<<<<<
 *                     return True
 * 
 */
            __pyx_t_10 = (__pyx_v_schema_mismatches == Py_None);
            __pyx_t_2 = (__pyx_t_10 != 0);
            if (__pyx_t_2) {

              /* "cassandra/cluster.py":2602
 *                 schema_mismatches = self._get_schema_mismatches(peers_result, local_result, connection.host)
 *                 if schema_mismatches is None:
 *                     return True             # <<<<<<<<<<<<<<
 * 
 *             log.debug("[control connection] Waiting for schema agreement")
 */
              __Pyx_XDECREF(__pyx_r);
              __Pyx_INCREF(Py_True);
              __pyx_r = Py_True;
              goto __pyx_L12_try_return;
            }
            goto __pyx_L18;
          }
          __pyx_L18:;

          /* "cassandra/cluster.py":2604
 *                     return True
 * 
 *             log.debug("[control connection] Waiting for schema agreement")             # <<<<<<<<<<<<<<
 *             start = self._time.time()
 *             elapsed = 0
 */
          __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__115, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "cassandra/cluster.py":2605
 * 
 *             log.debug("[control connection] Waiting for schema agreement")
 *             start = self._time.time()             # <<<<<<<<<<<<<<
 *             elapsed = 0
 *             cl = ConsistencyLevel.ONE
 */
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_time_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2605; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_time); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2605; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_12))) {
            __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_12);
            if (likely(__pyx_t_4)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_12, function);
            }
          }
          if (__pyx_t_4) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2605; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          } else {
            __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2605; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          }
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_v_start = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "cassandra/cluster.py":2606
 *             log.debug("[control connection] Waiting for schema agreement")
 *             start = self._time.time()
 *             elapsed = 0             # <<<<<<<<<<<<<<
 *             cl = ConsistencyLevel.ONE
 *             schema_mismatches = None
 */
          __Pyx_INCREF(__pyx_int_0);
          __pyx_v_elapsed = __pyx_int_0;

          /* "cassandra/cluster.py":2607
 *             start = self._time.time()
 *             elapsed = 0
 *             cl = ConsistencyLevel.ONE             # <<<<<<<<<<<<<<
 *             schema_mismatches = None
 *             while elapsed < total_timeout:
 */
          __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConsistencyLevel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2607; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ONE); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2607; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_v_cl = __pyx_t_12;
          __pyx_t_12 = 0;

          /* "cassandra/cluster.py":2608
 *             elapsed = 0
 *             cl = ConsistencyLevel.ONE
 *             schema_mismatches = None             # <<<<<<<<<<<<<<
 *             while elapsed < total_timeout:
 *                 peers_query = QueryMessage(query=self._SELECT_SCHEMA_PEERS, consistency_level=cl)
 */
          __Pyx_INCREF(Py_None);
          __Pyx_XDECREF_SET(__pyx_v_schema_mismatches, Py_None);

          /* "cassandra/cluster.py":2609
 *             cl = ConsistencyLevel.ONE
 *             schema_mismatches = None
 *             while elapsed < total_timeout:             # <<<<<<<<<<<<<<
 *                 peers_query = QueryMessage(query=self._SELECT_SCHEMA_PEERS, consistency_level=cl)
 *                 local_query = QueryMessage(query=self._SELECT_SCHEMA_LOCAL, consistency_level=cl)
 */
          while (1) {
            __pyx_t_12 = PyObject_RichCompare(__pyx_v_elapsed, __pyx_v_total_timeout, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2609; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2609; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            if (!__pyx_t_2) break;

            /* "cassandra/cluster.py":2610
 *             schema_mismatches = None
 *             while elapsed < total_timeout:
 *                 peers_query = QueryMessage(query=self._SELECT_SCHEMA_PEERS, consistency_level=cl)             # <<<<<<<<<<<<<<
 *                 local_query = QueryMessage(query=self._SELECT_SCHEMA_LOCAL, consistency_level=cl)
 *                 try:
 */
            __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_SCHEMA_PEERS); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_4);
            if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_query, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF_SET(__pyx_v_peers_query, __pyx_t_4);
            __pyx_t_4 = 0;

            /* "cassandra/cluster.py":2611
 *             while elapsed < total_timeout:
 *                 peers_query = QueryMessage(query=self._SELECT_SCHEMA_PEERS, consistency_level=cl)
 *                 local_query = QueryMessage(query=self._SELECT_SCHEMA_LOCAL, consistency_level=cl)             # <<<<<<<<<<<<<<
 *                 try:
 *                     timeout = min(self._timeout, total_timeout - elapsed)
 */
            __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2611; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2611; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SELECT_SCHEMA_LOCAL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2611; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_12);
            if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_query, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2611; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_consistency_level, __pyx_v_cl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2611; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2611; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF_SET(__pyx_v_local_query, __pyx_t_12);
            __pyx_t_12 = 0;

            /* "cassandra/cluster.py":2612
 *                 peers_query = QueryMessage(query=self._SELECT_SCHEMA_PEERS, consistency_level=cl)
 *                 local_query = QueryMessage(query=self._SELECT_SCHEMA_LOCAL, consistency_level=cl)
 *                 try:             # <<<<<<<<<<<<<<
 *                     timeout = min(self._timeout, total_timeout - elapsed)
 *                     peers_result, local_result = connection.wait_for_responses(
 */
            {
              __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
              __Pyx_XGOTREF(__pyx_t_13);
              __Pyx_XGOTREF(__pyx_t_14);
              __Pyx_XGOTREF(__pyx_t_15);
              /*try:*/ {

                /* "cassandra/cluster.py":2613
 *                 local_query = QueryMessage(query=self._SELECT_SCHEMA_LOCAL, consistency_level=cl)
 *                 try:
 *                     timeout = min(self._timeout, total_timeout - elapsed)             # <<<<<<<<<<<<<<
 *                     peers_result, local_result = connection.wait_for_responses(
 *                         peers_query, local_query, timeout=timeout)
 */
                __pyx_t_12 = PyNumber_Subtract(__pyx_v_total_timeout, __pyx_v_elapsed); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2613; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
                __Pyx_GOTREF(__pyx_t_12);
                __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2613; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
                __Pyx_GOTREF(__pyx_t_1);
                __pyx_t_3 = PyObject_RichCompare(__pyx_t_12, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2613; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
                __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2613; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                if (__pyx_t_2) {
                  __Pyx_INCREF(__pyx_t_12);
                  __pyx_t_4 = __pyx_t_12;
                } else {
                  __Pyx_INCREF(__pyx_t_1);
                  __pyx_t_4 = __pyx_t_1;
                }
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                __pyx_t_12 = __pyx_t_4;
                __Pyx_INCREF(__pyx_t_12);
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                __Pyx_XDECREF_SET(__pyx_v_timeout, __pyx_t_12);
                __pyx_t_12 = 0;

                /* "cassandra/cluster.py":2614
 *                 try:
 *                     timeout = min(self._timeout, total_timeout - elapsed)
 *                     peers_result, local_result = connection.wait_for_responses(             # <<<<<<<<<<<<<<
 *                         peers_query, local_query, timeout=timeout)
 *                 except OperationTimedOut as timeout:
 */
                __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_wait_for_responses); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2614; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
                __Pyx_GOTREF(__pyx_t_12);

                /* "cassandra/cluster.py":2615
 *                     timeout = min(self._timeout, total_timeout - elapsed)
 *                     peers_result, local_result = connection.wait_for_responses(
 *                         peers_query, local_query, timeout=timeout)             # <<<<<<<<<<<<<<
 *                 except OperationTimedOut as timeout:
 *                     log.debug("[control connection] Timed out waiting for "
 */
                __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2614; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
                __Pyx_GOTREF(__pyx_t_4);
                __Pyx_INCREF(__pyx_v_peers_query);
                __Pyx_GIVEREF(__pyx_v_peers_query);
                PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_peers_query);
                __Pyx_INCREF(__pyx_v_local_query);
                __Pyx_GIVEREF(__pyx_v_local_query);
                PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_local_query);

                /* "cassandra/cluster.py":2614
 *                 try:
 *                     timeout = min(self._timeout, total_timeout - elapsed)
 *                     peers_result, local_result = connection.wait_for_responses(             # <<<<<<<<<<<<<<
 *                         peers_query, local_query, timeout=timeout)
 *                 except OperationTimedOut as timeout:
 */
                __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2614; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
                __Pyx_GOTREF(__pyx_t_1);

                /* "cassandra/cluster.py":2615
 *                     timeout = min(self._timeout, total_timeout - elapsed)
 *                     peers_result, local_result = connection.wait_for_responses(
 *                         peers_query, local_query, timeout=timeout)             # <<<<<<<<<<<<<<
 *                 except OperationTimedOut as timeout:
 *                     log.debug("[control connection] Timed out waiting for "
 */
                if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_timeout, __pyx_v_timeout) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2614; __pyx_clineno = __LINE__; goto __pyx_L22_error;}

                /* "cassandra/cluster.py":2614
 *                 try:
 *                     timeout = min(self._timeout, total_timeout - elapsed)
 *                     peers_result, local_result = connection.wait_for_responses(             # <<<<<<<<<<<<<<
 *                         peers_query, local_query, timeout=timeout)
 *                 except OperationTimedOut as timeout:
 */
                __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2614; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
                  PyObject* sequence = __pyx_t_3;
                  #if CYTHON_COMPILING_IN_CPYTHON
                  Py_ssize_t size = Py_SIZE(sequence);
                  #else
                  Py_ssize_t size = PySequence_Size(sequence);
                  #endif
                  if (unlikely(size != 2)) {
                    if (size > 2) __Pyx_RaiseTooManyValuesError(2);
                    else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
                    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2614; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
                  }
                  #if CYTHON_COMPILING_IN_CPYTHON
                  if (likely(PyTuple_CheckExact(sequence))) {
                    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
                    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
                  } else {
                    __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
                    __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
                  }
                  __Pyx_INCREF(__pyx_t_1);
                  __Pyx_INCREF(__pyx_t_4);
                  #else
                  __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2614; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
                  __Pyx_GOTREF(__pyx_t_1);
                  __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2614; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
                  __Pyx_GOTREF(__pyx_t_4);
                  #endif
                  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                } else {
                  Py_ssize_t index = -1;
                  __pyx_t_12 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2614; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
                  __Pyx_GOTREF(__pyx_t_12);
                  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                  __pyx_t_16 = Py_TYPE(__pyx_t_12)->tp_iternext;
                  index = 0; __pyx_t_1 = __pyx_t_16(__pyx_t_12); if (unlikely(!__pyx_t_1)) goto __pyx_L30_unpacking_failed;
                  __Pyx_GOTREF(__pyx_t_1);
                  index = 1; __pyx_t_4 = __pyx_t_16(__pyx_t_12); if (unlikely(!__pyx_t_4)) goto __pyx_L30_unpacking_failed;
                  __Pyx_GOTREF(__pyx_t_4);
                  if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2614; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
                  __pyx_t_16 = NULL;
                  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                  goto __pyx_L31_unpacking_done;
                  __pyx_L30_unpacking_failed:;
                  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                  __pyx_t_16 = NULL;
                  if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2614; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
                  __pyx_L31_unpacking_done:;
                }
                __Pyx_XDECREF_SET(__pyx_v_peers_result, __pyx_t_1);
                __pyx_t_1 = 0;
                __Pyx_XDECREF_SET(__pyx_v_local_result, __pyx_t_4);
                __pyx_t_4 = 0;
              }
              __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
              goto __pyx_L29_try_end;
              __pyx_L22_error:;
              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

              /* "cassandra/cluster.py":2616
 *                     peers_result, local_result = connection.wait_for_responses(
 *                         peers_query, local_query, timeout=timeout)
 *                 except OperationTimedOut as timeout:             # <<<<<<<<<<<<<<
 *                     log.debug("[control connection] Timed out waiting for "
 *                               "response during schema agreement check: %s", timeout)
 */
              __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_OperationTimedOut); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2616; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_17 = PyErr_ExceptionMatches(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              if (__pyx_t_17) {
                __Pyx_AddTraceback("cassandra.cluster.ControlConnection.wait_for_schema_agreement", __pyx_clineno, __pyx_lineno, __pyx_filename);
                if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2616; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_GOTREF(__pyx_t_4);
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_XDECREF_SET(__pyx_v_timeout, __pyx_t_4);

                /* "cassandra/cluster.py":2617
 *                         peers_query, local_query, timeout=timeout)
 *                 except OperationTimedOut as timeout:
 *                     log.debug("[control connection] Timed out waiting for "             # <<<<<<<<<<<<<<
 *                               "response during schema agreement check: %s", timeout)
 *                     elapsed = self._time.time() - start
 */
                __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2617; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                __Pyx_GOTREF(__pyx_t_6);
                __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_debug); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2617; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                __Pyx_GOTREF(__pyx_t_18);
                __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

                /* "cassandra/cluster.py":2618
 *                 except OperationTimedOut as timeout:
 *                     log.debug("[control connection] Timed out waiting for "
 *                               "response during schema agreement check: %s", timeout)             # <<<<<<<<<<<<<<
 *                     elapsed = self._time.time() - start
 *                     continue
 */
                __pyx_t_6 = NULL;
                __pyx_t_11 = 0;
                if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_18))) {
                  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_18);
                  if (likely(__pyx_t_6)) {
                    PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
                    __Pyx_INCREF(__pyx_t_6);
                    __Pyx_INCREF(function);
                    __Pyx_DECREF_SET(__pyx_t_18, function);
                    __pyx_t_11 = 1;
                  }
                }
                __pyx_t_19 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2617; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                __Pyx_GOTREF(__pyx_t_19);
                if (__pyx_t_6) {
                  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_6); __pyx_t_6 = NULL;
                }
                __Pyx_INCREF(__pyx_kp_s_control_connection_Timed_out_wa);
                __Pyx_GIVEREF(__pyx_kp_s_control_connection_Timed_out_wa);
                PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_11, __pyx_kp_s_control_connection_Timed_out_wa);
                __Pyx_INCREF(__pyx_v_timeout);
                __Pyx_GIVEREF(__pyx_v_timeout);
                PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_11, __pyx_v_timeout);
                __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_19, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2617; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                __Pyx_GOTREF(__pyx_t_12);
                __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
                __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

                /* "cassandra/cluster.py":2619
 *                     log.debug("[control connection] Timed out waiting for "
 *                               "response during schema agreement check: %s", timeout)
 *                     elapsed = self._time.time() - start             # <<<<<<<<<<<<<<
 *                     continue
 *                 except ConnectionShutdown:
 */
                __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_time_2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                __Pyx_GOTREF(__pyx_t_18);
                __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_time); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                __Pyx_GOTREF(__pyx_t_19);
                __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
                __pyx_t_18 = NULL;
                if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_19))) {
                  __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_19);
                  if (likely(__pyx_t_18)) {
                    PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
                    __Pyx_INCREF(__pyx_t_18);
                    __Pyx_INCREF(function);
                    __Pyx_DECREF_SET(__pyx_t_19, function);
                  }
                }
                if (__pyx_t_18) {
                  __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_19, __pyx_t_18); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
                } else {
                  __pyx_t_12 = __Pyx_PyObject_CallNoArg(__pyx_t_19); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                }
                __Pyx_GOTREF(__pyx_t_12);
                __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
                __pyx_t_19 = PyNumber_Subtract(__pyx_t_12, __pyx_v_start); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                __Pyx_GOTREF(__pyx_t_19);
                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                __Pyx_DECREF_SET(__pyx_v_elapsed, __pyx_t_19);
                __pyx_t_19 = 0;

                /* "cassandra/cluster.py":2620
 *                               "response during schema agreement check: %s", timeout)
 *                     elapsed = self._time.time() - start
 *                     continue             # <<<<<<<<<<<<<<
 *                 except ConnectionShutdown:
 *                     if self._is_shutdown:
 */
                goto __pyx_L33_except_continue;
                __pyx_L33_except_continue:;
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                goto __pyx_L28_try_continue;
              }

              /* "cassandra/cluster.py":2621
 *                     elapsed = self._time.time() - start
 *                     continue
 *                 except ConnectionShutdown:             # <<<<<<<<<<<<<<
 *                     if self._is_shutdown:
 *                         log.debug("[control connection] Aborting wait for schema match due to shutdown")
 */
              __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConnectionShutdown); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_17 = PyErr_ExceptionMatches(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              if (__pyx_t_17) {
                __Pyx_AddTraceback("cassandra.cluster.ControlConnection.wait_for_schema_agreement", __pyx_clineno, __pyx_lineno, __pyx_filename);
                if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_GOTREF(__pyx_t_4);
                __Pyx_GOTREF(__pyx_t_3);

                /* "cassandra/cluster.py":2622
 *                     continue
 *                 except ConnectionShutdown:
 *                     if self._is_shutdown:             # <<<<<<<<<<<<<<
 *                         log.debug("[control connection] Aborting wait for schema match due to shutdown")
 *                         return None
 */
                __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown_2); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2622; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                __Pyx_GOTREF(__pyx_t_19);
                __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_19); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2622; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
                if (__pyx_t_2) {

                  /* "cassandra/cluster.py":2623
 *                 except ConnectionShutdown:
 *                     if self._is_shutdown:
 *                         log.debug("[control connection] Aborting wait for schema match due to shutdown")             # <<<<<<<<<<<<<<
 *                         return None
 *                     else:
 */
                  __pyx_t_19 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2623; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                  __Pyx_GOTREF(__pyx_t_19);
                  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_n_s_debug); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2623; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                  __Pyx_GOTREF(__pyx_t_12);
                  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
                  __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__116, NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2623; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                  __Pyx_GOTREF(__pyx_t_19);
                  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;

                  /* "cassandra/cluster.py":2624
 *                     if self._is_shutdown:
 *                         log.debug("[control connection] Aborting wait for schema match due to shutdown")
 *                         return None             # <<<<<<<<<<<<<<
 *                     else:
 *                         raise
 */
                  __Pyx_XDECREF(__pyx_r);
                  __Pyx_INCREF(Py_None);
                  __pyx_r = Py_None;
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                  goto __pyx_L25_except_return;
                }
                /*else*/ {

                  /* "cassandra/cluster.py":2626
 *                         return None
 *                     else:
 *                         raise             # <<<<<<<<<<<<<<
 * 
 *                 schema_mismatches = self._get_schema_mismatches(peers_result, local_result, connection.host)
 */
                  __Pyx_GIVEREF(__pyx_t_1);
                  __Pyx_GIVEREF(__pyx_t_4);
                  __Pyx_XGIVEREF(__pyx_t_3);
                  __Pyx_ErrRestore(__pyx_t_1, __pyx_t_4, __pyx_t_3);
                  __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; 
                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2626; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
                }
              }
              goto __pyx_L24_except_error;
              __pyx_L24_except_error:;
              __Pyx_XGIVEREF(__pyx_t_13);
              __Pyx_XGIVEREF(__pyx_t_14);
              __Pyx_XGIVEREF(__pyx_t_15);
              __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
              goto __pyx_L8_error;
              __pyx_L28_try_continue:;
              __Pyx_XGIVEREF(__pyx_t_13);
              __Pyx_XGIVEREF(__pyx_t_14);
              __Pyx_XGIVEREF(__pyx_t_15);
              __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
              goto __pyx_L20_continue;
              __pyx_L25_except_return:;
              __Pyx_XGIVEREF(__pyx_t_13);
              __Pyx_XGIVEREF(__pyx_t_14);
              __Pyx_XGIVEREF(__pyx_t_15);
              __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
              goto __pyx_L12_try_return;
              __pyx_L29_try_end:;
            }

            /* "cassandra/cluster.py":2628
 *                         raise
 * 
 *                 schema_mismatches = self._get_schema_mismatches(peers_result, local_result, connection.host)             # <<<<<<<<<<<<<<
 *                 if schema_mismatches is None:
 *                     return True
 */
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_schema_mismatches); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_19 = NULL;
            __pyx_t_11 = 0;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_4);
              if (likely(__pyx_t_19)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                __Pyx_INCREF(__pyx_t_19);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_4, function);
                __pyx_t_11 = 1;
              }
            }
            __pyx_t_12 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_12);
            if (__pyx_t_19) {
              __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_19); __pyx_t_19 = NULL;
            }
            __Pyx_INCREF(__pyx_v_peers_result);
            __Pyx_GIVEREF(__pyx_v_peers_result);
            PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_v_peers_result);
            __Pyx_INCREF(__pyx_v_local_result);
            __Pyx_GIVEREF(__pyx_v_local_result);
            PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_local_result);
            __Pyx_GIVEREF(__pyx_t_1);
            PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_t_1);
            __pyx_t_1 = 0;
            __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF_SET(__pyx_v_schema_mismatches, __pyx_t_3);
            __pyx_t_3 = 0;

            /* "cassandra/cluster.py":2629
 * 
 *                 schema_mismatches = self._get_schema_mismatches(peers_result, local_result, connection.host)
 *                 if schema_mismatches is None:             # <<<<<<<<<<<<<<
 *                     return True
 * 
 */
            __pyx_t_2 = (__pyx_v_schema_mismatches == Py_None);
            __pyx_t_10 = (__pyx_t_2 != 0);
            if (__pyx_t_10) {

              /* "cassandra/cluster.py":2630
 *                 schema_mismatches = self._get_schema_mismatches(peers_result, local_result, connection.host)
 *                 if schema_mismatches is None:
 *                     return True             # <<<<<<<<<<<<<<
 * 
 *                 log.debug("[control connection] Schemas mismatched, trying again")
 */
              __Pyx_XDECREF(__pyx_r);
              __Pyx_INCREF(Py_True);
              __pyx_r = Py_True;
              goto __pyx_L12_try_return;
            }

            /* "cassandra/cluster.py":2632
 *                     return True
 * 
 *                 log.debug("[control connection] Schemas mismatched, trying again")             # <<<<<<<<<<<<<<
 *                 self._time.sleep(0.2)
 *                 elapsed = self._time.time() - start
 */
            __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__117, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "cassandra/cluster.py":2633
 * 
 *                 log.debug("[control connection] Schemas mismatched, trying again")
 *                 self._time.sleep(0.2)             # <<<<<<<<<<<<<<
 *                 elapsed = self._time.time() - start
 * 
 */
            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_time_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sleep); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__118, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "cassandra/cluster.py":2634
 *                 log.debug("[control connection] Schemas mismatched, trying again")
 *                 self._time.sleep(0.2)
 *                 elapsed = self._time.time() - start             # <<<<<<<<<<<<<<
 * 
 *             log.warning("Node %s is reporting a schema disagreement: %s",
 */
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_time_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_time); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_4 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_12))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_12);
              if (likely(__pyx_t_4)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_12, function);
              }
            }
            if (__pyx_t_4) {
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            } else {
              __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            }
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __pyx_t_12 = PyNumber_Subtract(__pyx_t_3, __pyx_v_start); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF_SET(__pyx_v_elapsed, __pyx_t_12);
            __pyx_t_12 = 0;
            __pyx_L20_continue:;
          }

          /* "cassandra/cluster.py":2636
 *                 elapsed = self._time.time() - start
 * 
 *             log.warning("Node %s is reporting a schema disagreement: %s",             # <<<<<<<<<<<<<<
 *                         connection.host, schema_mismatches)
 *             return False
 */
          __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warning); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "cassandra/cluster.py":2637
 * 
 *             log.warning("Node %s is reporting a schema disagreement: %s",
 *                         connection.host, schema_mismatches)             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_host); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2637; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_1 = NULL;
          __pyx_t_11 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
            __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
            if (likely(__pyx_t_1)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_1);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_4, function);
              __pyx_t_11 = 1;
            }
          }
          __pyx_t_19 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_19);
          if (__pyx_t_1) {
            __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_1); __pyx_t_1 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_s_Node_s_is_reporting_a_schema_dis);
          __Pyx_GIVEREF(__pyx_kp_s_Node_s_is_reporting_a_schema_dis);
          PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_11, __pyx_kp_s_Node_s_is_reporting_a_schema_dis);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_11, __pyx_t_3);
          __Pyx_INCREF(__pyx_v_schema_mismatches);
          __Pyx_GIVEREF(__pyx_v_schema_mismatches);
          PyTuple_SET_ITEM(__pyx_t_19, 2+__pyx_t_11, __pyx_v_schema_mismatches);
          __pyx_t_3 = 0;
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_19, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "cassandra/cluster.py":2638
 *             log.warning("Node %s is reporting a schema disagreement: %s",
 *                         connection.host, schema_mismatches)
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     def _get_schema_mismatches(self, peers_result, local_result, local_address):
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(Py_False);
          __pyx_r = Py_False;
          goto __pyx_L12_try_return;
        }
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "cassandra/cluster.py":2588
 *         # a lock is just a simple way to cut down on the number of schema queries
 *         # we'll make.
 *         with self._schema_agreement_lock:             # <<<<<<<<<<<<<<
 *             if self._is_shutdown:
 *                 return
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.ControlConnection.wait_for_schema_agreement", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_4, &__pyx_t_19) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GOTREF(__pyx_t_19);
          __pyx_t_3 = PyTuple_Pack(3, __pyx_t_12, __pyx_t_4, __pyx_t_19); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __pyx_t_2 = ((!(__pyx_t_10 != 0)) != 0);
          if (__pyx_t_2) {
            __Pyx_GIVEREF(__pyx_t_12);
            __Pyx_GIVEREF(__pyx_t_4);
            __Pyx_XGIVEREF(__pyx_t_19);
            __Pyx_ErrRestore(__pyx_t_12, __pyx_t_4, __pyx_t_19);
            __pyx_t_12 = 0; __pyx_t_4 = 0; __pyx_t_19 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          }
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          goto __pyx_L9_exception_handled;
        }
        __pyx_L10_except_error:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L12_try_return:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L5_return;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_5) {
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__119, NULL);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L5_return: {
        __pyx_t_9 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_5) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__120, NULL);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __pyx_r = __pyx_t_9;
        __pyx_t_9 = 0;
        goto __pyx_L0;
      }
      __pyx_L7:;
    }
    goto __pyx_L41;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L1_error;
    __pyx_L41:;
  }

  /* "cassandra/cluster.py":2578
 *         self._cluster.scheduler.schedule_unique(delay, self.refresh_schema, keyspace, table, usertype, function, aggregate)
 * 
 *     def wait_for_schema_agreement(self, connection=None, preloaded_results=None, wait_time=None):             # <<<<<<<<<<<<<<
 * 
 *         total_timeout = wait_time if wait_time is not None else self._cluster.max_schema_agreement_wait
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.wait_for_schema_agreement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_total_timeout);
  __Pyx_XDECREF(__pyx_v_peers_result);
  __Pyx_XDECREF(__pyx_v_local_result);
  __Pyx_XDECREF(__pyx_v_schema_mismatches);
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_elapsed);
  __Pyx_XDECREF(__pyx_v_cl);
  __Pyx_XDECREF(__pyx_v_peers_query);
  __Pyx_XDECREF(__pyx_v_local_query);
  __Pyx_XDECREF(__pyx_v_timeout);
  __Pyx_XDECREF(__pyx_v_connection);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2640
 *             return False
 * 
 *     def _get_schema_mismatches(self, peers_result, local_result, local_address):             # <<<<<<<<<<<<<<
 *         peers_result = dict_factory(*peers_result.results)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_41_get_schema_mismatches(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_41_get_schema_mismatches = {"_get_schema_mismatches", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_41_get_schema_mismatches, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_41_get_schema_mismatches(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_peers_result = 0;
  PyObject *__pyx_v_local_result = 0;
  PyObject *__pyx_v_local_address = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_schema_mismatches (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_peers_result,&__pyx_n_s_local_result,&__pyx_n_s_local_address,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_peers_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_get_schema_mismatches", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_local_result)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_get_schema_mismatches", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_local_address)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_get_schema_mismatches", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_get_schema_mismatches") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_peers_result = values[1];
    __pyx_v_local_result = values[2];
    __pyx_v_local_address = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_schema_mismatches", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._get_schema_mismatches", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_40_get_schema_mismatches(__pyx_self, __pyx_v_self, __pyx_v_peers_result, __pyx_v_local_result, __pyx_v_local_address);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_9cassandra_7cluster_17ControlConnection_22_get_schema_mismatches_2generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "cassandra/cluster.py":2666
 *             return None
 * 
 *         return dict((version, list(nodes)) for version, nodes in six.iteritems(versions))             # <<<<<<<<<<<<<<
 * 
 *     def _signal_error(self):
 */

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_22_get_schema_mismatches_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_17_genexpr(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_17_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_9cassandra_7cluster_17ControlConnection_22_get_schema_mismatches_2generator6, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_ControlConnection__get_schema_mi); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._get_schema_mismatches.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_9cassandra_7cluster_17ControlConnection_22_get_schema_mismatches_2generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L8_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_six); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_iteritems); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_versions)) { __Pyx_RaiseClosureNameError("versions"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_versions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_versions);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_versions);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_versions);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_6(__pyx_t_3);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_version);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_version, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_nodes);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_nodes, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = PySequence_List(__pyx_cur_scope->__pyx_v_nodes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_version);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_version);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_version);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_XGIVEREF(__pyx_t_3);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_6;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L8_resume_from_yield:;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_3);
    __pyx_t_5 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_6 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "cassandra/cluster.py":2640
 *             return False
 * 
 *     def _get_schema_mismatches(self, peers_result, local_result, local_address):             # <<<<<<<<<<<<<<
 *         peers_result = dict_factory(*peers_result.results)
 * 
 */

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_40_get_schema_mismatches(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_peers_result, PyObject *__pyx_v_local_result, PyObject *__pyx_v_local_address) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches *__pyx_cur_scope;
  PyObject *__pyx_v_local_row = NULL;
  PyObject *__pyx_v_row = NULL;
  PyObject *__pyx_v_schema_ver = NULL;
  PyObject *__pyx_v_addr = NULL;
  PyObject *__pyx_v_peer = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_schema_mismatches", 0);
  __pyx_cur_scope = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches *)__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches(__pyx_ptype_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_INCREF(__pyx_v_peers_result);

  /* "cassandra/cluster.py":2641
 * 
 *     def _get_schema_mismatches(self, peers_result, local_result, local_address):
 *         peers_result = dict_factory(*peers_result.results)             # <<<<<<<<<<<<<<
 * 
 *         versions = defaultdict(set)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_peers_result, __pyx_n_s_results); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_peers_result, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2643
 *         peers_result = dict_factory(*peers_result.results)
 * 
 *         versions = defaultdict(set)             # <<<<<<<<<<<<<<
 *         if local_result.results:
 *             local_row = dict_factory(*local_result.results)[0]
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)((PyObject*)(&PySet_Type)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
    __Pyx_INCREF(((PyObject *)((PyObject*)(&PySet_Type))));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PySet_Type))));
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)((PyObject*)(&PySet_Type))));
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_cur_scope->__pyx_v_versions = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2644
 * 
 *         versions = defaultdict(set)
 *         if local_result.results:             # <<<<<<<<<<<<<<
 *             local_row = dict_factory(*local_result.results)[0]
 *             if local_row.get("schema_version"):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_local_result, __pyx_n_s_results); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":2645
 *         versions = defaultdict(set)
 *         if local_result.results:
 *             local_row = dict_factory(*local_result.results)[0]             # <<<<<<<<<<<<<<
 *             if local_row.get("schema_version"):
 *                 versions[local_row.get("schema_version")].add(local_address)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_dict_factory); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_local_result, __pyx_n_s_results); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_local_row = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2646
 *         if local_result.results:
 *             local_row = dict_factory(*local_result.results)[0]
 *             if local_row.get("schema_version"):             # <<<<<<<<<<<<<<
 *                 versions[local_row.get("schema_version")].add(local_address)
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_local_row, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__121, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_5) {

      /* "cassandra/cluster.py":2647
 *             local_row = dict_factory(*local_result.results)[0]
 *             if local_row.get("schema_version"):
 *                 versions[local_row.get("schema_version")].add(local_address)             # <<<<<<<<<<<<<<
 * 
 *         for row in peers_result:
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_local_row, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__122, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_versions, __pyx_t_2); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_add); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_4) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_local_address); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_local_address);
        __Pyx_GIVEREF(__pyx_v_local_address);
        PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_local_address);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":2649
 *                 versions[local_row.get("schema_version")].add(local_address)
 * 
 *         for row in peers_result:             # <<<<<<<<<<<<<<
 *             schema_ver = row.get('schema_version')
 *             if not schema_ver:
 */
  if (likely(PyList_CheckExact(__pyx_v_peers_result)) || PyTuple_CheckExact(__pyx_v_peers_result)) {
    __pyx_t_3 = __pyx_v_peers_result; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_peers_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_7(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2650
 * 
 *         for row in peers_result:
 *             schema_ver = row.get('schema_version')             # <<<<<<<<<<<<<<
 *             if not schema_ver:
 *                 continue
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__123, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_schema_ver, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2651
 *         for row in peers_result:
 *             schema_ver = row.get('schema_version')
 *             if not schema_ver:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_schema_ver); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = ((!__pyx_t_5) != 0);
    if (__pyx_t_8) {

      /* "cassandra/cluster.py":2652
 *             schema_ver = row.get('schema_version')
 *             if not schema_ver:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             addr = row.get("rpc_address")
 */
      goto __pyx_L5_continue;
    }

    /* "cassandra/cluster.py":2654
 *                 continue
 * 
 *             addr = row.get("rpc_address")             # <<<<<<<<<<<<<<
 *             if not addr or addr in ["0.0.0.0", "::"]:
 *                 addr = row.get("peer")
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__124, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_addr, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cassandra/cluster.py":2655
 * 
 *             addr = row.get("rpc_address")
 *             if not addr or addr in ["0.0.0.0", "::"]:             # <<<<<<<<<<<<<<
 *                 addr = row.get("peer")
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_addr); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = ((!__pyx_t_5) != 0);
    if (!__pyx_t_9) {
    } else {
      __pyx_t_8 = __pyx_t_9;
      goto __pyx_L9_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_v_addr);
    __pyx_t_2 = __pyx_v_addr;
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s_0_0_0_0, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_5) {
    } else {
      __pyx_t_9 = __pyx_t_5;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__101, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = __pyx_t_5;
    __pyx_L11_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = (__pyx_t_9 != 0);
    __pyx_t_8 = __pyx_t_5;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_8) {

      /* "cassandra/cluster.py":2656
 *             addr = row.get("rpc_address")
 *             if not addr or addr in ["0.0.0.0", "::"]:
 *                 addr = row.get("peer")             # <<<<<<<<<<<<<<
 * 
 *             peer = self._cluster.metadata.get_host(addr)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__125, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_addr, __pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "cassandra/cluster.py":2658
 *                 addr = row.get("peer")
 * 
 *             peer = self._cluster.metadata.get_host(addr)             # <<<<<<<<<<<<<<
 *             if peer and peer.is_up:
 *                 versions[schema_ver].add(addr)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_metadata); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_host); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_addr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_addr);
      __Pyx_GIVEREF(__pyx_v_addr);
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_addr);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_peer, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2659
 * 
 *             peer = self._cluster.metadata.get_host(addr)
 *             if peer and peer.is_up:             # <<<<<<<<<<<<<<
 *                 versions[schema_ver].add(addr)
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_peer); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {
    } else {
      __pyx_t_8 = __pyx_t_5;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_peer, __pyx_n_s_is_up); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __pyx_t_5;
    __pyx_L14_bool_binop_done:;
    if (__pyx_t_8) {

      /* "cassandra/cluster.py":2660
 *             peer = self._cluster.metadata.get_host(addr)
 *             if peer and peer.is_up:
 *                 versions[schema_ver].add(addr)             # <<<<<<<<<<<<<<
 * 
 *         if len(versions) == 1:
 */
      __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_versions, __pyx_v_schema_ver); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2660; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_add); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_addr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_INCREF(__pyx_v_addr);
        __Pyx_GIVEREF(__pyx_v_addr);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_addr);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "cassandra/cluster.py":2649
 *                 versions[local_row.get("schema_version")].add(local_address)
 * 
 *         for row in peers_result:             # <<<<<<<<<<<<<<
 *             schema_ver = row.get('schema_version')
 *             if not schema_ver:
 */
    __pyx_L5_continue:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":2662
 *                 versions[schema_ver].add(addr)
 * 
 *         if len(versions) == 1:             # <<<<<<<<<<<<<<
 *             log.debug("[control connection] Schemas match")
 *             return None
 */
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_versions;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_6 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = ((__pyx_t_6 == 1) != 0);
  if (__pyx_t_8) {

    /* "cassandra/cluster.py":2663
 * 
 *         if len(versions) == 1:
 *             log.debug("[control connection] Schemas match")             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__126, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cassandra/cluster.py":2664
 *         if len(versions) == 1:
 *             log.debug("[control connection] Schemas match")
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         return dict((version, list(nodes)) for version, nodes in six.iteritems(versions))
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2666
 *             return None
 * 
 *         return dict((version, list(nodes)) for version, nodes in six.iteritems(versions))             # <<<<<<<<<<<<<<
 * 
 *     def _signal_error(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_pf_9cassandra_7cluster_17ControlConnection_22_get_schema_mismatches_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":2640
 *             return False
 * 
 *     def _get_schema_mismatches(self, peers_result, local_result, local_address):             # <<<<<<<<<<<<<<
 *         peers_result = dict_factory(*peers_result.results)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._get_schema_mismatches", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_local_row);
  __Pyx_XDECREF(__pyx_v_row);
  __Pyx_XDECREF(__pyx_v_schema_ver);
  __Pyx_XDECREF(__pyx_v_addr);
  __Pyx_XDECREF(__pyx_v_peer);
  __Pyx_XDECREF(__pyx_v_peers_result);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2668
 *         return dict((version, list(nodes)) for version, nodes in six.iteritems(versions))
 * 
 *     def _signal_error(self):             # <<<<<<<<<<<<<<
 *         with self._lock:
 *             if self._is_shutdown:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_43_signal_error(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_43_signal_error = {"_signal_error", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_43_signal_error, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_43_signal_error(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_signal_error (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_42_signal_error(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_42_signal_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_signal_error", 0);

  /* "cassandra/cluster.py":2669
 * 
 *     def _signal_error(self):
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self._is_shutdown:
 *                 return
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cassandra/cluster.py":2670
 *     def _signal_error(self):
 *         with self._lock:
 *             if self._is_shutdown:             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2670; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2670; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_9) {

            /* "cassandra/cluster.py":2671
 *         with self._lock:
 *             if self._is_shutdown:
 *                 return             # <<<<<<<<<<<<<<
 * 
 *             # try just signaling the cluster, as this will trigger a reconnect
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            goto __pyx_L11_try_return;
          }

          /* "cassandra/cluster.py":2675
 *             # try just signaling the cluster, as this will trigger a reconnect
 *             # as part of marking the host down
 *             if self._connection and self._connection.is_defunct:             # <<<<<<<<<<<<<<
 *                 host = self._cluster.metadata.get_host(self._connection.host)
 *                 # host may be None if it's already been removed, but that indicates
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2675; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2675; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_10) {
          } else {
            __pyx_t_9 = __pyx_t_10;
            goto __pyx_L17_bool_binop_done;
          }
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2675; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_is_defunct); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2675; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2675; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_9 = __pyx_t_10;
          __pyx_L17_bool_binop_done:;
          if (__pyx_t_9) {

            /* "cassandra/cluster.py":2676
 *             # as part of marking the host down
 *             if self._connection and self._connection.is_defunct:
 *                 host = self._cluster.metadata.get_host(self._connection.host)             # <<<<<<<<<<<<<<
 *                 # host may be None if it's already been removed, but that indicates
 *                 # that errors have already been reported, so we're fine
 */
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2676; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_metadata); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2676; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2676; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2676; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_host); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2676; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_4 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
              if (likely(__pyx_t_4)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_1, function);
              }
            }
            if (!__pyx_t_4) {
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2676; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_GOTREF(__pyx_t_3);
            } else {
              __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2676; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4); __pyx_t_4 = NULL;
              __Pyx_GIVEREF(__pyx_t_5);
              PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_5);
              __pyx_t_5 = 0;
              __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2676; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_v_host = __pyx_t_3;
            __pyx_t_3 = 0;

            /* "cassandra/cluster.py":2679
 *                 # host may be None if it's already been removed, but that indicates
 *                 # that errors have already been reported, so we're fine
 *                 if host:             # <<<<<<<<<<<<<<
 *                     self._cluster.signal_connection_failure(
 *                         host, self._connection.last_error, is_host_addition=False)
 */
            __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_host); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2679; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            if (__pyx_t_9) {

              /* "cassandra/cluster.py":2680
 *                 # that errors have already been reported, so we're fine
 *                 if host:
 *                     self._cluster.signal_connection_failure(             # <<<<<<<<<<<<<<
 *                         host, self._connection.last_error, is_host_addition=False)
 *                     return
 */
              __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cluster_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_signal_connection_failure); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

              /* "cassandra/cluster.py":2681
 *                 if host:
 *                     self._cluster.signal_connection_failure(
 *                         host, self._connection.last_error, is_host_addition=False)             # <<<<<<<<<<<<<<
 *                     return
 * 
 */
              __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2681; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_last_error); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2681; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

              /* "cassandra/cluster.py":2680
 *                 # that errors have already been reported, so we're fine
 *                 if host:
 *                     self._cluster.signal_connection_failure(             # <<<<<<<<<<<<<<
 *                         host, self._connection.last_error, is_host_addition=False)
 *                     return
 */
              __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_INCREF(__pyx_v_host);
              __Pyx_GIVEREF(__pyx_v_host);
              PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_host);
              __Pyx_GIVEREF(__pyx_t_11);
              PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_11);
              __pyx_t_11 = 0;
              __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_11);

              /* "cassandra/cluster.py":2681
 *                 if host:
 *                     self._cluster.signal_connection_failure(
 *                         host, self._connection.last_error, is_host_addition=False)             # <<<<<<<<<<<<<<
 *                     return
 * 
 */
              if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_is_host_addition, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L7_error;}

              /* "cassandra/cluster.py":2680
 *                 # that errors have already been reported, so we're fine
 *                 if host:
 *                     self._cluster.signal_connection_failure(             # <<<<<<<<<<<<<<
 *                         host, self._connection.last_error, is_host_addition=False)
 *                     return
 */
              __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

              /* "cassandra/cluster.py":2682
 *                     self._cluster.signal_connection_failure(
 *                         host, self._connection.last_error, is_host_addition=False)
 *                     return             # <<<<<<<<<<<<<<
 * 
 *         # if the connection is not defunct or the host already left, reconnect
 */
              __Pyx_XDECREF(__pyx_r);
              __pyx_r = Py_None; __Pyx_INCREF(Py_None);
              goto __pyx_L11_try_return;
            }
            goto __pyx_L16;
          }
          __pyx_L16:;
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "cassandra/cluster.py":2669
 * 
 *     def _signal_error(self):
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self._is_shutdown:
 *                 return
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.ControlConnection._signal_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_11, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_1 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (__pyx_t_9 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_10 = ((!(__pyx_t_9 != 0)) != 0);
          if (__pyx_t_10) {
            __Pyx_GIVEREF(__pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_3);
            __Pyx_ErrRestore(__pyx_t_5, __pyx_t_11, __pyx_t_3);
            __pyx_t_5 = 0; __pyx_t_11 = 0; __pyx_t_3 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L4_return;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__127, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_8 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_2) {
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__128, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __pyx_r = __pyx_t_8;
        __pyx_t_8 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L23;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L23:;
  }

  /* "cassandra/cluster.py":2686
 *         # if the connection is not defunct or the host already left, reconnect
 *         # manually
 *         self.reconnect()             # <<<<<<<<<<<<<<
 * 
 *     def on_up(self, host):
 */
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnect_2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":2668
 *         return dict((version, list(nodes)) for version, nodes in six.iteritems(versions))
 * 
 *     def _signal_error(self):             # <<<<<<<<<<<<<<
 *         with self._lock:
 *             if self._is_shutdown:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection._signal_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2688
 *         self.reconnect()
 * 
 *     def on_up(self, host):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_45on_up(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_45on_up = {"on_up", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_45on_up, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_45on_up(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_up (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_up", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2688; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_up") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2688; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_up", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2688; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.on_up", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_44on_up(__pyx_self, __pyx_v_self, __pyx_v_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_44on_up(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_host) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_up", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2691
 *         pass
 * 
 *     def on_down(self, host):             # <<<<<<<<<<<<<<
 * 
 *         conn = self._connection
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_47on_down(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_47on_down = {"on_down", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_47on_down, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_47on_down(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_down (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_down", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2691; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_down") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2691; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_down", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2691; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.on_down", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_46on_down(__pyx_self, __pyx_v_self, __pyx_v_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_46on_down(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host) {
  PyObject *__pyx_v_conn = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_down", 0);

  /* "cassandra/cluster.py":2693
 *     def on_down(self, host):
 * 
 *         conn = self._connection             # <<<<<<<<<<<<<<
 *         if conn and conn.host == host.address and \
 *                 self._reconnection_handler is None:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_conn = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2694
 * 
 *         conn = self._connection
 *         if conn and conn.host == host.address and \             # <<<<<<<<<<<<<<
 *                 self._reconnection_handler is None:
 *             log.debug("[control connection] Control connection host (%s) is "
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_conn); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_conn, __pyx_n_s_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_address); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "cassandra/cluster.py":2695
 *         conn = self._connection
 *         if conn and conn.host == host.address and \
 *                 self._reconnection_handler is None:             # <<<<<<<<<<<<<<
 *             log.debug("[control connection] Control connection host (%s) is "
 *                       "considered down, starting reconnection", host)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnection_handler); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = (__pyx_t_5 == Py_None);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = (__pyx_t_3 != 0);
  __pyx_t_2 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":2696
 *         if conn and conn.host == host.address and \
 *                 self._reconnection_handler is None:
 *             log.debug("[control connection] Control connection host (%s) is "             # <<<<<<<<<<<<<<
 *                       "considered down, starting reconnection", host)
 *             # this will result in a task being submitted to the executor to reconnect
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2697
 *                 self._reconnection_handler is None:
 *             log.debug("[control connection] Control connection host (%s) is "
 *                       "considered down, starting reconnection", host)             # <<<<<<<<<<<<<<
 *             # this will result in a task being submitted to the executor to reconnect
 *             self.reconnect()
 */
    __pyx_t_4 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_7 = 1;
      }
    }
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_control_connection_Control_conn);
    __Pyx_GIVEREF(__pyx_kp_s_control_connection_Control_conn);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_s_control_connection_Control_conn);
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_host);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2699
 *                       "considered down, starting reconnection", host)
 *             # this will result in a task being submitted to the executor to reconnect
 *             self.reconnect()             # <<<<<<<<<<<<<<
 * 
 *     def on_add(self, host, refresh_nodes=True):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnect_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (__pyx_t_8) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else {
      __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":2691
 *         pass
 * 
 *     def on_down(self, host):             # <<<<<<<<<<<<<<
 * 
 *         conn = self._connection
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.on_down", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_conn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2701
 *             self.reconnect()
 * 
 *     def on_add(self, host, refresh_nodes=True):             # <<<<<<<<<<<<<<
 *         if refresh_nodes:
 *             self.refresh_node_list_and_token_map(force_token_rebuild=True)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_49on_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_49on_add = {"on_add", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_49on_add, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_49on_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_refresh_nodes = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_add (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,&__pyx_n_s_refresh_nodes,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_add", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_refresh_nodes);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
    __pyx_v_refresh_nodes = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_add", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.on_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_48on_add(__pyx_self, __pyx_v_self, __pyx_v_host, __pyx_v_refresh_nodes);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_48on_add(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_host, PyObject *__pyx_v_refresh_nodes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_add", 0);

  /* "cassandra/cluster.py":2702
 * 
 *     def on_add(self, host, refresh_nodes=True):
 *         if refresh_nodes:             # <<<<<<<<<<<<<<
 *             self.refresh_node_list_and_token_map(force_token_rebuild=True)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_refresh_nodes); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cassandra/cluster.py":2703
 *     def on_add(self, host, refresh_nodes=True):
 *         if refresh_nodes:
 *             self.refresh_node_list_and_token_map(force_token_rebuild=True)             # <<<<<<<<<<<<<<
 * 
 *     def on_remove(self, host):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_refresh_node_list_and_token_map); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_force_token_rebuild, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":2701
 *             self.reconnect()
 * 
 *     def on_add(self, host, refresh_nodes=True):             # <<<<<<<<<<<<<<
 *         if refresh_nodes:
 *             self.refresh_node_list_and_token_map(force_token_rebuild=True)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.on_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2705
 *             self.refresh_node_list_and_token_map(force_token_rebuild=True)
 * 
 *     def on_remove(self, host):             # <<<<<<<<<<<<<<
 *         self.refresh_node_list_and_token_map(force_token_rebuild=True)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_51on_remove(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_51on_remove = {"on_remove", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_51on_remove, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_51on_remove(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_host = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_remove (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_remove", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_remove") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_remove", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.on_remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_50on_remove(__pyx_self, __pyx_v_self, __pyx_v_host);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_50on_remove(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_host) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_remove", 0);

  /* "cassandra/cluster.py":2706
 * 
 *     def on_remove(self, host):
 *         self.refresh_node_list_and_token_map(force_token_rebuild=True)             # <<<<<<<<<<<<<<
 * 
 *     def get_connections(self):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_refresh_node_list_and_token_map); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_force_token_rebuild, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":2705
 *             self.refresh_node_list_and_token_map(force_token_rebuild=True)
 * 
 *     def on_remove(self, host):             # <<<<<<<<<<<<<<
 *         self.refresh_node_list_and_token_map(force_token_rebuild=True)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.on_remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2708
 *         self.refresh_node_list_and_token_map(force_token_rebuild=True)
 * 
 *     def get_connections(self):             # <<<<<<<<<<<<<<
 *         c = getattr(self, '_connection', None)
 *         return [c] if c else []
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_53get_connections(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_53get_connections = {"get_connections", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_53get_connections, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_53get_connections(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_connections (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_52get_connections(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_52get_connections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_c = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_connections", 0);

  /* "cassandra/cluster.py":2709
 * 
 *     def get_connections(self):
 *         c = getattr(self, '_connection', None)             # <<<<<<<<<<<<<<
 *         return [c] if c else []
 * 
 */
  __pyx_t_1 = __Pyx_GetAttr3(__pyx_v_self, __pyx_n_s_connection_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_c = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2710
 *     def get_connections(self):
 *         c = getattr(self, '_connection', None)
 *         return [c] if c else []             # <<<<<<<<<<<<<<
 * 
 *     def return_connection(self, connection):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_c); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_c);
    __Pyx_GIVEREF(__pyx_v_c);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_c);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":2708
 *         self.refresh_node_list_and_token_map(force_token_rebuild=True)
 * 
 *     def get_connections(self):             # <<<<<<<<<<<<<<
 *         c = getattr(self, '_connection', None)
 *         return [c] if c else []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.get_connections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2712
 *         return [c] if c else []
 * 
 *     def return_connection(self, connection):             # <<<<<<<<<<<<<<
 *         if connection is self._connection and (connection.is_defunct or connection.is_closed):
 *             self.reconnect()
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_55return_connection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_55return_connection = {"return_connection", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_55return_connection, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_55return_connection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_connection = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("return_connection (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_connection,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_connection)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("return_connection", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "return_connection") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_connection = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("return_connection", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.return_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_54return_connection(__pyx_self, __pyx_v_self, __pyx_v_connection);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_54return_connection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_connection) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("return_connection", 0);

  /* "cassandra/cluster.py":2713
 * 
 *     def return_connection(self, connection):
 *         if connection is self._connection and (connection.is_defunct or connection.is_closed):             # <<<<<<<<<<<<<<
 *             self.reconnect()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = (__pyx_v_connection == __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_is_defunct); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_is_closed); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cassandra/cluster.py":2714
 *     def return_connection(self, connection):
 *         if connection is self._connection and (connection.is_defunct or connection.is_closed):
 *             self.reconnect()             # <<<<<<<<<<<<<<
 * 
 *     def set_meta_refresh_enabled(self, enabled):
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reconnect_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":2712
 *         return [c] if c else []
 * 
 *     def return_connection(self, connection):             # <<<<<<<<<<<<<<
 *         if connection is self._connection and (connection.is_defunct or connection.is_closed):
 *             self.reconnect()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.return_connection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2716
 *             self.reconnect()
 * 
 *     def set_meta_refresh_enabled(self, enabled):             # <<<<<<<<<<<<<<
 *         self._meta_refresh_enabled = enabled
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_57set_meta_refresh_enabled(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_17ControlConnection_57set_meta_refresh_enabled = {"set_meta_refresh_enabled", (PyCFunction)__pyx_pw_9cassandra_7cluster_17ControlConnection_57set_meta_refresh_enabled, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_17ControlConnection_57set_meta_refresh_enabled(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_enabled = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_meta_refresh_enabled (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_enabled,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_enabled)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_meta_refresh_enabled", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_meta_refresh_enabled") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_enabled = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_meta_refresh_enabled", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.set_meta_refresh_enabled", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_17ControlConnection_56set_meta_refresh_enabled(__pyx_self, __pyx_v_self, __pyx_v_enabled);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_17ControlConnection_56set_meta_refresh_enabled(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_enabled) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_meta_refresh_enabled", 0);

  /* "cassandra/cluster.py":2717
 * 
 *     def set_meta_refresh_enabled(self, enabled):
 *         self._meta_refresh_enabled = enabled             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_meta_refresh_enabled, __pyx_v_enabled) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2716
 *             self.reconnect()
 * 
 *     def set_meta_refresh_enabled(self, enabled):             # <<<<<<<<<<<<<<
 *         self._meta_refresh_enabled = enabled
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cassandra.cluster.ControlConnection.set_meta_refresh_enabled", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2720
 * 
 * 
 * def _stop_scheduler(scheduler, thread):             # <<<<<<<<<<<<<<
 *     try:
 *         if not scheduler.is_shutdown:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_19_stop_scheduler(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_19_stop_scheduler = {"_stop_scheduler", (PyCFunction)__pyx_pw_9cassandra_7cluster_19_stop_scheduler, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_19_stop_scheduler(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_scheduler = 0;
  PyObject *__pyx_v_thread = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_stop_scheduler (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_scheduler,&__pyx_n_s_thread,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scheduler)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_thread)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_stop_scheduler", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_stop_scheduler") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_scheduler = values[0];
    __pyx_v_thread = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_stop_scheduler", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster._stop_scheduler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_18_stop_scheduler(__pyx_self, __pyx_v_scheduler, __pyx_v_thread);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_18_stop_scheduler(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_scheduler, PyObject *__pyx_v_thread) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_stop_scheduler", 0);

  /* "cassandra/cluster.py":2721
 * 
 * def _stop_scheduler(scheduler, thread):
 *     try:             # <<<<<<<<<<<<<<
 *         if not scheduler.is_shutdown:
 *             scheduler.shutdown()
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cassandra/cluster.py":2722
 * def _stop_scheduler(scheduler, thread):
 *     try:
 *         if not scheduler.is_shutdown:             # <<<<<<<<<<<<<<
 *             scheduler.shutdown()
 *     except ReferenceError:
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_scheduler, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2722; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2722; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = ((!__pyx_t_5) != 0);
      if (__pyx_t_6) {

        /* "cassandra/cluster.py":2723
 *     try:
 *         if not scheduler.is_shutdown:
 *             scheduler.shutdown()             # <<<<<<<<<<<<<<
 *     except ReferenceError:
 *         pass
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_scheduler, __pyx_n_s_shutdown); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        if (__pyx_t_8) {
          __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else {
          __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L11;
      }
      __pyx_L11:;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2724
 *         if not scheduler.is_shutdown:
 *             scheduler.shutdown()
 *     except ReferenceError:             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
    __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_ReferenceError);
    if (__pyx_t_9) {
      PyErr_Restore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "cassandra/cluster.py":2727
 *         pass
 * 
 *     thread.join()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_thread, __pyx_n_s_join); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (__pyx_t_8) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":2720
 * 
 * 
 * def _stop_scheduler(scheduler, thread):             # <<<<<<<<<<<<<<
 *     try:
 *         if not scheduler.is_shutdown:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cassandra.cluster._stop_scheduler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2737
 *     is_shutdown = False
 * 
 *     def __init__(self, executor):             # <<<<<<<<<<<<<<
 *         self._queue = Queue.PriorityQueue()
 *         self._scheduled_tasks = set()
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_10_Scheduler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_10_Scheduler_1__init__ = {"__init__", (PyCFunction)__pyx_pw_9cassandra_7cluster_10_Scheduler_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_10_Scheduler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_executor = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_executor,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_executor)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_executor = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster._Scheduler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_10_Scheduler___init__(__pyx_self, __pyx_v_self, __pyx_v_executor);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_10_Scheduler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_executor) {
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cassandra/cluster.py":2738
 * 
 *     def __init__(self, executor):
 *         self._queue = Queue.PriorityQueue()             # <<<<<<<<<<<<<<
 *         self._scheduled_tasks = set()
 *         self._executor = executor
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Queue); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_PriorityQueue); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_queue, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2739
 *     def __init__(self, executor):
 *         self._queue = Queue.PriorityQueue()
 *         self._scheduled_tasks = set()             # <<<<<<<<<<<<<<
 *         self._executor = executor
 * 
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_scheduled_tasks, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2740
 *         self._queue = Queue.PriorityQueue()
 *         self._scheduled_tasks = set()
 *         self._executor = executor             # <<<<<<<<<<<<<<
 * 
 *         t = Thread(target=self.run, name="Task Scheduler")
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_executor_2, __pyx_v_executor) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2742
 *         self._executor = executor
 * 
 *         t = Thread(target=self.run, name="Task Scheduler")             # <<<<<<<<<<<<<<
 *         t.daemon = True
 *         t.start()
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Thread); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_run); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_target, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_name, __pyx_kp_s_Task_Scheduler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_t = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2743
 * 
 *         t = Thread(target=self.run, name="Task Scheduler")
 *         t.daemon = True             # <<<<<<<<<<<<<<
 *         t.start()
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_t, __pyx_n_s_daemon, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2744
 *         t = Thread(target=self.run, name="Task Scheduler")
 *         t.daemon = True
 *         t.start()             # <<<<<<<<<<<<<<
 * 
 *         # although this runs on a daemonized thread, we prefer to stop
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2748
 *         # although this runs on a daemonized thread, we prefer to stop
 *         # it gracefully to avoid random errors during interpreter shutdown
 *         atexit.register(partial(_stop_scheduler, weakref.proxy(self), t))             # <<<<<<<<<<<<<<
 * 
 *     def shutdown(self):
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_atexit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_register); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_partial); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_stop_scheduler); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_weakref); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_proxy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_self); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_self);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_10 = 1;
    }
  }
  __pyx_t_9 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (__pyx_t_8) {
    __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_t_6);
  __Pyx_INCREF(__pyx_v_t);
  __Pyx_GIVEREF(__pyx_v_t);
  PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_10, __pyx_v_t);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2737
 *     is_shutdown = False
 * 
 *     def __init__(self, executor):             # <<<<<<<<<<<<<<
 *         self._queue = Queue.PriorityQueue()
 *         self._scheduled_tasks = set()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cassandra.cluster._Scheduler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2750
 *         atexit.register(partial(_stop_scheduler, weakref.proxy(self), t))
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         try:
 *             log.debug("Shutting down Cluster Scheduler")
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_10_Scheduler_3shutdown(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_10_Scheduler_3shutdown = {"shutdown", (PyCFunction)__pyx_pw_9cassandra_7cluster_10_Scheduler_3shutdown, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_10_Scheduler_3shutdown(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shutdown (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_10_Scheduler_2shutdown(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_10_Scheduler_2shutdown(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("shutdown", 0);

  /* "cassandra/cluster.py":2751
 * 
 *     def shutdown(self):
 *         try:             # <<<<<<<<<<<<<<
 *             log.debug("Shutting down Cluster Scheduler")
 *         except AttributeError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cassandra/cluster.py":2752
 *     def shutdown(self):
 *         try:
 *             log.debug("Shutting down Cluster Scheduler")             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             # this can happen on interpreter shutdown
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__129, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2753
 *         try:
 *             log.debug("Shutting down Cluster Scheduler")
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             # this can happen on interpreter shutdown
 *             pass
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_6) {
      PyErr_Restore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "cassandra/cluster.py":2756
 *             # this can happen on interpreter shutdown
 *             pass
 *         self.is_shutdown = True             # <<<<<<<<<<<<<<
 *         self._queue.put_nowait((0, None))
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2757
 *             pass
 *         self.is_shutdown = True
 *         self._queue.put_nowait((0, None))             # <<<<<<<<<<<<<<
 * 
 *     def schedule(self, delay, fn, *args):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_queue); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_put_nowait); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__131, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":2750
 *         atexit.register(partial(_stop_scheduler, weakref.proxy(self), t))
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         try:
 *             log.debug("Shutting down Cluster Scheduler")
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster._Scheduler.shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2759
 *         self._queue.put_nowait((0, None))
 * 
 *     def schedule(self, delay, fn, *args):             # <<<<<<<<<<<<<<
 *         self._insert_task(delay, (fn, args))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_10_Scheduler_5schedule(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_10_Scheduler_5schedule = {"schedule", (PyCFunction)__pyx_pw_9cassandra_7cluster_10_Scheduler_5schedule, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_10_Scheduler_5schedule(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_delay = 0;
  PyObject *__pyx_v_fn = 0;
  PyObject *__pyx_v_args = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("schedule (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 3) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 3, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_delay,&__pyx_n_s_fn,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_delay)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("schedule", 0, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("schedule", 0, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 3) ? pos_args : 3;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "schedule") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_delay = values[1];
    __pyx_v_fn = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("schedule", 0, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_AddTraceback("cassandra.cluster._Scheduler.schedule", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_10_Scheduler_4schedule(__pyx_self, __pyx_v_self, __pyx_v_delay, __pyx_v_fn, __pyx_v_args);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_10_Scheduler_4schedule(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_delay, PyObject *__pyx_v_fn, PyObject *__pyx_v_args) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("schedule", 0);

  /* "cassandra/cluster.py":2760
 * 
 *     def schedule(self, delay, fn, *args):
 *         self._insert_task(delay, (fn, args))             # <<<<<<<<<<<<<<
 * 
 *     def schedule_unique(self, delay, fn, *args):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_insert_task); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_fn);
  __Pyx_GIVEREF(__pyx_v_fn);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fn);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_v_delay);
  __Pyx_GIVEREF(__pyx_v_delay);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_delay);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2759
 *         self._queue.put_nowait((0, None))
 * 
 *     def schedule(self, delay, fn, *args):             # <<<<<<<<<<<<<<
 *         self._insert_task(delay, (fn, args))
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster._Scheduler.schedule", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2762
 *         self._insert_task(delay, (fn, args))
 * 
 *     def schedule_unique(self, delay, fn, *args):             # <<<<<<<<<<<<<<
 *         task = (fn, args)
 *         if task not in self._scheduled_tasks:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_10_Scheduler_7schedule_unique(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_10_Scheduler_7schedule_unique = {"schedule_unique", (PyCFunction)__pyx_pw_9cassandra_7cluster_10_Scheduler_7schedule_unique, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_10_Scheduler_7schedule_unique(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_delay = 0;
  PyObject *__pyx_v_fn = 0;
  PyObject *__pyx_v_args = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("schedule_unique (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 3) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 3, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_delay,&__pyx_n_s_fn,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_delay)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("schedule_unique", 0, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("schedule_unique", 0, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 3) ? pos_args : 3;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "schedule_unique") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_delay = values[1];
    __pyx_v_fn = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("schedule_unique", 0, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_AddTraceback("cassandra.cluster._Scheduler.schedule_unique", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_10_Scheduler_6schedule_unique(__pyx_self, __pyx_v_self, __pyx_v_delay, __pyx_v_fn, __pyx_v_args);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_10_Scheduler_6schedule_unique(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_delay, PyObject *__pyx_v_fn, PyObject *__pyx_v_args) {
  PyObject *__pyx_v_task = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("schedule_unique", 0);

  /* "cassandra/cluster.py":2763
 * 
 *     def schedule_unique(self, delay, fn, *args):
 *         task = (fn, args)             # <<<<<<<<<<<<<<
 *         if task not in self._scheduled_tasks:
 *             self._insert_task(delay, task)
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_fn);
  __Pyx_GIVEREF(__pyx_v_fn);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fn);
  __Pyx_INCREF(__pyx_v_args);
  __Pyx_GIVEREF(__pyx_v_args);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_args);
  __pyx_v_task = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2764
 *     def schedule_unique(self, delay, fn, *args):
 *         task = (fn, args)
 *         if task not in self._scheduled_tasks:             # <<<<<<<<<<<<<<
 *             self._insert_task(delay, task)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scheduled_tasks); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_task, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":2765
 *         task = (fn, args)
 *         if task not in self._scheduled_tasks:
 *             self._insert_task(delay, task)             # <<<<<<<<<<<<<<
 *         else:
 *             log.debug("Ignoring schedule_unique for already-scheduled task: %r", task)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_insert_task); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_delay);
    __Pyx_GIVEREF(__pyx_v_delay);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_delay);
    __Pyx_INCREF(__pyx_v_task);
    __Pyx_GIVEREF(__pyx_v_task);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_task);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cassandra/cluster.py":2767
 *             self._insert_task(delay, task)
 *         else:
 *             log.debug("Ignoring schedule_unique for already-scheduled task: %r", task)             # <<<<<<<<<<<<<<
 * 
 *     def _insert_task(self, delay, task):
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Ignoring_schedule_unique_for_alr);
    __Pyx_GIVEREF(__pyx_kp_s_Ignoring_schedule_unique_for_alr);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_kp_s_Ignoring_schedule_unique_for_alr);
    __Pyx_INCREF(__pyx_v_task);
    __Pyx_GIVEREF(__pyx_v_task);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_task);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":2762
 *         self._insert_task(delay, (fn, args))
 * 
 *     def schedule_unique(self, delay, fn, *args):             # <<<<<<<<<<<<<<
 *         task = (fn, args)
 *         if task not in self._scheduled_tasks:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster._Scheduler.schedule_unique", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_task);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2769
 *             log.debug("Ignoring schedule_unique for already-scheduled task: %r", task)
 * 
 *     def _insert_task(self, delay, task):             # <<<<<<<<<<<<<<
 *         if not self.is_shutdown:
 *             run_at = time.time() + delay
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_10_Scheduler_9_insert_task(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_10_Scheduler_9_insert_task = {"_insert_task", (PyCFunction)__pyx_pw_9cassandra_7cluster_10_Scheduler_9_insert_task, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_10_Scheduler_9_insert_task(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_delay = 0;
  PyObject *__pyx_v_task = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_insert_task (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_delay,&__pyx_n_s_task,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_delay)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_insert_task", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_task)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_insert_task", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_insert_task") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_delay = values[1];
    __pyx_v_task = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_insert_task", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster._Scheduler._insert_task", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_10_Scheduler_8_insert_task(__pyx_self, __pyx_v_self, __pyx_v_delay, __pyx_v_task);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_10_Scheduler_8_insert_task(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_delay, PyObject *__pyx_v_task) {
  PyObject *__pyx_v_run_at = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_insert_task", 0);

  /* "cassandra/cluster.py":2770
 * 
 *     def _insert_task(self, delay, task):
 *         if not self.is_shutdown:             # <<<<<<<<<<<<<<
 *             run_at = time.time() + delay
 *             self._scheduled_tasks.add(task)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":2771
 *     def _insert_task(self, delay, task):
 *         if not self.is_shutdown:
 *             run_at = time.time() + delay             # <<<<<<<<<<<<<<
 *             self._scheduled_tasks.add(task)
 *             self._queue.put_nowait((run_at, task))
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_time); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_v_delay); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_run_at = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2772
 *         if not self.is_shutdown:
 *             run_at = time.time() + delay
 *             self._scheduled_tasks.add(task)             # <<<<<<<<<<<<<<
 *             self._queue.put_nowait((run_at, task))
 *         else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scheduled_tasks); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_add); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_task); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_INCREF(__pyx_v_task);
      __Pyx_GIVEREF(__pyx_v_task);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_task);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2773
 *             run_at = time.time() + delay
 *             self._scheduled_tasks.add(task)
 *             self._queue.put_nowait((run_at, task))             # <<<<<<<<<<<<<<
 *         else:
 *             log.debug("Ignoring scheduled task after shutdown: %r", task)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_queue); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_put_nowait); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_run_at);
    __Pyx_GIVEREF(__pyx_v_run_at);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_run_at);
    __Pyx_INCREF(__pyx_v_task);
    __Pyx_GIVEREF(__pyx_v_task);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_task);
    __pyx_t_1 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cassandra/cluster.py":2775
 *             self._queue.put_nowait((run_at, task))
 *         else:
 *             log.debug("Ignoring scheduled task after shutdown: %r", task)             # <<<<<<<<<<<<<<
 * 
 *     def run(self):
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_8 = 1;
      }
    }
    __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Ignoring_scheduled_task_after_sh);
    __Pyx_GIVEREF(__pyx_kp_s_Ignoring_scheduled_task_after_sh);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_kp_s_Ignoring_scheduled_task_after_sh);
    __Pyx_INCREF(__pyx_v_task);
    __Pyx_GIVEREF(__pyx_v_task);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_v_task);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":2769
 *             log.debug("Ignoring schedule_unique for already-scheduled task: %r", task)
 * 
 *     def _insert_task(self, delay, task):             # <<<<<<<<<<<<<<
 *         if not self.is_shutdown:
 *             run_at = time.time() + delay
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster._Scheduler._insert_task", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_run_at);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2777
 *             log.debug("Ignoring scheduled task after shutdown: %r", task)
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         while True:
 *             if self.is_shutdown:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_10_Scheduler_11run(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_10_Scheduler_11run = {"run", (PyCFunction)__pyx_pw_9cassandra_7cluster_10_Scheduler_11run, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_10_Scheduler_11run(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("run (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_10_Scheduler_10run(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_10_Scheduler_10run(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_run_at = NULL;
  PyObject *__pyx_v_task = NULL;
  PyObject *__pyx_v_fn = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_future = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("run", 0);

  /* "cassandra/cluster.py":2778
 * 
 *     def run(self):
 *         while True:             # <<<<<<<<<<<<<<
 *             if self.is_shutdown:
 *                 return
 */
  while (1) {

    /* "cassandra/cluster.py":2779
 *     def run(self):
 *         while True:
 *             if self.is_shutdown:             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cassandra/cluster.py":2780
 *         while True:
 *             if self.is_shutdown:
 *                 return             # <<<<<<<<<<<<<<
 * 
 *             try:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
    }

    /* "cassandra/cluster.py":2782
 *                 return
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 while True:
 *                     run_at, task = self._queue.get(block=True, timeout=None)
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "cassandra/cluster.py":2783
 * 
 *             try:
 *                 while True:             # <<<<<<<<<<<<<<
 *                     run_at, task = self._queue.get(block=True, timeout=None)
 *                     if self.is_shutdown:
 */
        while (1) {

          /* "cassandra/cluster.py":2784
 *             try:
 *                 while True:
 *                     run_at, task = self._queue.get(block=True, timeout=None)             # <<<<<<<<<<<<<<
 *                     if self.is_shutdown:
 *                         log.debug("Not executing scheduled task due to Scheduler shutdown")
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_queue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_block, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_timeout, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
            PyObject* sequence = __pyx_t_7;
            #if CYTHON_COMPILING_IN_CPYTHON
            Py_ssize_t size = Py_SIZE(sequence);
            #else
            Py_ssize_t size = PySequence_Size(sequence);
            #endif
            if (unlikely(size != 2)) {
              if (size > 2) __Pyx_RaiseTooManyValuesError(2);
              else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            }
            #if CYTHON_COMPILING_IN_CPYTHON
            if (likely(PyTuple_CheckExact(sequence))) {
              __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
              __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
            } else {
              __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
              __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
            }
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_6);
            #else
            __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_6);
            #endif
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          } else {
            Py_ssize_t index = -1;
            __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
            index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L16_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_1);
            index = 1; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L16_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_6);
            if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __pyx_t_9 = NULL;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            goto __pyx_L17_unpacking_done;
            __pyx_L16_unpacking_failed:;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_9 = NULL;
            if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __pyx_L17_unpacking_done:;
          }
          __Pyx_XDECREF_SET(__pyx_v_run_at, __pyx_t_1);
          __pyx_t_1 = 0;
          __Pyx_XDECREF_SET(__pyx_v_task, __pyx_t_6);
          __pyx_t_6 = 0;

          /* "cassandra/cluster.py":2785
 *                 while True:
 *                     run_at, task = self._queue.get(block=True, timeout=None)
 *                     if self.is_shutdown:             # <<<<<<<<<<<<<<
 *                         log.debug("Not executing scheduled task due to Scheduler shutdown")
 *                         return
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (__pyx_t_2) {

            /* "cassandra/cluster.py":2786
 *                     run_at, task = self._queue.get(block=True, timeout=None)
 *                     if self.is_shutdown:
 *                         log.debug("Not executing scheduled task due to Scheduler shutdown")             # <<<<<<<<<<<<<<
 *                         return
 *                     if run_at <= time.time():
 */
            __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2786; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2786; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__132, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2786; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

            /* "cassandra/cluster.py":2787
 *                     if self.is_shutdown:
 *                         log.debug("Not executing scheduled task due to Scheduler shutdown")
 *                         return             # <<<<<<<<<<<<<<
 *                     if run_at <= time.time():
 *                         self._scheduled_tasks.remove(task)
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            goto __pyx_L10_try_return;
          }

          /* "cassandra/cluster.py":2788
 *                         log.debug("Not executing scheduled task due to Scheduler shutdown")
 *                         return
 *                     if run_at <= time.time():             # <<<<<<<<<<<<<<
 *                         self._scheduled_tasks.remove(task)
 *                         fn, args = task
 */
          __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2788; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_time); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2788; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
            __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
            if (likely(__pyx_t_6)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_6);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_1, function);
            }
          }
          if (__pyx_t_6) {
            __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2788; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          } else {
            __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2788; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          }
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyObject_RichCompare(__pyx_v_run_at, __pyx_t_7, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2788; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2788; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_2) {

            /* "cassandra/cluster.py":2789
 *                         return
 *                     if run_at <= time.time():
 *                         self._scheduled_tasks.remove(task)             # <<<<<<<<<<<<<<
 *                         fn, args = task
 *                         future = self._executor.submit(fn, *args)
 */
            __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scheduled_tasks); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_remove); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_7 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
              __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
              if (likely(__pyx_t_7)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
                __Pyx_INCREF(__pyx_t_7);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_6, function);
              }
            }
            if (!__pyx_t_7) {
              __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_task); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_GOTREF(__pyx_t_1);
            } else {
              __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
              __Pyx_INCREF(__pyx_v_task);
              __Pyx_GIVEREF(__pyx_v_task);
              PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_task);
              __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            }
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "cassandra/cluster.py":2790
 *                     if run_at <= time.time():
 *                         self._scheduled_tasks.remove(task)
 *                         fn, args = task             # <<<<<<<<<<<<<<
 *                         future = self._executor.submit(fn, *args)
 *                         future.add_done_callback(self._log_if_failed)
 */
            if ((likely(PyTuple_CheckExact(__pyx_v_task))) || (PyList_CheckExact(__pyx_v_task))) {
              PyObject* sequence = __pyx_v_task;
              #if CYTHON_COMPILING_IN_CPYTHON
              Py_ssize_t size = Py_SIZE(sequence);
              #else
              Py_ssize_t size = PySequence_Size(sequence);
              #endif
              if (unlikely(size != 2)) {
                if (size > 2) __Pyx_RaiseTooManyValuesError(2);
                else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2790; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              }
              #if CYTHON_COMPILING_IN_CPYTHON
              if (likely(PyTuple_CheckExact(sequence))) {
                __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
                __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
              } else {
                __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
                __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
              }
              __Pyx_INCREF(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_6);
              #else
              __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2790; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2790; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_GOTREF(__pyx_t_6);
              #endif
            } else {
              Py_ssize_t index = -1;
              __pyx_t_8 = PyObject_GetIter(__pyx_v_task); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2790; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
              index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L20_unpacking_failed;
              __Pyx_GOTREF(__pyx_t_1);
              index = 1; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L20_unpacking_failed;
              __Pyx_GOTREF(__pyx_t_6);
              if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2790; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __pyx_t_9 = NULL;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              goto __pyx_L21_unpacking_done;
              __pyx_L20_unpacking_failed:;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __pyx_t_9 = NULL;
              if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2790; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __pyx_L21_unpacking_done:;
            }
            __Pyx_XDECREF_SET(__pyx_v_fn, __pyx_t_1);
            __pyx_t_1 = 0;
            __Pyx_XDECREF_SET(__pyx_v_args, __pyx_t_6);
            __pyx_t_6 = 0;

            /* "cassandra/cluster.py":2791
 *                         self._scheduled_tasks.remove(task)
 *                         fn, args = task
 *                         future = self._executor.submit(fn, *args)             # <<<<<<<<<<<<<<
 *                         future.add_done_callback(self._log_if_failed)
 *                     else:
 */
            __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_executor_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_submit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_INCREF(__pyx_v_fn);
            __Pyx_GIVEREF(__pyx_v_fn);
            PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fn);
            __pyx_t_8 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_7 = PyNumber_Add(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_XDECREF_SET(__pyx_v_future, __pyx_t_8);
            __pyx_t_8 = 0;

            /* "cassandra/cluster.py":2792
 *                         fn, args = task
 *                         future = self._executor.submit(fn, *args)
 *                         future.add_done_callback(self._log_if_failed)             # <<<<<<<<<<<<<<
 *                     else:
 *                         self._queue.put_nowait((run_at, task))
 */
            __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_add_done_callback); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2792; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_if_failed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2792; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_6 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
              __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
              if (likely(__pyx_t_6)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
                __Pyx_INCREF(__pyx_t_6);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_7, function);
              }
            }
            if (!__pyx_t_6) {
              __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2792; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_GOTREF(__pyx_t_8);
            } else {
              __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2792; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
              __Pyx_GIVEREF(__pyx_t_1);
              PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_1);
              __pyx_t_1 = 0;
              __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2792; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            goto __pyx_L19;
          }
          /*else*/ {

            /* "cassandra/cluster.py":2794
 *                         future.add_done_callback(self._log_if_failed)
 *                     else:
 *                         self._queue.put_nowait((run_at, task))             # <<<<<<<<<<<<<<
 *                         break
 *             except Queue.Empty:
 */
            __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_queue); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_put_nowait); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_INCREF(__pyx_v_run_at);
            __Pyx_GIVEREF(__pyx_v_run_at);
            PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_run_at);
            __Pyx_INCREF(__pyx_v_task);
            __Pyx_GIVEREF(__pyx_v_task);
            PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_task);
            __pyx_t_1 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_10))) {
              __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
              if (likely(__pyx_t_1)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
                __Pyx_INCREF(__pyx_t_1);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_10, function);
              }
            }
            if (!__pyx_t_1) {
              __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              __Pyx_GOTREF(__pyx_t_8);
            } else {
              __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
              __Pyx_GIVEREF(__pyx_t_7);
              PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_7);
              __pyx_t_7 = 0;
              __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            }
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "cassandra/cluster.py":2795
 *                     else:
 *                         self._queue.put_nowait((run_at, task))
 *                         break             # <<<<<<<<<<<<<<
 *             except Queue.Empty:
 *                 pass
 */
            goto __pyx_L15_break;
          }
          __pyx_L19:;
        }
        __pyx_L15_break:;
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L13_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "cassandra/cluster.py":2796
 *                         self._queue.put_nowait((run_at, task))
 *                         break
 *             except Queue.Empty:             # <<<<<<<<<<<<<<
 *                 pass
 * 
 */
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_Queue); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_Empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_11 = PyErr_ExceptionMatches(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (__pyx_t_11) {
        PyErr_Restore(0,0,0);
        goto __pyx_L7_exception_handled;
      }
      goto __pyx_L8_except_error;
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L1_error;
      __pyx_L10_try_return:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L0;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L13_try_end:;
    }

    /* "cassandra/cluster.py":2799
 *                 pass
 * 
 *             time.sleep(0.1)             # <<<<<<<<<<<<<<
 * 
 *     def _log_if_failed(self, future):
 */
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_sleep); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__133, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }

  /* "cassandra/cluster.py":2777
 *             log.debug("Ignoring scheduled task after shutdown: %r", task)
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         while True:
 *             if self.is_shutdown:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cassandra.cluster._Scheduler.run", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_run_at);
  __Pyx_XDECREF(__pyx_v_task);
  __Pyx_XDECREF(__pyx_v_fn);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_future);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2801
 *             time.sleep(0.1)
 * 
 *     def _log_if_failed(self, future):             # <<<<<<<<<<<<<<
 *         exc = future.exception()
 *         if exc:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_10_Scheduler_13_log_if_failed(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_10_Scheduler_13_log_if_failed = {"_log_if_failed", (PyCFunction)__pyx_pw_9cassandra_7cluster_10_Scheduler_13_log_if_failed, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_10_Scheduler_13_log_if_failed(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_future = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_log_if_failed (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_future,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_future)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_log_if_failed", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_log_if_failed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_future = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_log_if_failed", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster._Scheduler._log_if_failed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_10_Scheduler_12_log_if_failed(__pyx_self, __pyx_v_self, __pyx_v_future);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_10_Scheduler_12_log_if_failed(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_future) {
  PyObject *__pyx_v_exc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_log_if_failed", 0);

  /* "cassandra/cluster.py":2802
 * 
 *     def _log_if_failed(self, future):
 *         exc = future.exception()             # <<<<<<<<<<<<<<
 *         if exc:
 *             log.warning(
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_future, __pyx_n_s_exception); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_exc = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2803
 *     def _log_if_failed(self, future):
 *         exc = future.exception()
 *         if exc:             # <<<<<<<<<<<<<<
 *             log.warning(
 *                 "An internally scheduled tasked failed with an unhandled exception:",
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_exc); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "cassandra/cluster.py":2804
 *         exc = future.exception()
 *         if exc:
 *             log.warning(             # <<<<<<<<<<<<<<
 *                 "An internally scheduled tasked failed with an unhandled exception:",
 *                 exc_info=exc)
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_warning); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "cassandra/cluster.py":2806
 *             log.warning(
 *                 "An internally scheduled tasked failed with an unhandled exception:",
 *                 exc_info=exc)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_exc_info, __pyx_v_exc) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "cassandra/cluster.py":2804
 *         exc = future.exception()
 *         if exc:
 *             log.warning(             # <<<<<<<<<<<<<<
 *                 "An internally scheduled tasked failed with an unhandled exception:",
 *                 exc_info=exc)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__134, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":2801
 *             time.sleep(0.1)
 * 
 *     def _log_if_failed(self, future):             # <<<<<<<<<<<<<<
 *         exc = future.exception()
 *         if exc:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cassandra.cluster._Scheduler._log_if_failed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2809
 * 
 * 
 * def refresh_schema_and_set_result(keyspace, table, usertype, function, aggregate, control_conn, response_future):             # <<<<<<<<<<<<<<
 *     try:
 *         if control_conn._meta_refresh_enabled:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_21refresh_schema_and_set_result(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_21refresh_schema_and_set_result = {"refresh_schema_and_set_result", (PyCFunction)__pyx_pw_9cassandra_7cluster_21refresh_schema_and_set_result, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_21refresh_schema_and_set_result(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_keyspace = 0;
  PyObject *__pyx_v_table = 0;
  PyObject *__pyx_v_usertype = 0;
  PyObject *__pyx_v_function = 0;
  PyObject *__pyx_v_aggregate = 0;
  PyObject *__pyx_v_control_conn = 0;
  PyObject *__pyx_v_response_future = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refresh_schema_and_set_result (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_keyspace,&__pyx_n_s_table,&__pyx_n_s_usertype,&__pyx_n_s_function,&__pyx_n_s_aggregate,&__pyx_n_s_control_conn,&__pyx_n_s_response_future,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_keyspace)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_table)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_schema_and_set_result", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_usertype)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_schema_and_set_result", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_function)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_schema_and_set_result", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_aggregate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_schema_and_set_result", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_control_conn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_schema_and_set_result", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_response_future)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refresh_schema_and_set_result", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "refresh_schema_and_set_result") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_keyspace = values[0];
    __pyx_v_table = values[1];
    __pyx_v_usertype = values[2];
    __pyx_v_function = values[3];
    __pyx_v_aggregate = values[4];
    __pyx_v_control_conn = values[5];
    __pyx_v_response_future = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("refresh_schema_and_set_result", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.refresh_schema_and_set_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_20refresh_schema_and_set_result(__pyx_self, __pyx_v_keyspace, __pyx_v_table, __pyx_v_usertype, __pyx_v_function, __pyx_v_aggregate, __pyx_v_control_conn, __pyx_v_response_future);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_20refresh_schema_and_set_result(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_keyspace, PyObject *__pyx_v_table, PyObject *__pyx_v_usertype, PyObject *__pyx_v_function, PyObject *__pyx_v_aggregate, PyObject *__pyx_v_control_conn, PyObject *__pyx_v_response_future) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  char const *__pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("refresh_schema_and_set_result", 0);

  /* "cassandra/cluster.py":2810
 * 
 * def refresh_schema_and_set_result(keyspace, table, usertype, function, aggregate, control_conn, response_future):
 *     try:             # <<<<<<<<<<<<<<
 *         if control_conn._meta_refresh_enabled:
 *             log.debug("Refreshing schema in response to schema change. "
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      /*try:*/ {

        /* "cassandra/cluster.py":2811
 * def refresh_schema_and_set_result(keyspace, table, usertype, function, aggregate, control_conn, response_future):
 *     try:
 *         if control_conn._meta_refresh_enabled:             # <<<<<<<<<<<<<<
 *             log.debug("Refreshing schema in response to schema change. "
 *                       "Keyspace: %s; Table: %s, Type: %s, Function: %s, Aggregate: %s",
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_control_conn, __pyx_n_s_meta_refresh_enabled); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2811; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2811; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_5) {

          /* "cassandra/cluster.py":2812
 *     try:
 *         if control_conn._meta_refresh_enabled:
 *             log.debug("Refreshing schema in response to schema change. "             # <<<<<<<<<<<<<<
 *                       "Keyspace: %s; Table: %s, Type: %s, Function: %s, Aggregate: %s",
 *                       keyspace, table, usertype, function, aggregate)
 */
          __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2812; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2812; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

          /* "cassandra/cluster.py":2814
 *             log.debug("Refreshing schema in response to schema change. "
 *                       "Keyspace: %s; Table: %s, Type: %s, Function: %s, Aggregate: %s",
 *                       keyspace, table, usertype, function, aggregate)             # <<<<<<<<<<<<<<
 *             control_conn._refresh_schema(response_future._connection, keyspace, table, usertype, function, aggregate)
 *         else:
 */
          __pyx_t_6 = NULL;
          __pyx_t_8 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_6)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_6);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
              __pyx_t_8 = 1;
            }
          }
          __pyx_t_9 = PyTuple_New(6+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2812; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_9);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_s_Refreshing_schema_in_response_to);
          __Pyx_GIVEREF(__pyx_kp_s_Refreshing_schema_in_response_to);
          PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_kp_s_Refreshing_schema_in_response_to);
          __Pyx_INCREF(__pyx_v_keyspace);
          __Pyx_GIVEREF(__pyx_v_keyspace);
          PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_keyspace);
          __Pyx_INCREF(__pyx_v_table);
          __Pyx_GIVEREF(__pyx_v_table);
          PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_table);
          __Pyx_INCREF(__pyx_v_usertype);
          __Pyx_GIVEREF(__pyx_v_usertype);
          PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_v_usertype);
          __Pyx_INCREF(__pyx_v_function);
          __Pyx_GIVEREF(__pyx_v_function);
          PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_8, __pyx_v_function);
          __Pyx_INCREF(__pyx_v_aggregate);
          __Pyx_GIVEREF(__pyx_v_aggregate);
          PyTuple_SET_ITEM(__pyx_t_9, 5+__pyx_t_8, __pyx_v_aggregate);
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2812; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "cassandra/cluster.py":2815
 *                       "Keyspace: %s; Table: %s, Type: %s, Function: %s, Aggregate: %s",
 *                       keyspace, table, usertype, function, aggregate)
 *             control_conn._refresh_schema(response_future._connection, keyspace, table, usertype, function, aggregate)             # <<<<<<<<<<<<<<
 *         else:
 *             log.debug("Skipping schema refresh in response to schema change because meta refresh is disabled; "
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_control_conn, __pyx_n_s_refresh_schema_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_response_future, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_6 = NULL;
          __pyx_t_8 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_6)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_6);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
              __pyx_t_8 = 1;
            }
          }
          __pyx_t_10 = PyTuple_New(6+__pyx_t_8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_10);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_t_9);
          __Pyx_INCREF(__pyx_v_keyspace);
          __Pyx_GIVEREF(__pyx_v_keyspace);
          PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, __pyx_v_keyspace);
          __Pyx_INCREF(__pyx_v_table);
          __Pyx_GIVEREF(__pyx_v_table);
          PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_8, __pyx_v_table);
          __Pyx_INCREF(__pyx_v_usertype);
          __Pyx_GIVEREF(__pyx_v_usertype);
          PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_8, __pyx_v_usertype);
          __Pyx_INCREF(__pyx_v_function);
          __Pyx_GIVEREF(__pyx_v_function);
          PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_8, __pyx_v_function);
          __Pyx_INCREF(__pyx_v_aggregate);
          __Pyx_GIVEREF(__pyx_v_aggregate);
          PyTuple_SET_ITEM(__pyx_t_10, 5+__pyx_t_8, __pyx_v_aggregate);
          __pyx_t_9 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L14;
        }
        /*else*/ {

          /* "cassandra/cluster.py":2817
 *             control_conn._refresh_schema(response_future._connection, keyspace, table, usertype, function, aggregate)
 *         else:
 *             log.debug("Skipping schema refresh in response to schema change because meta refresh is disabled; "             # <<<<<<<<<<<<<<
 *                       "Keyspace: %s; Table: %s, Type: %s, Function: %s", keyspace, table, usertype, function, aggregate)
 *     except Exception:
 */
          __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_debug); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "cassandra/cluster.py":2818
 *         else:
 *             log.debug("Skipping schema refresh in response to schema change because meta refresh is disabled; "
 *                       "Keyspace: %s; Table: %s, Type: %s, Function: %s", keyspace, table, usertype, function, aggregate)             # <<<<<<<<<<<<<<
 *     except Exception:
 *         log.exception("Exception refreshing schema in response to schema change:")
 */
          __pyx_t_7 = NULL;
          __pyx_t_8 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_10))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_10);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_10, function);
              __pyx_t_8 = 1;
            }
          }
          __pyx_t_9 = PyTuple_New(6+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_9);
          if (__pyx_t_7) {
            __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_s_Skipping_schema_refresh_in_respo);
          __Pyx_GIVEREF(__pyx_kp_s_Skipping_schema_refresh_in_respo);
          PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_kp_s_Skipping_schema_refresh_in_respo);
          __Pyx_INCREF(__pyx_v_keyspace);
          __Pyx_GIVEREF(__pyx_v_keyspace);
          PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_keyspace);
          __Pyx_INCREF(__pyx_v_table);
          __Pyx_GIVEREF(__pyx_v_table);
          PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_table);
          __Pyx_INCREF(__pyx_v_usertype);
          __Pyx_GIVEREF(__pyx_v_usertype);
          PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_v_usertype);
          __Pyx_INCREF(__pyx_v_function);
          __Pyx_GIVEREF(__pyx_v_function);
          PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_8, __pyx_v_function);
          __Pyx_INCREF(__pyx_v_aggregate);
          __Pyx_GIVEREF(__pyx_v_aggregate);
          PyTuple_SET_ITEM(__pyx_t_9, 5+__pyx_t_8, __pyx_v_aggregate);
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_L14:;
      }
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L13_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cassandra/cluster.py":2819
 *             log.debug("Skipping schema refresh in response to schema change because meta refresh is disabled; "
 *                       "Keyspace: %s; Table: %s, Type: %s, Function: %s", keyspace, table, usertype, function, aggregate)
 *     except Exception:             # <<<<<<<<<<<<<<
 *         log.exception("Exception refreshing schema in response to schema change:")
 *         response_future.session.submit(
 */
      __pyx_t_11 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
      if (__pyx_t_11) {
        __Pyx_AddTraceback("cassandra.cluster.refresh_schema_and_set_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_10, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2819; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GOTREF(__pyx_t_9);

        /* "cassandra/cluster.py":2820
 *                       "Keyspace: %s; Table: %s, Type: %s, Function: %s", keyspace, table, usertype, function, aggregate)
 *     except Exception:
 *         log.exception("Exception refreshing schema in response to schema change:")             # <<<<<<<<<<<<<<
 *         response_future.session.submit(
 *             control_conn.refresh_schema, keyspace, table, usertype, function, aggregate)
 */
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_exception); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__135, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "cassandra/cluster.py":2821
 *     except Exception:
 *         log.exception("Exception refreshing schema in response to schema change:")
 *         response_future.session.submit(             # <<<<<<<<<<<<<<
 *             control_conn.refresh_schema, keyspace, table, usertype, function, aggregate)
 *     finally:
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_response_future, __pyx_n_s_session); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2821; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_submit); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2821; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "cassandra/cluster.py":2822
 *         log.exception("Exception refreshing schema in response to schema change:")
 *         response_future.session.submit(
 *             control_conn.refresh_schema, keyspace, table, usertype, function, aggregate)             # <<<<<<<<<<<<<<
 *     finally:
 *         response_future._set_final_result(None)
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_control_conn, __pyx_n_s_refresh_schema); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_13 = NULL;
        __pyx_t_8 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
            __pyx_t_8 = 1;
          }
        }
        __pyx_t_14 = PyTuple_New(6+__pyx_t_8); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2821; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        if (__pyx_t_13) {
          __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_8, __pyx_t_6);
        __Pyx_INCREF(__pyx_v_keyspace);
        __Pyx_GIVEREF(__pyx_v_keyspace);
        PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_8, __pyx_v_keyspace);
        __Pyx_INCREF(__pyx_v_table);
        __Pyx_GIVEREF(__pyx_v_table);
        PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_8, __pyx_v_table);
        __Pyx_INCREF(__pyx_v_usertype);
        __Pyx_GIVEREF(__pyx_v_usertype);
        PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_8, __pyx_v_usertype);
        __Pyx_INCREF(__pyx_v_function);
        __Pyx_GIVEREF(__pyx_v_function);
        PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_8, __pyx_v_function);
        __Pyx_INCREF(__pyx_v_aggregate);
        __Pyx_GIVEREF(__pyx_v_aggregate);
        PyTuple_SET_ITEM(__pyx_t_14, 5+__pyx_t_8, __pyx_v_aggregate);
        __pyx_t_6 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_14, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2821; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L7_exception_handled;
      }
      goto __pyx_L8_except_error;
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      goto __pyx_L4_error;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      __pyx_L13_try_end:;
    }
  }

  /* "cassandra/cluster.py":2824
 *             control_conn.refresh_schema, keyspace, table, usertype, function, aggregate)
 *     finally:
 *         response_future._set_final_result(None)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_response_future, __pyx_n_s_set_final_result); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__136, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_18);
      __Pyx_XGOTREF(__pyx_t_19);
      __pyx_t_11 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
      {
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_response_future, __pyx_n_s_set_final_result); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2824; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__137, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2824; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
      }
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
      __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
      __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
      goto __pyx_L1_error;
      __pyx_L18_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "cassandra/cluster.py":2809
 * 
 * 
 * def refresh_schema_and_set_result(keyspace, table, usertype, function, aggregate, control_conn, response_future):             # <<<<<<<<<<<<<<
 *     try:
 *         if control_conn._meta_refresh_enabled:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("cassandra.cluster.refresh_schema_and_set_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2868
 *     _protocol_handler = ProtocolHandler
 * 
 *     def __init__(self, session, message, query, timeout, metrics=None, prepared_statement=None):             # <<<<<<<<<<<<<<
 *         self.session = session
 *         self.row_factory = session.row_factory
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_1__init__ = {"__init__", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_session = 0;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_query = 0;
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_v_metrics = 0;
  PyObject *__pyx_v_prepared_statement = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_session,&__pyx_n_s_message,&__pyx_n_s_query,&__pyx_n_s_timeout,&__pyx_n_s_metrics,&__pyx_n_s_prepared_statement,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[5] = ((PyObject *)((PyObject *)Py_None));
    values[6] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_session)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_metrics);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_prepared_statement);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_session = values[1];
    __pyx_v_message = values[2];
    __pyx_v_query = values[3];
    __pyx_v_timeout = values[4];
    __pyx_v_metrics = values[5];
    __pyx_v_prepared_statement = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture___init__(__pyx_self, __pyx_v_self, __pyx_v_session, __pyx_v_message, __pyx_v_query, __pyx_v_timeout, __pyx_v_metrics, __pyx_v_prepared_statement);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_session, PyObject *__pyx_v_message, PyObject *__pyx_v_query, PyObject *__pyx_v_timeout, PyObject *__pyx_v_metrics, PyObject *__pyx_v_prepared_statement) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cassandra/cluster.py":2869
 * 
 *     def __init__(self, session, message, query, timeout, metrics=None, prepared_statement=None):
 *         self.session = session             # <<<<<<<<<<<<<<
 *         self.row_factory = session.row_factory
 *         self.message = message
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_session, __pyx_v_session) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2870
 *     def __init__(self, session, message, query, timeout, metrics=None, prepared_statement=None):
 *         self.session = session
 *         self.row_factory = session.row_factory             # <<<<<<<<<<<<<<
 *         self.message = message
 *         self.query = query
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_row_factory); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_row_factory, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2871
 *         self.session = session
 *         self.row_factory = session.row_factory
 *         self.message = message             # <<<<<<<<<<<<<<
 *         self.query = query
 *         self.timeout = timeout
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_message, __pyx_v_message) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2872
 *         self.row_factory = session.row_factory
 *         self.message = message
 *         self.query = query             # <<<<<<<<<<<<<<
 *         self.timeout = timeout
 *         self._metrics = metrics
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_query, __pyx_v_query) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2873
 *         self.message = message
 *         self.query = query
 *         self.timeout = timeout             # <<<<<<<<<<<<<<
 *         self._metrics = metrics
 *         self.prepared_statement = prepared_statement
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_timeout, __pyx_v_timeout) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2874
 *         self.query = query
 *         self.timeout = timeout
 *         self._metrics = metrics             # <<<<<<<<<<<<<<
 *         self.prepared_statement = prepared_statement
 *         self._callback_lock = Lock()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2, __pyx_v_metrics) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2875
 *         self.timeout = timeout
 *         self._metrics = metrics
 *         self.prepared_statement = prepared_statement             # <<<<<<<<<<<<<<
 *         self._callback_lock = Lock()
 *         if metrics is not None:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_prepared_statement, __pyx_v_prepared_statement) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2876
 *         self._metrics = metrics
 *         self.prepared_statement = prepared_statement
 *         self._callback_lock = Lock()             # <<<<<<<<<<<<<<
 *         if metrics is not None:
 *             self._start_time = time.time()
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Lock); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_callback_lock, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2877
 *         self.prepared_statement = prepared_statement
 *         self._callback_lock = Lock()
 *         if metrics is not None:             # <<<<<<<<<<<<<<
 *             self._start_time = time.time()
 *         self._make_query_plan()
 */
  __pyx_t_4 = (__pyx_v_metrics != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":2878
 *         self._callback_lock = Lock()
 *         if metrics is not None:
 *             self._start_time = time.time()             # <<<<<<<<<<<<<<
 *         self._make_query_plan()
 *         self._event = Event()
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_start_time, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":2879
 *         if metrics is not None:
 *             self._start_time = time.time()
 *         self._make_query_plan()             # <<<<<<<<<<<<<<
 *         self._event = Event()
 *         self._errors = {}
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_make_query_plan_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2880
 *             self._start_time = time.time()
 *         self._make_query_plan()
 *         self._event = Event()             # <<<<<<<<<<<<<<
 *         self._errors = {}
 *         self._callbacks = []
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Event); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_event_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2881
 *         self._make_query_plan()
 *         self._event = Event()
 *         self._errors = {}             # <<<<<<<<<<<<<<
 *         self._callbacks = []
 *         self._errbacks = []
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_errors_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2882
 *         self._event = Event()
 *         self._errors = {}
 *         self._callbacks = []             # <<<<<<<<<<<<<<
 *         self._errbacks = []
 *         self._start_timer()
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_callbacks, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2883
 *         self._errors = {}
 *         self._callbacks = []
 *         self._errbacks = []             # <<<<<<<<<<<<<<
 *         self._start_timer()
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_errbacks, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2884
 *         self._callbacks = []
 *         self._errbacks = []
 *         self._start_timer()             # <<<<<<<<<<<<<<
 * 
 *     def _start_timer(self):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_start_timer); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2868
 *     _protocol_handler = ProtocolHandler
 * 
 *     def __init__(self, session, message, query, timeout, metrics=None, prepared_statement=None):             # <<<<<<<<<<<<<<
 *         self.session = session
 *         self.row_factory = session.row_factory
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2886
 *         self._start_timer()
 * 
 *     def _start_timer(self):             # <<<<<<<<<<<<<<
 *         if self.timeout is not None:
 *             self._timer = self.session.cluster.connection_class.create_timer(self.timeout, self._on_timeout)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_3_start_timer(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_3_start_timer = {"_start_timer", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_3_start_timer, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_3_start_timer(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_start_timer (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_2_start_timer(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_2_start_timer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_start_timer", 0);

  /* "cassandra/cluster.py":2887
 * 
 *     def _start_timer(self):
 *         if self.timeout is not None:             # <<<<<<<<<<<<<<
 *             self._timer = self.session.cluster.connection_class.create_timer(self.timeout, self._on_timeout)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":2888
 *     def _start_timer(self):
 *         if self.timeout is not None:
 *             self._timer = self.session.cluster.connection_class.create_timer(self.timeout, self._on_timeout)             # <<<<<<<<<<<<<<
 * 
 *     def _cancel_timer(self):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cluster); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_connection_class); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_create_timer); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeout); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_timeout); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_8 = 1;
      }
    }
    __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6);
    __pyx_t_4 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_timer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":2886
 *         self._start_timer()
 * 
 *     def _start_timer(self):             # <<<<<<<<<<<<<<
 *         if self.timeout is not None:
 *             self._timer = self.session.cluster.connection_class.create_timer(self.timeout, self._on_timeout)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._start_timer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2890
 *             self._timer = self.session.cluster.connection_class.create_timer(self.timeout, self._on_timeout)
 * 
 *     def _cancel_timer(self):             # <<<<<<<<<<<<<<
 *         if self._timer:
 *             self._timer.cancel()
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_5_cancel_timer(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_5_cancel_timer = {"_cancel_timer", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_5_cancel_timer, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_5_cancel_timer(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_cancel_timer (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_4_cancel_timer(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_4_cancel_timer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_cancel_timer", 0);

  /* "cassandra/cluster.py":2891
 * 
 *     def _cancel_timer(self):
 *         if self._timer:             # <<<<<<<<<<<<<<
 *             self._timer.cancel()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":2892
 *     def _cancel_timer(self):
 *         if self._timer:
 *             self._timer.cancel()             # <<<<<<<<<<<<<<
 * 
 *     def _on_timeout(self):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timer); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cancel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":2890
 *             self._timer = self.session.cluster.connection_class.create_timer(self.timeout, self._on_timeout)
 * 
 *     def _cancel_timer(self):             # <<<<<<<<<<<<<<
 *         if self._timer:
 *             self._timer.cancel()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._cancel_timer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2894
 *             self._timer.cancel()
 * 
 *     def _on_timeout(self):             # <<<<<<<<<<<<<<
 *         self._set_final_exception(OperationTimedOut(self._errors, self._current_host))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_7_on_timeout(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_7_on_timeout = {"_on_timeout", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_7_on_timeout, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_7_on_timeout(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_timeout (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_6_on_timeout(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_6_on_timeout(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_on_timeout", 0);

  /* "cassandra/cluster.py":2895
 * 
 *     def _on_timeout(self):
 *         self._set_final_exception(OperationTimedOut(self._errors, self._current_host))             # <<<<<<<<<<<<<<
 * 
 *     def _make_query_plan(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_OperationTimedOut); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_errors_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_host); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (__pyx_t_7) {
    __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2894
 *             self._timer.cancel()
 * 
 *     def _on_timeout(self):             # <<<<<<<<<<<<<<
 *         self._set_final_exception(OperationTimedOut(self._errors, self._current_host))
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._on_timeout", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2897
 *         self._set_final_exception(OperationTimedOut(self._errors, self._current_host))
 * 
 *     def _make_query_plan(self):             # <<<<<<<<<<<<<<
 *         # convert the list/generator/etc to an iterator so that subsequent
 *         # calls to send_request (which retries may do) will resume where
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_9_make_query_plan(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_9_make_query_plan = {"_make_query_plan", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_9_make_query_plan, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_9_make_query_plan(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_make_query_plan (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_8_make_query_plan(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_8_make_query_plan(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_make_query_plan", 0);

  /* "cassandra/cluster.py":2901
 *         # calls to send_request (which retries may do) will resume where
 *         # they last left off
 *         self.query_plan = iter(self.session._load_balancer.make_query_plan(             # <<<<<<<<<<<<<<
 *             self.session.keyspace, self.query))
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_load_balancer); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_make_query_plan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":2902
 *         # they last left off
 *         self.query_plan = iter(self.session._load_balancer.make_query_plan(
 *             self.session.keyspace, self.query))             # <<<<<<<<<<<<<<
 * 
 *     def send_request(self):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_keyspace); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2901
 *         # calls to send_request (which retries may do) will resume where
 *         # they last left off
 *         self.query_plan = iter(self.session._load_balancer.make_query_plan(             # <<<<<<<<<<<<<<
 *             self.session.keyspace, self.query))
 * 
 */
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_query_plan, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2897
 *         self._set_final_exception(OperationTimedOut(self._errors, self._current_host))
 * 
 *     def _make_query_plan(self):             # <<<<<<<<<<<<<<
 *         # convert the list/generator/etc to an iterator so that subsequent
 *         # calls to send_request (which retries may do) will resume where
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._make_query_plan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2904
 *             self.session.keyspace, self.query))
 * 
 *     def send_request(self):             # <<<<<<<<<<<<<<
 *         """ Internal """
 *         # query_plan is an iterator, so this will resume where we last left
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_11send_request(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cassandra_7cluster_14ResponseFuture_10send_request[] = " Internal ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_11send_request = {"send_request", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_11send_request, METH_O, __pyx_doc_9cassandra_7cluster_14ResponseFuture_10send_request};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_11send_request(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("send_request (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_10send_request(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_10send_request(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_req_id = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("send_request", 0);

  /* "cassandra/cluster.py":2908
 *         # query_plan is an iterator, so this will resume where we last left
 *         # off if send_request() is called multiple times
 *         for host in self.query_plan:             # <<<<<<<<<<<<<<
 *             req_id = self._query(host)
 *             if req_id is not None:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query_plan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_host, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2909
 *         # off if send_request() is called multiple times
 *         for host in self.query_plan:
 *             req_id = self._query(host)             # <<<<<<<<<<<<<<
 *             if req_id is not None:
 *                 self._req_id = req_id
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_host); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_host);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_req_id, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cassandra/cluster.py":2910
 *         for host in self.query_plan:
 *             req_id = self._query(host)
 *             if req_id is not None:             # <<<<<<<<<<<<<<
 *                 self._req_id = req_id
 *                 return
 */
    __pyx_t_8 = (__pyx_v_req_id != Py_None);
    __pyx_t_9 = (__pyx_t_8 != 0);
    if (__pyx_t_9) {

      /* "cassandra/cluster.py":2911
 *             req_id = self._query(host)
 *             if req_id is not None:
 *                 self._req_id = req_id             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_req_id, __pyx_v_req_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "cassandra/cluster.py":2912
 *             if req_id is not None:
 *                 self._req_id = req_id
 *                 return             # <<<<<<<<<<<<<<
 * 
 *         self._set_final_exception(NoHostAvailable(
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
    }

    /* "cassandra/cluster.py":2908
 *         # query_plan is an iterator, so this will resume where we last left
 *         # off if send_request() is called multiple times
 *         for host in self.query_plan:             # <<<<<<<<<<<<<<
 *             req_id = self._query(host)
 *             if req_id is not None:
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2914
 *                 return
 * 
 *         self._set_final_exception(NoHostAvailable(             # <<<<<<<<<<<<<<
 *             "Unable to complete the operation against any hosts", self._errors))
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_NoHostAvailable); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "cassandra/cluster.py":2915
 * 
 *         self._set_final_exception(NoHostAvailable(
 *             "Unable to complete the operation against any hosts", self._errors))             # <<<<<<<<<<<<<<
 * 
 *     def _query(self, host, message=None, cb=None):
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_errors_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_10 = NULL;
  __pyx_t_3 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_3 = 1;
    }
  }
  __pyx_t_11 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (__pyx_t_10) {
    __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_Unable_to_complete_the_operation);
  __Pyx_GIVEREF(__pyx_kp_s_Unable_to_complete_the_operation);
  PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_3, __pyx_kp_s_Unable_to_complete_the_operation);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_3, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7); __pyx_t_7 = NULL;
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":2904
 *             self.session.keyspace, self.query))
 * 
 *     def send_request(self):             # <<<<<<<<<<<<<<
 *         """ Internal """
 *         # query_plan is an iterator, so this will resume where we last left
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_req_id);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2917
 *             "Unable to complete the operation against any hosts", self._errors))
 * 
 *     def _query(self, host, message=None, cb=None):             # <<<<<<<<<<<<<<
 *         if message is None:
 *             message = self.message
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_13_query(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_13_query = {"_query", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_13_query, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_13_query(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_cb = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_query (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_host,&__pyx_n_s_message,&__pyx_n_s_cb,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_query", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2917; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_message);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cb);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_query") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2917; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_host = values[1];
    __pyx_v_message = values[2];
    __pyx_v_cb = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_query", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2917; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._query", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_12_query(__pyx_self, __pyx_v_self, __pyx_v_host, __pyx_v_message, __pyx_v_cb);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_12_query(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_message, PyObject *__pyx_v_cb) {
  PyObject *__pyx_v_pool = NULL;
  PyObject *__pyx_v_connection = NULL;
  PyObject *__pyx_v_request_id = NULL;
  PyObject *__pyx_v_exc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  Py_ssize_t __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_query", 0);
  __Pyx_INCREF(__pyx_v_message);
  __Pyx_INCREF(__pyx_v_cb);

  /* "cassandra/cluster.py":2918
 * 
 *     def _query(self, host, message=None, cb=None):
 *         if message is None:             # <<<<<<<<<<<<<<
 *             message = self.message
 * 
 */
  __pyx_t_1 = (__pyx_v_message == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":2919
 *     def _query(self, host, message=None, cb=None):
 *         if message is None:
 *             message = self.message             # <<<<<<<<<<<<<<
 * 
 *         if cb is None:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_message); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":2921
 *             message = self.message
 * 
 *         if cb is None:             # <<<<<<<<<<<<<<
 *             cb = self._set_result
 * 
 */
  __pyx_t_2 = (__pyx_v_cb == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "cassandra/cluster.py":2922
 * 
 *         if cb is None:
 *             cb = self._set_result             # <<<<<<<<<<<<<<
 * 
 *         pool = self.session._pools.get(host)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_cb, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cassandra/cluster.py":2924
 *             cb = self._set_result
 * 
 *         pool = self.session._pools.get(host)             # <<<<<<<<<<<<<<
 *         if not pool:
 *             self._errors[host] = ConnectionException("Host has been marked down or removed")
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_pools); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_host); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_host);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_pool = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cassandra/cluster.py":2925
 * 
 *         pool = self.session._pools.get(host)
 *         if not pool:             # <<<<<<<<<<<<<<
 *             self._errors[host] = ConnectionException("Host has been marked down or removed")
 *             return None
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pool); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":2926
 *         pool = self.session._pools.get(host)
 *         if not pool:
 *             self._errors[host] = ConnectionException("Host has been marked down or removed")             # <<<<<<<<<<<<<<
 *             return None
 *         elif pool.is_shutdown:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConnectionException); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__138, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_errors_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_v_host, __pyx_t_4) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cassandra/cluster.py":2927
 *         if not pool:
 *             self._errors[host] = ConnectionException("Host has been marked down or removed")
 *             return None             # <<<<<<<<<<<<<<
 *         elif pool.is_shutdown:
 *             self._errors[host] = ConnectionException("Pool is shutdown")
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2928
 *             self._errors[host] = ConnectionException("Host has been marked down or removed")
 *             return None
 *         elif pool.is_shutdown:             # <<<<<<<<<<<<<<
 *             self._errors[host] = ConnectionException("Pool is shutdown")
 *             return None
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_is_shutdown); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":2929
 *             return None
 *         elif pool.is_shutdown:
 *             self._errors[host] = ConnectionException("Pool is shutdown")             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConnectionException); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__139, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_errors_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_v_host, __pyx_t_3) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cassandra/cluster.py":2930
 *         elif pool.is_shutdown:
 *             self._errors[host] = ConnectionException("Pool is shutdown")
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         self._current_host = host
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2932
 *             return None
 * 
 *         self._current_host = host             # <<<<<<<<<<<<<<
 *         self._current_pool = pool
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_current_host, __pyx_v_host) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2933
 * 
 *         self._current_host = host
 *         self._current_pool = pool             # <<<<<<<<<<<<<<
 * 
 *         connection = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_current_pool, __pyx_v_pool) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2935
 *         self._current_pool = pool
 * 
 *         connection = None             # <<<<<<<<<<<<<<
 *         try:
 *             # TODO get connectTimeout from cluster settings
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_connection = Py_None;

  /* "cassandra/cluster.py":2936
 * 
 *         connection = None
 *         try:             # <<<<<<<<<<<<<<
 *             # TODO get connectTimeout from cluster settings
 *             connection, request_id = pool.borrow_connection(timeout=2.0)
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "cassandra/cluster.py":2938
 *         try:
 *             # TODO get connectTimeout from cluster settings
 *             connection, request_id = pool.borrow_connection(timeout=2.0)             # <<<<<<<<<<<<<<
 *             self._connection = connection
 *             connection.send_msg(message, request_id, cb=cb, encoder=self._protocol_handler.encode_message, decoder=self._protocol_handler.decode_message)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_borrow_connection); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2938; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2938; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_timeout, __pyx_float_2_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2938; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2938; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
        PyObject* sequence = __pyx_t_6;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2938; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2938; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2938; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2938; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext;
        index = 0; __pyx_t_4 = __pyx_t_10(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 1; __pyx_t_3 = __pyx_t_10(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2938; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __pyx_t_10 = NULL;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L15_unpacking_done;
        __pyx_L14_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_10 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2938; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __pyx_L15_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_connection, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_v_request_id = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "cassandra/cluster.py":2939
 *             # TODO get connectTimeout from cluster settings
 *             connection, request_id = pool.borrow_connection(timeout=2.0)
 *             self._connection = connection             # <<<<<<<<<<<<<<
 *             connection.send_msg(message, request_id, cb=cb, encoder=self._protocol_handler.encode_message, decoder=self._protocol_handler.decode_message)
 *             return request_id
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_connection_2, __pyx_v_connection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2939; __pyx_clineno = __LINE__; goto __pyx_L6_error;}

      /* "cassandra/cluster.py":2940
 *             connection, request_id = pool.borrow_connection(timeout=2.0)
 *             self._connection = connection
 *             connection.send_msg(message, request_id, cb=cb, encoder=self._protocol_handler.encode_message, decoder=self._protocol_handler.decode_message)             # <<<<<<<<<<<<<<
 *             return request_id
 *         except NoConnectionsAvailable as exc:
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_send_msg); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_message);
      __Pyx_INCREF(__pyx_v_request_id);
      __Pyx_GIVEREF(__pyx_v_request_id);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_request_id);
      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cb, __pyx_v_cb) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_handler); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_encode_message); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_encoder, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_protocol_handler); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_decode_message); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_decoder, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cassandra/cluster.py":2941
 *             self._connection = connection
 *             connection.send_msg(message, request_id, cb=cb, encoder=self._protocol_handler.encode_message, decoder=self._protocol_handler.decode_message)
 *             return request_id             # <<<<<<<<<<<<<<
 *         except NoConnectionsAvailable as exc:
 *             log.debug("All connections for host %s are at capacity, moving to the next host", host)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_request_id);
      __pyx_r = __pyx_v_request_id;
      goto __pyx_L10_try_return;
    }
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":2942
 *             connection.send_msg(message, request_id, cb=cb, encoder=self._protocol_handler.encode_message, decoder=self._protocol_handler.decode_message)
 *             return request_id
 *         except NoConnectionsAvailable as exc:             # <<<<<<<<<<<<<<
 *             log.debug("All connections for host %s are at capacity, moving to the next host", host)
 *             self._errors[host] = exc
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_NoConnectionsAvailable); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2942; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_12 = PyErr_ExceptionMatches(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_12) {
      __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._query", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2942; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_v_exc = __pyx_t_4;

      /* "cassandra/cluster.py":2943
 *             return request_id
 *         except NoConnectionsAvailable as exc:
 *             log.debug("All connections for host %s are at capacity, moving to the next host", host)             # <<<<<<<<<<<<<<
 *             self._errors[host] = exc
 *             return None
 */
      __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_debug); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      __pyx_t_14 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_13))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_13);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_13, function);
          __pyx_t_14 = 1;
        }
      }
      __pyx_t_15 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_15);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_All_connections_for_host_s_are_a);
      __Pyx_GIVEREF(__pyx_kp_s_All_connections_for_host_s_are_a);
      PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_kp_s_All_connections_for_host_s_are_a);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_v_host);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_15, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "cassandra/cluster.py":2944
 *         except NoConnectionsAvailable as exc:
 *             log.debug("All connections for host %s are at capacity, moving to the next host", host)
 *             self._errors[host] = exc             # <<<<<<<<<<<<<<
 *             return None
 *         except Exception as exc:
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_errors_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2944; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_v_host, __pyx_v_exc) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2944; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "cassandra/cluster.py":2945
 *             log.debug("All connections for host %s are at capacity, moving to the next host", host)
 *             self._errors[host] = exc
 *             return None             # <<<<<<<<<<<<<<
 *         except Exception as exc:
 *             log.debug("Error querying host %s", host, exc_info=True)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L9_except_return;
    }

    /* "cassandra/cluster.py":2946
 *             self._errors[host] = exc
 *             return None
 *         except Exception as exc:             # <<<<<<<<<<<<<<
 *             log.debug("Error querying host %s", host, exc_info=True)
 *             self._errors[host] = exc
 */
    __pyx_t_12 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_12) {
      __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._query", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2946; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_v_exc = __pyx_t_4;

      /* "cassandra/cluster.py":2947
 *             return None
 *         except Exception as exc:
 *             log.debug("Error querying host %s", host, exc_info=True)             # <<<<<<<<<<<<<<
 *             self._errors[host] = exc
 *             if self._metrics is not None:
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_debug); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_kp_s_Error_querying_host_s);
      __Pyx_GIVEREF(__pyx_kp_s_Error_querying_host_s);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_s_Error_querying_host_s);
      __Pyx_INCREF(__pyx_v_host);
      __Pyx_GIVEREF(__pyx_v_host);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_host);
      __pyx_t_15 = PyDict_New(); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_15);
      if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_exc_info, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_6, __pyx_t_15); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "cassandra/cluster.py":2948
 *         except Exception as exc:
 *             log.debug("Error querying host %s", host, exc_info=True)
 *             self._errors[host] = exc             # <<<<<<<<<<<<<<
 *             if self._metrics is not None:
 *                 self._metrics.on_connection_error()
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_errors_2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      if (unlikely(PyObject_SetItem(__pyx_t_11, __pyx_v_host, __pyx_v_exc) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "cassandra/cluster.py":2949
 *             log.debug("Error querying host %s", host, exc_info=True)
 *             self._errors[host] = exc
 *             if self._metrics is not None:             # <<<<<<<<<<<<<<
 *                 self._metrics.on_connection_error()
 *             if connection:
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_2 = (__pyx_t_11 != Py_None);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_1 = (__pyx_t_2 != 0);
      if (__pyx_t_1) {

        /* "cassandra/cluster.py":2950
 *             self._errors[host] = exc
 *             if self._metrics is not None:
 *                 self._metrics.on_connection_error()             # <<<<<<<<<<<<<<
 *             if connection:
 *                 pool.return_connection(connection)
 */
        __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2950; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_on_connection_error); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2950; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_15)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        if (__pyx_t_15) {
          __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_15); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2950; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        } else {
          __pyx_t_11 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2950; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        }
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L20;
      }
      __pyx_L20:;

      /* "cassandra/cluster.py":2951
 *             if self._metrics is not None:
 *                 self._metrics.on_connection_error()
 *             if connection:             # <<<<<<<<<<<<<<
 *                 pool.return_connection(connection)
 *             return None
 */
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_connection); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2951; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      if (__pyx_t_1) {

        /* "cassandra/cluster.py":2952
 *                 self._metrics.on_connection_error()
 *             if connection:
 *                 pool.return_connection(connection)             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_return_connection); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2952; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_15 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_15)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        if (!__pyx_t_15) {
          __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_connection); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2952; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
        } else {
          __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2952; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_15); __pyx_t_15 = NULL;
          __Pyx_INCREF(__pyx_v_connection);
          __Pyx_GIVEREF(__pyx_v_connection);
          PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_connection);
          __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_13, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2952; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L21;
      }
      __pyx_L21:;

      /* "cassandra/cluster.py":2953
 *             if connection:
 *                 pool.return_connection(connection)
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L9_except_return;
    }
    goto __pyx_L8_except_error;
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L0;
    __pyx_L9_except_return:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":2917
 *             "Unable to complete the operation against any hosts", self._errors))
 * 
 *     def _query(self, host, message=None, cb=None):             # <<<<<<<<<<<<<<
 *         if message is None:
 *             message = self.message
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._query", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pool);
  __Pyx_XDECREF(__pyx_v_connection);
  __Pyx_XDECREF(__pyx_v_request_id);
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF(__pyx_v_cb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2956
 * 
 *     @property
 *     def has_more_pages(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns :const:`True` if there are more pages left in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_15has_more_pages(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cassandra_7cluster_14ResponseFuture_14has_more_pages[] = "\n        Returns :const:`True` if there are more pages left in the\n        query results, :const:`False` otherwise.  This should only\n        be checked after the first page has been returned.\n\n        .. versionadded:: 2.0.0\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_15has_more_pages = {"has_more_pages", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_15has_more_pages, METH_O, __pyx_doc_9cassandra_7cluster_14ResponseFuture_14has_more_pages};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_15has_more_pages(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_more_pages (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_14has_more_pages(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_14has_more_pages(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_more_pages", 0);

  /* "cassandra/cluster.py":2964
 *         .. versionadded:: 2.0.0
 *         """
 *         return self._paging_state is not None             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_paging_state); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":2956
 * 
 *     @property
 *     def has_more_pages(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns :const:`True` if there are more pages left in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.has_more_pages", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2967
 * 
 *     @property
 *     def warnings(self):             # <<<<<<<<<<<<<<
 *         """
 *         Warnings returned from the server, if any. This will only be
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_17warnings(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cassandra_7cluster_14ResponseFuture_16warnings[] = "\n        Warnings returned from the server, if any. This will only be\n        set for protocol_version 4+.\n\n        Warnings may be returned for such things as oversized batches,\n        or too many tombstones in slice queries.\n\n        Ensure the future is complete before trying to access this property\n        (call :meth:`.result()`, or after callback is invoked).\n        Otherwise it may throw if the response has not been received.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_17warnings = {"warnings", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_17warnings, METH_O, __pyx_doc_9cassandra_7cluster_14ResponseFuture_16warnings};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_17warnings(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("warnings (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_16warnings(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_16warnings(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("warnings", 0);

  /* "cassandra/cluster.py":2980
 *         """
 *         # TODO: When timers are introduced, just make this wait
 *         if not self._event.is_set():             # <<<<<<<<<<<<<<
 *             raise Exception("warnings cannot be retrieved before ResponseFuture is finalized")
 *         return self._warnings
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_event_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_is_set); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":2981
 *         # TODO: When timers are introduced, just make this wait
 *         if not self._event.is_set():
 *             raise Exception("warnings cannot be retrieved before ResponseFuture is finalized")             # <<<<<<<<<<<<<<
 *         return self._warnings
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__140, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":2982
 *         if not self._event.is_set():
 *             raise Exception("warnings cannot be retrieved before ResponseFuture is finalized")
 *         return self._warnings             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_warnings_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":2967
 * 
 *     @property
 *     def warnings(self):             # <<<<<<<<<<<<<<
 *         """
 *         Warnings returned from the server, if any. This will only be
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.warnings", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":2985
 * 
 *     @property
 *     def custom_payload(self):             # <<<<<<<<<<<<<<
 *         """
 *         The custom payload returned from the server, if any. This will only be
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_19custom_payload(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cassandra_7cluster_14ResponseFuture_18custom_payload[] = "\n        The custom payload returned from the server, if any. This will only be\n        set by Cassandra servers implementing a custom QueryHandler, and only\n        for protocol_version 4+.\n\n        Ensure the future is complete before trying to access this property\n        (call :meth:`.result()`, or after callback is invoked).\n        Otherwise it may throw if the response has not been received.\n\n        :return: :ref:`custom_payload`.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_19custom_payload = {"custom_payload", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_19custom_payload, METH_O, __pyx_doc_9cassandra_7cluster_14ResponseFuture_18custom_payload};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_19custom_payload(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("custom_payload (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_18custom_payload(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_18custom_payload(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("custom_payload", 0);

  /* "cassandra/cluster.py":2998
 *         """
 *         # TODO: When timers are introduced, just make this wait
 *         if not self._event.is_set():             # <<<<<<<<<<<<<<
 *             raise Exception("custom_payload cannot be retrieved before ResponseFuture is finalized")
 *         return self._custom_payload
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_event_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_is_set); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":2999
 *         # TODO: When timers are introduced, just make this wait
 *         if not self._event.is_set():
 *             raise Exception("custom_payload cannot be retrieved before ResponseFuture is finalized")             # <<<<<<<<<<<<<<
 *         return self._custom_payload
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__141, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":3000
 *         if not self._event.is_set():
 *             raise Exception("custom_payload cannot be retrieved before ResponseFuture is finalized")
 *         return self._custom_payload             # <<<<<<<<<<<<<<
 * 
 *     def start_fetching_next_page(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_custom_payload_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":2985
 * 
 *     @property
 *     def custom_payload(self):             # <<<<<<<<<<<<<<
 *         """
 *         The custom payload returned from the server, if any. This will only be
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.custom_payload", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3002
 *         return self._custom_payload
 * 
 *     def start_fetching_next_page(self):             # <<<<<<<<<<<<<<
 *         """
 *         If there are more pages left in the query result, this asynchronously
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_21start_fetching_next_page(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_9cassandra_7cluster_14ResponseFuture_20start_fetching_next_page[] = "\n        If there are more pages left in the query result, this asynchronously\n        starts fetching the next page.  If there are no pages left, :exc:`.QueryExhausted`\n        is raised.  Also see :attr:`.has_more_pages`.\n\n        This should only be called after the first page has been returned.\n\n        .. versionadded:: 2.0.0\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_21start_fetching_next_page = {"start_fetching_next_page", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_21start_fetching_next_page, METH_O, __pyx_doc_9cassandra_7cluster_14ResponseFuture_20start_fetching_next_page};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_21start_fetching_next_page(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("start_fetching_next_page (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_20start_fetching_next_page(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_20start_fetching_next_page(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("start_fetching_next_page", 0);

  /* "cassandra/cluster.py":3012
 *         .. versionadded:: 2.0.0
 *         """
 *         if not self._paging_state:             # <<<<<<<<<<<<<<
 *             raise QueryExhausted()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_paging_state); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":3013
 *         """
 *         if not self._paging_state:
 *             raise QueryExhausted()             # <<<<<<<<<<<<<<
 * 
 *         self._make_query_plan()
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryExhausted); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":3015
 *             raise QueryExhausted()
 * 
 *         self._make_query_plan()             # <<<<<<<<<<<<<<
 *         self.message.paging_state = self._paging_state
 *         self._event.clear()
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_make_query_plan_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3016
 * 
 *         self._make_query_plan()
 *         self.message.paging_state = self._paging_state             # <<<<<<<<<<<<<<
 *         self._event.clear()
 *         self._final_result = _NOT_SET
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_paging_state); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_message); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(__pyx_t_4, __pyx_n_s_paging_state_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":3017
 *         self._make_query_plan()
 *         self.message.paging_state = self._paging_state
 *         self._event.clear()             # <<<<<<<<<<<<<<
 *         self._final_result = _NOT_SET
 *         self._final_exception = None
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_event_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_clear); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":3018
 *         self.message.paging_state = self._paging_state
 *         self._event.clear()
 *         self._final_result = _NOT_SET             # <<<<<<<<<<<<<<
 *         self._final_exception = None
 *         self._start_timer()
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOT_SET); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_final_result, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":3019
 *         self._event.clear()
 *         self._final_result = _NOT_SET
 *         self._final_exception = None             # <<<<<<<<<<<<<<
 *         self._start_timer()
 *         self.send_request()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_final_exception, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3020
 *         self._final_result = _NOT_SET
 *         self._final_exception = None
 *         self._start_timer()             # <<<<<<<<<<<<<<
 *         self.send_request()
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_start_timer); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":3021
 *         self._final_exception = None
 *         self._start_timer()
 *         self.send_request()             # <<<<<<<<<<<<<<
 * 
 *     def _reprepare(self, prepare_message):
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_send_request); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cassandra/cluster.py":3002
 *         return self._custom_payload
 * 
 *     def start_fetching_next_page(self):             # <<<<<<<<<<<<<<
 *         """
 *         If there are more pages left in the query result, this asynchronously
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.start_fetching_next_page", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3023
 *         self.send_request()
 * 
 *     def _reprepare(self, prepare_message):             # <<<<<<<<<<<<<<
 *         cb = partial(self.session.submit, self._execute_after_prepare)
 *         request_id = self._query(self._current_host, prepare_message, cb=cb)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_23_reprepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_23_reprepare = {"_reprepare", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_23_reprepare, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_23_reprepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_prepare_message = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_reprepare (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_prepare_message,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_prepare_message)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_reprepare", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_reprepare") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_prepare_message = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_reprepare", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._reprepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_22_reprepare(__pyx_self, __pyx_v_self, __pyx_v_prepare_message);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_22_reprepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prepare_message) {
  PyObject *__pyx_v_cb = NULL;
  PyObject *__pyx_v_request_id = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_reprepare", 0);

  /* "cassandra/cluster.py":3024
 * 
 *     def _reprepare(self, prepare_message):
 *         cb = partial(self.session.submit, self._execute_after_prepare)             # <<<<<<<<<<<<<<
 *         request_id = self._query(self._current_host, prepare_message, cb=cb)
 *         if request_id is None:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_partial); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_submit); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_execute_after_prepare); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_cb = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3025
 *     def _reprepare(self, prepare_message):
 *         cb = partial(self.session.submit, self._execute_after_prepare)
 *         request_id = self._query(self._current_host, prepare_message, cb=cb)             # <<<<<<<<<<<<<<
 *         if request_id is None:
 *             # try to submit the original prepared statement on some other host
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_host); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_prepare_message);
  __Pyx_GIVEREF(__pyx_v_prepare_message);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_prepare_message);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_cb, __pyx_v_cb) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_request_id = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cassandra/cluster.py":3026
 *         cb = partial(self.session.submit, self._execute_after_prepare)
 *         request_id = self._query(self._current_host, prepare_message, cb=cb)
 *         if request_id is None:             # <<<<<<<<<<<<<<
 *             # try to submit the original prepared statement on some other host
 *             self.send_request()
 */
  __pyx_t_8 = (__pyx_v_request_id == Py_None);
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {

    /* "cassandra/cluster.py":3028
 *         if request_id is None:
 *             # try to submit the original prepared statement on some other host
 *             self.send_request()             # <<<<<<<<<<<<<<
 * 
 *     def _set_result(self, response):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_send_request); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_7) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":3023
 *         self.send_request()
 * 
 *     def _reprepare(self, prepare_message):             # <<<<<<<<<<<<<<
 *         cb = partial(self.session.submit, self._execute_after_prepare)
 *         request_id = self._query(self._current_host, prepare_message, cb=cb)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._reprepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cb);
  __Pyx_XDECREF(__pyx_v_request_id);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3030
 *             self.send_request()
 * 
 *     def _set_result(self, response):             # <<<<<<<<<<<<<<
 *         try:
 *             if self._current_pool and self._connection:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_25_set_result(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_25_set_result = {"_set_result", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_25_set_result, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_25_set_result(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_response = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_result (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_response,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_response)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_result", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3030; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_set_result") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3030; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_response = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_set_result", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3030; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._set_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_24_set_result(__pyx_self, __pyx_v_self, __pyx_v_response);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_24_set_result(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_response) {
  PyObject *__pyx_v_trace_id = NULL;
  PyObject *__pyx_v_session = NULL;
  PyObject *__pyx_v_results = NULL;
  PyObject *__pyx_v_retry_policy = NULL;
  PyObject *__pyx_v_retry = NULL;
  PyObject *__pyx_v_query_id = NULL;
  PyObject *__pyx_v_prepared_statement = NULL;
  PyObject *__pyx_v_current_keyspace = NULL;
  PyObject *__pyx_v_prepared_keyspace = NULL;
  PyObject *__pyx_v_prepare_message = NULL;
  PyObject *__pyx_v_retry_type = NULL;
  PyObject *__pyx_v_consistency = NULL;
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_v_exc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_t_18;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  int __pyx_t_22;
  PyObject *(*__pyx_t_23)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_result", 0);

  /* "cassandra/cluster.py":3031
 * 
 *     def _set_result(self, response):
 *         try:             # <<<<<<<<<<<<<<
 *             if self._current_pool and self._connection:
 *                 self._current_pool.return_connection(self._connection)
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cassandra/cluster.py":3032
 *     def _set_result(self, response):
 *         try:
 *             if self._current_pool and self._connection:             # <<<<<<<<<<<<<<
 *                 self._current_pool.return_connection(self._connection)
 * 
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_pool); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3032; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3032; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
      } else {
        __pyx_t_4 = __pyx_t_6;
        goto __pyx_L12_bool_binop_done;
      }
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3032; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3032; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_4 = __pyx_t_6;
      __pyx_L12_bool_binop_done:;
      if (__pyx_t_4) {

        /* "cassandra/cluster.py":3033
 *         try:
 *             if self._current_pool and self._connection:
 *                 self._current_pool.return_connection(self._connection)             # <<<<<<<<<<<<<<
 * 
 *             trace_id = getattr(response, 'trace_id', None)
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_pool); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3033; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_return_connection); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3033; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3033; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_9 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (!__pyx_t_9) {
          __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3033; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else {
          __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3033; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3033; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L11;
      }
      __pyx_L11:;

      /* "cassandra/cluster.py":3035
 *                 self._current_pool.return_connection(self._connection)
 * 
 *             trace_id = getattr(response, 'trace_id', None)             # <<<<<<<<<<<<<<
 *             if trace_id:
 *                 if self.query:
 */
      __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_response, __pyx_n_s_trace_id, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3035; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_trace_id = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "cassandra/cluster.py":3036
 * 
 *             trace_id = getattr(response, 'trace_id', None)
 *             if trace_id:             # <<<<<<<<<<<<<<
 *                 if self.query:
 *                     self.query.trace_id = trace_id
 */
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_trace_id); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3036; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      if (__pyx_t_4) {

        /* "cassandra/cluster.py":3037
 *             trace_id = getattr(response, 'trace_id', None)
 *             if trace_id:
 *                 if self.query:             # <<<<<<<<<<<<<<
 *                     self.query.trace_id = trace_id
 *                 self._query_trace = QueryTrace(trace_id, self.session)
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3037; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3037; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (__pyx_t_4) {

          /* "cassandra/cluster.py":3038
 *             if trace_id:
 *                 if self.query:
 *                     self.query.trace_id = trace_id             # <<<<<<<<<<<<<<
 *                 self._query_trace = QueryTrace(trace_id, self.session)
 * 
 */
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3038; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_5);
          if (__Pyx_PyObject_SetAttrStr(__pyx_t_5, __pyx_n_s_trace_id, __pyx_v_trace_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3038; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L15;
        }
        __pyx_L15:;

        /* "cassandra/cluster.py":3039
 *                 if self.query:
 *                     self.query.trace_id = trace_id
 *                 self._query_trace = QueryTrace(trace_id, self.session)             # <<<<<<<<<<<<<<
 * 
 *             self._warnings = getattr(response, 'warnings', None)
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_QueryTrace); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3039; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3039; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_7 = NULL;
        __pyx_t_11 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
            __pyx_t_11 = 1;
          }
        }
        __pyx_t_9 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3039; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_v_trace_id);
        __Pyx_GIVEREF(__pyx_v_trace_id);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_11, __pyx_v_trace_id);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_11, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3039; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_query_trace, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3039; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L14;
      }
      __pyx_L14:;

      /* "cassandra/cluster.py":3041
 *                 self._query_trace = QueryTrace(trace_id, self.session)
 * 
 *             self._warnings = getattr(response, 'warnings', None)             # <<<<<<<<<<<<<<
 *             self._custom_payload = getattr(response, 'custom_payload', None)
 * 
 */
      __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_response, __pyx_n_s_warnings, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3041; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_warnings_2, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3041; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cassandra/cluster.py":3042
 * 
 *             self._warnings = getattr(response, 'warnings', None)
 *             self._custom_payload = getattr(response, 'custom_payload', None)             # <<<<<<<<<<<<<<
 * 
 *             if isinstance(response, ResultMessage):
 */
      __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_response, __pyx_n_s_custom_payload, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3042; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_custom_payload_2, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3042; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cassandra/cluster.py":3044
 *             self._custom_payload = getattr(response, 'custom_payload', None)
 * 
 *             if isinstance(response, ResultMessage):             # <<<<<<<<<<<<<<
 *                 if response.kind == RESULT_KIND_SET_KEYSPACE:
 *                     session = getattr(self, 'session', None)
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ResultMessage); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3044; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_IsInstance(__pyx_v_response, __pyx_t_5); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3044; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = (__pyx_t_4 != 0);
      if (__pyx_t_6) {

        /* "cassandra/cluster.py":3045
 * 
 *             if isinstance(response, ResultMessage):
 *                 if response.kind == RESULT_KIND_SET_KEYSPACE:             # <<<<<<<<<<<<<<
 *                     session = getattr(self, 'session', None)
 *                     # since we're running on the event loop thread, we need to
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_kind); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3045; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_RESULT_KIND_SET_KEYSPACE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3045; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = PyObject_RichCompare(__pyx_t_5, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3045; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3045; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_6) {

          /* "cassandra/cluster.py":3046
 *             if isinstance(response, ResultMessage):
 *                 if response.kind == RESULT_KIND_SET_KEYSPACE:
 *                     session = getattr(self, 'session', None)             # <<<<<<<<<<<<<<
 *                     # since we're running on the event loop thread, we need to
 *                     # use a non-blocking method for setting the keyspace on
 */
          __pyx_t_9 = __Pyx_GetAttr3(__pyx_v_self, __pyx_n_s_session, Py_None); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3046; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_v_session = __pyx_t_9;
          __pyx_t_9 = 0;

          /* "cassandra/cluster.py":3054
 *                     # self._set_keyspace_completed() being called in the
 *                     # event loop thread.
 *                     if session:             # <<<<<<<<<<<<<<
 *                         session._set_keyspace_for_all_pools(
 *                             response.results, self._set_keyspace_completed)
 */
          __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_session); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3054; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          if (__pyx_t_6) {

            /* "cassandra/cluster.py":3055
 *                     # event loop thread.
 *                     if session:
 *                         session._set_keyspace_for_all_pools(             # <<<<<<<<<<<<<<
 *                             response.results, self._set_keyspace_completed)
 *                 elif response.kind == RESULT_KIND_SCHEMA_CHANGE:
 */
            __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_session, __pyx_n_s_set_keyspace_for_all_pools); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3055; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_8);

            /* "cassandra/cluster.py":3056
 *                     if session:
 *                         session._set_keyspace_for_all_pools(
 *                             response.results, self._set_keyspace_completed)             # <<<<<<<<<<<<<<
 *                 elif response.kind == RESULT_KIND_SCHEMA_CHANGE:
 *                     # refresh the schema before responding, but do it in another
 */
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_results); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3056; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_keyspace_completed); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3056; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_10);
            __pyx_t_7 = NULL;
            __pyx_t_11 = 0;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
              __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
              if (likely(__pyx_t_7)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
                __Pyx_INCREF(__pyx_t_7);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_8, function);
                __pyx_t_11 = 1;
              }
            }
            __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3055; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_12);
            if (__pyx_t_7) {
              __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL;
            }
            __Pyx_GIVEREF(__pyx_t_5);
            PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_10);
            PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_10);
            __pyx_t_5 = 0;
            __pyx_t_10 = 0;
            __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_12, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3055; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            goto __pyx_L18;
          }
          __pyx_L18:;
          goto __pyx_L17;
        }

        /* "cassandra/cluster.py":3057
 *                         session._set_keyspace_for_all_pools(
 *                             response.results, self._set_keyspace_completed)
 *                 elif response.kind == RESULT_KIND_SCHEMA_CHANGE:             # <<<<<<<<<<<<<<
 *                     # refresh the schema before responding, but do it in another
 *                     # thread instead of the event loop thread
 */
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_kind); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_RESULT_KIND_SCHEMA_CHANGE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_12 = PyObject_RichCompare(__pyx_t_9, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (__pyx_t_6) {

          /* "cassandra/cluster.py":3060
 *                     # refresh the schema before responding, but do it in another
 *                     # thread instead of the event loop thread
 *                     self.session.submit(             # <<<<<<<<<<<<<<
 *                         refresh_schema_and_set_result,
 *                         response.results['keyspace'],
 */
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3060; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_submit); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3060; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

          /* "cassandra/cluster.py":3061
 *                     # thread instead of the event loop thread
 *                     self.session.submit(
 *                         refresh_schema_and_set_result,             # <<<<<<<<<<<<<<
 *                         response.results['keyspace'],
 *                         response.results.get('table'),
 */
          __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_refresh_schema_and_set_result); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3061; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_8);

          /* "cassandra/cluster.py":3062
 *                     self.session.submit(
 *                         refresh_schema_and_set_result,
 *                         response.results['keyspace'],             # <<<<<<<<<<<<<<
 *                         response.results.get('table'),
 *                         response.results.get('type'),
 */
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_results); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_5 = PyObject_GetItem(__pyx_t_10, __pyx_n_s_keyspace); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

          /* "cassandra/cluster.py":3063
 *                         refresh_schema_and_set_result,
 *                         response.results['keyspace'],
 *                         response.results.get('table'),             # <<<<<<<<<<<<<<
 *                         response.results.get('type'),
 *                         response.results.get('function'),
 */
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_results); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_get); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__142, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "cassandra/cluster.py":3064
 *                         response.results['keyspace'],
 *                         response.results.get('table'),
 *                         response.results.get('type'),             # <<<<<<<<<<<<<<
 *                         response.results.get('function'),
 *                         response.results.get('aggregate'),
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_results); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_get); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_tuple__143, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

          /* "cassandra/cluster.py":3065
 *                         response.results.get('table'),
 *                         response.results.get('type'),
 *                         response.results.get('function'),             # <<<<<<<<<<<<<<
 *                         response.results.get('aggregate'),
 *                         self.session.cluster.control_connection,
 */
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_results); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3065; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_get); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3065; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_tuple__144, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3065; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

          /* "cassandra/cluster.py":3066
 *                         response.results.get('type'),
 *                         response.results.get('function'),
 *                         response.results.get('aggregate'),             # <<<<<<<<<<<<<<
 *                         self.session.cluster.control_connection,
 *                         self)
 */
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_results); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3066; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_get); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3066; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_tuple__145, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3066; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

          /* "cassandra/cluster.py":3067
 *                         response.results.get('function'),
 *                         response.results.get('aggregate'),
 *                         self.session.cluster.control_connection,             # <<<<<<<<<<<<<<
 *                         self)
 *                 else:
 */
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_cluster); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_control_connection); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

          /* "cassandra/cluster.py":3068
 *                         response.results.get('aggregate'),
 *                         self.session.cluster.control_connection,
 *                         self)             # <<<<<<<<<<<<<<
 *                 else:
 *                     results = getattr(response, 'results', None)
 */
          __pyx_t_16 = NULL;
          __pyx_t_11 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
            __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_9);
            if (likely(__pyx_t_16)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
              __Pyx_INCREF(__pyx_t_16);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_9, function);
              __pyx_t_11 = 1;
            }
          }
          __pyx_t_17 = PyTuple_New(8+__pyx_t_11); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3060; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_17);
          if (__pyx_t_16) {
            __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_16); __pyx_t_16 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_11, __pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_11, __pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_11, __pyx_t_10);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_17, 3+__pyx_t_11, __pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_13);
          PyTuple_SET_ITEM(__pyx_t_17, 4+__pyx_t_11, __pyx_t_13);
          __Pyx_GIVEREF(__pyx_t_14);
          PyTuple_SET_ITEM(__pyx_t_17, 5+__pyx_t_11, __pyx_t_14);
          __Pyx_GIVEREF(__pyx_t_15);
          PyTuple_SET_ITEM(__pyx_t_17, 6+__pyx_t_11, __pyx_t_15);
          __Pyx_INCREF(__pyx_v_self);
          __Pyx_GIVEREF(__pyx_v_self);
          PyTuple_SET_ITEM(__pyx_t_17, 7+__pyx_t_11, __pyx_v_self);
          __pyx_t_8 = 0;
          __pyx_t_5 = 0;
          __pyx_t_10 = 0;
          __pyx_t_7 = 0;
          __pyx_t_13 = 0;
          __pyx_t_14 = 0;
          __pyx_t_15 = 0;
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_17, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3060; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          goto __pyx_L17;
        }
        /*else*/ {

          /* "cassandra/cluster.py":3070
 *                         self)
 *                 else:
 *                     results = getattr(response, 'results', None)             # <<<<<<<<<<<<<<
 *                     if results is not None and response.kind == RESULT_KIND_ROWS:
 *                         self._paging_state = response.paging_state
 */
          __pyx_t_12 = __Pyx_GetAttr3(__pyx_v_response, __pyx_n_s_results, Py_None); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_v_results = __pyx_t_12;
          __pyx_t_12 = 0;

          /* "cassandra/cluster.py":3071
 *                 else:
 *                     results = getattr(response, 'results', None)
 *                     if results is not None and response.kind == RESULT_KIND_ROWS:             # <<<<<<<<<<<<<<
 *                         self._paging_state = response.paging_state
 *                         results = self.row_factory(*results)
 */
          __pyx_t_4 = (__pyx_v_results != Py_None);
          __pyx_t_18 = (__pyx_t_4 != 0);
          if (__pyx_t_18) {
          } else {
            __pyx_t_6 = __pyx_t_18;
            goto __pyx_L20_bool_binop_done;
          }
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_kind); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3071; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_RESULT_KIND_ROWS); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3071; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_17 = PyObject_RichCompare(__pyx_t_12, __pyx_t_9, Py_EQ); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3071; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3071; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __pyx_t_6 = __pyx_t_18;
          __pyx_L20_bool_binop_done:;
          if (__pyx_t_6) {

            /* "cassandra/cluster.py":3072
 *                     results = getattr(response, 'results', None)
 *                     if results is not None and response.kind == RESULT_KIND_ROWS:
 *                         self._paging_state = response.paging_state             # <<<<<<<<<<<<<<
 *                         results = self.row_factory(*results)
 *                     self._set_final_result(results)
 */
            __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_paging_state_2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3072; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_17);
            if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_paging_state, __pyx_t_17) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3072; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

            /* "cassandra/cluster.py":3073
 *                     if results is not None and response.kind == RESULT_KIND_ROWS:
 *                         self._paging_state = response.paging_state
 *                         results = self.row_factory(*results)             # <<<<<<<<<<<<<<
 *                     self._set_final_result(results)
 *             elif isinstance(response, ErrorMessage):
 */
            __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_row_factory); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3073; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_17);
            __pyx_t_9 = PySequence_Tuple(__pyx_v_results); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3073; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_9, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3073; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_DECREF_SET(__pyx_v_results, __pyx_t_12);
            __pyx_t_12 = 0;
            goto __pyx_L19;
          }
          __pyx_L19:;

          /* "cassandra/cluster.py":3074
 *                         self._paging_state = response.paging_state
 *                         results = self.row_factory(*results)
 *                     self._set_final_result(results)             # <<<<<<<<<<<<<<
 *             elif isinstance(response, ErrorMessage):
 *                 retry_policy = None
 */
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_result); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_17 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
            __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_9);
            if (likely(__pyx_t_17)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
              __Pyx_INCREF(__pyx_t_17);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_9, function);
            }
          }
          if (!__pyx_t_17) {
            __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_results); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_12);
          } else {
            __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_17); __pyx_t_17 = NULL;
            __Pyx_INCREF(__pyx_v_results);
            __Pyx_GIVEREF(__pyx_v_results);
            PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_results);
            __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_15, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          }
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __pyx_L17:;
        goto __pyx_L16;
      }

      /* "cassandra/cluster.py":3075
 *                         results = self.row_factory(*results)
 *                     self._set_final_result(results)
 *             elif isinstance(response, ErrorMessage):             # <<<<<<<<<<<<<<
 *                 retry_policy = None
 *                 if self.query:
 */
      __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorMessage); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3075; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_6 = PyObject_IsInstance(__pyx_v_response, __pyx_t_12); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3075; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_18 = (__pyx_t_6 != 0);
      if (__pyx_t_18) {

        /* "cassandra/cluster.py":3076
 *                     self._set_final_result(results)
 *             elif isinstance(response, ErrorMessage):
 *                 retry_policy = None             # <<<<<<<<<<<<<<
 *                 if self.query:
 *                     retry_policy = self.query.retry_policy
 */
        __Pyx_INCREF(Py_None);
        __pyx_v_retry_policy = Py_None;

        /* "cassandra/cluster.py":3077
 *             elif isinstance(response, ErrorMessage):
 *                 retry_policy = None
 *                 if self.query:             # <<<<<<<<<<<<<<
 *                     retry_policy = self.query.retry_policy
 *                 if not retry_policy:
 */
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (__pyx_t_18) {

          /* "cassandra/cluster.py":3078
 *                 retry_policy = None
 *                 if self.query:
 *                     retry_policy = self.query.retry_policy             # <<<<<<<<<<<<<<
 *                 if not retry_policy:
 *                     retry_policy = self.session.cluster.default_retry_policy
 */
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_retry_policy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF_SET(__pyx_v_retry_policy, __pyx_t_9);
          __pyx_t_9 = 0;
          goto __pyx_L22;
        }
        __pyx_L22:;

        /* "cassandra/cluster.py":3079
 *                 if self.query:
 *                     retry_policy = self.query.retry_policy
 *                 if not retry_policy:             # <<<<<<<<<<<<<<
 *                     retry_policy = self.session.cluster.default_retry_policy
 * 
 */
        __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_v_retry_policy); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __pyx_t_6 = ((!__pyx_t_18) != 0);
        if (__pyx_t_6) {

          /* "cassandra/cluster.py":3080
 *                     retry_policy = self.query.retry_policy
 *                 if not retry_policy:
 *                     retry_policy = self.session.cluster.default_retry_policy             # <<<<<<<<<<<<<<
 * 
 *                 if isinstance(response, ReadTimeoutErrorMessage):
 */
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3080; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_cluster); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3080; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_default_retry_policy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3080; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF_SET(__pyx_v_retry_policy, __pyx_t_9);
          __pyx_t_9 = 0;
          goto __pyx_L23;
        }
        __pyx_L23:;

        /* "cassandra/cluster.py":3082
 *                     retry_policy = self.session.cluster.default_retry_policy
 * 
 *                 if isinstance(response, ReadTimeoutErrorMessage):             # <<<<<<<<<<<<<<
 *                     if self._metrics is not None:
 *                         self._metrics.on_read_timeout()
 */
        __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_ReadTimeoutErrorMessage); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3082; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_6 = PyObject_IsInstance(__pyx_v_response, __pyx_t_9); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3082; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_18 = (__pyx_t_6 != 0);
        if (__pyx_t_18) {

          /* "cassandra/cluster.py":3083
 * 
 *                 if isinstance(response, ReadTimeoutErrorMessage):
 *                     if self._metrics is not None:             # <<<<<<<<<<<<<<
 *                         self._metrics.on_read_timeout()
 *                     retry = retry_policy.on_read_timeout(
 */
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3083; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_18 = (__pyx_t_9 != Py_None);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_6 = (__pyx_t_18 != 0);
          if (__pyx_t_6) {

            /* "cassandra/cluster.py":3084
 *                 if isinstance(response, ReadTimeoutErrorMessage):
 *                     if self._metrics is not None:
 *                         self._metrics.on_read_timeout()             # <<<<<<<<<<<<<<
 *                     retry = retry_policy.on_read_timeout(
 *                         self.query, retry_num=self._query_retries, **response.info)
 */
            __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_on_read_timeout); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __pyx_t_12 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_15))) {
              __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_15);
              if (likely(__pyx_t_12)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
                __Pyx_INCREF(__pyx_t_12);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_15, function);
              }
            }
            if (__pyx_t_12) {
              __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_12); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            } else {
              __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_15); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            goto __pyx_L25;
          }
          __pyx_L25:;

          /* "cassandra/cluster.py":3085
 *                     if self._metrics is not None:
 *                         self._metrics.on_read_timeout()
 *                     retry = retry_policy.on_read_timeout(             # <<<<<<<<<<<<<<
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, WriteTimeoutErrorMessage):
 */
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_retry_policy, __pyx_n_s_on_read_timeout); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3085; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_9);

          /* "cassandra/cluster.py":3086
 *                         self._metrics.on_read_timeout()
 *                     retry = retry_policy.on_read_timeout(
 *                         self.query, retry_num=self._query_retries, **response.info)             # <<<<<<<<<<<<<<
 *                 elif isinstance(response, WriteTimeoutErrorMessage):
 *                     if self._metrics is not None:
 */
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);

          /* "cassandra/cluster.py":3085
 *                     if self._metrics is not None:
 *                         self._metrics.on_read_timeout()
 *                     retry = retry_policy.on_read_timeout(             # <<<<<<<<<<<<<<
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, WriteTimeoutErrorMessage):
 */
          __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3085; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_15);
          PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_15);
          __pyx_t_15 = 0;

          /* "cassandra/cluster.py":3086
 *                         self._metrics.on_read_timeout()
 *                     retry = retry_policy.on_read_timeout(
 *                         self.query, retry_num=self._query_retries, **response.info)             # <<<<<<<<<<<<<<
 *                 elif isinstance(response, WriteTimeoutErrorMessage):
 *                     if self._metrics is not None:
 */
          __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_info); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_17);
          if (unlikely(__pyx_t_17 == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
          if (likely(PyDict_Check(__pyx_t_17))) {
            __pyx_t_15 = PyDict_Copy(__pyx_t_17); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3085; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
          } else {
            __pyx_t_15 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_17, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3085; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
          }
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query_retries); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_17);
          if (unlikely(PyDict_GetItem(__pyx_t_15, __pyx_n_s_retry_num))) {
            __Pyx_RaiseDoubleKeywordsError("function", __pyx_n_s_retry_num); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3085; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
          if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_retry_num, __pyx_t_17) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3085; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

          /* "cassandra/cluster.py":3085
 *                     if self._metrics is not None:
 *                         self._metrics.on_read_timeout()
 *                     retry = retry_policy.on_read_timeout(             # <<<<<<<<<<<<<<
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, WriteTimeoutErrorMessage):
 */
          __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, __pyx_t_15); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3085; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_v_retry = __pyx_t_17;
          __pyx_t_17 = 0;
          goto __pyx_L24;
        }

        /* "cassandra/cluster.py":3087
 *                     retry = retry_policy.on_read_timeout(
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, WriteTimeoutErrorMessage):             # <<<<<<<<<<<<<<
 *                     if self._metrics is not None:
 *                         self._metrics.on_write_timeout()
 */
        __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s_WriteTimeoutErrorMessage); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3087; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_6 = PyObject_IsInstance(__pyx_v_response, __pyx_t_17); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3087; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_18 = (__pyx_t_6 != 0);
        if (__pyx_t_18) {

          /* "cassandra/cluster.py":3088
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, WriteTimeoutErrorMessage):
 *                     if self._metrics is not None:             # <<<<<<<<<<<<<<
 *                         self._metrics.on_write_timeout()
 *                     retry = retry_policy.on_write_timeout(
 */
          __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3088; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_18 = (__pyx_t_17 != Py_None);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __pyx_t_6 = (__pyx_t_18 != 0);
          if (__pyx_t_6) {

            /* "cassandra/cluster.py":3089
 *                 elif isinstance(response, WriteTimeoutErrorMessage):
 *                     if self._metrics is not None:
 *                         self._metrics.on_write_timeout()             # <<<<<<<<<<<<<<
 *                     retry = retry_policy.on_write_timeout(
 *                         self.query, retry_num=self._query_retries, **response.info)
 */
            __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
            __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_on_write_timeout); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __pyx_t_15 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_12))) {
              __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_12);
              if (likely(__pyx_t_15)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
                __Pyx_INCREF(__pyx_t_15);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_12, function);
              }
            }
            if (__pyx_t_15) {
              __pyx_t_17 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_15); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            } else {
              __pyx_t_17 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            __Pyx_GOTREF(__pyx_t_17);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            goto __pyx_L26;
          }
          __pyx_L26:;

          /* "cassandra/cluster.py":3090
 *                     if self._metrics is not None:
 *                         self._metrics.on_write_timeout()
 *                     retry = retry_policy.on_write_timeout(             # <<<<<<<<<<<<<<
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, UnavailableErrorMessage):
 */
          __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_retry_policy, __pyx_n_s_on_write_timeout); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_17);

          /* "cassandra/cluster.py":3091
 *                         self._metrics.on_write_timeout()
 *                     retry = retry_policy.on_write_timeout(
 *                         self.query, retry_num=self._query_retries, **response.info)             # <<<<<<<<<<<<<<
 *                 elif isinstance(response, UnavailableErrorMessage):
 *                     if self._metrics is not None:
 */
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3091; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_12);

          /* "cassandra/cluster.py":3090
 *                     if self._metrics is not None:
 *                         self._metrics.on_write_timeout()
 *                     retry = retry_policy.on_write_timeout(             # <<<<<<<<<<<<<<
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, UnavailableErrorMessage):
 */
          __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_12);
          __pyx_t_12 = 0;

          /* "cassandra/cluster.py":3091
 *                         self._metrics.on_write_timeout()
 *                     retry = retry_policy.on_write_timeout(
 *                         self.query, retry_num=self._query_retries, **response.info)             # <<<<<<<<<<<<<<
 *                 elif isinstance(response, UnavailableErrorMessage):
 *                     if self._metrics is not None:
 */
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_info); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3091; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_9);
          if (unlikely(__pyx_t_9 == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3091; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
          if (likely(PyDict_Check(__pyx_t_9))) {
            __pyx_t_12 = PyDict_Copy(__pyx_t_9); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_12);
          } else {
            __pyx_t_12 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_9, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_12);
          }
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query_retries); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3091; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_9);
          if (unlikely(PyDict_GetItem(__pyx_t_12, __pyx_n_s_retry_num))) {
            __Pyx_RaiseDoubleKeywordsError("function", __pyx_n_s_retry_num); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
          if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_retry_num, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

          /* "cassandra/cluster.py":3090
 *                     if self._metrics is not None:
 *                         self._metrics.on_write_timeout()
 *                     retry = retry_policy.on_write_timeout(             # <<<<<<<<<<<<<<
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, UnavailableErrorMessage):
 */
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_15, __pyx_t_12); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_v_retry = __pyx_t_9;
          __pyx_t_9 = 0;
          goto __pyx_L24;
        }

        /* "cassandra/cluster.py":3092
 *                     retry = retry_policy.on_write_timeout(
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, UnavailableErrorMessage):             # <<<<<<<<<<<<<<
 *                     if self._metrics is not None:
 *                         self._metrics.on_unavailable()
 */
        __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_UnavailableErrorMessage); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_6 = PyObject_IsInstance(__pyx_v_response, __pyx_t_9); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_18 = (__pyx_t_6 != 0);
        if (__pyx_t_18) {

          /* "cassandra/cluster.py":3093
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, UnavailableErrorMessage):
 *                     if self._metrics is not None:             # <<<<<<<<<<<<<<
 *                         self._metrics.on_unavailable()
 *                     retry = retry_policy.on_unavailable(
 */
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3093; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_18 = (__pyx_t_9 != Py_None);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_6 = (__pyx_t_18 != 0);
          if (__pyx_t_6) {

            /* "cassandra/cluster.py":3094
 *                 elif isinstance(response, UnavailableErrorMessage):
 *                     if self._metrics is not None:
 *                         self._metrics.on_unavailable()             # <<<<<<<<<<<<<<
 *                     retry = retry_policy.on_unavailable(
 *                         self.query, retry_num=self._query_retries, **response.info)
 */
            __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_on_unavailable); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __pyx_t_12 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_15))) {
              __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_15);
              if (likely(__pyx_t_12)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
                __Pyx_INCREF(__pyx_t_12);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_15, function);
              }
            }
            if (__pyx_t_12) {
              __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_12); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            } else {
              __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_15); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            goto __pyx_L27;
          }
          __pyx_L27:;

          /* "cassandra/cluster.py":3095
 *                     if self._metrics is not None:
 *                         self._metrics.on_unavailable()
 *                     retry = retry_policy.on_unavailable(             # <<<<<<<<<<<<<<
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, OverloadedErrorMessage):
 */
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_retry_policy, __pyx_n_s_on_unavailable); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3095; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_9);

          /* "cassandra/cluster.py":3096
 *                         self._metrics.on_unavailable()
 *                     retry = retry_policy.on_unavailable(
 *                         self.query, retry_num=self._query_retries, **response.info)             # <<<<<<<<<<<<<<
 *                 elif isinstance(response, OverloadedErrorMessage):
 *                     if self._metrics is not None:
 */
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);

          /* "cassandra/cluster.py":3095
 *                     if self._metrics is not None:
 *                         self._metrics.on_unavailable()
 *                     retry = retry_policy.on_unavailable(             # <<<<<<<<<<<<<<
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, OverloadedErrorMessage):
 */
          __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3095; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_15);
          PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_15);
          __pyx_t_15 = 0;

          /* "cassandra/cluster.py":3096
 *                         self._metrics.on_unavailable()
 *                     retry = retry_policy.on_unavailable(
 *                         self.query, retry_num=self._query_retries, **response.info)             # <<<<<<<<<<<<<<
 *                 elif isinstance(response, OverloadedErrorMessage):
 *                     if self._metrics is not None:
 */
          __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_info); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_17);
          if (unlikely(__pyx_t_17 == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
          if (likely(PyDict_Check(__pyx_t_17))) {
            __pyx_t_15 = PyDict_Copy(__pyx_t_17); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3095; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
          } else {
            __pyx_t_15 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_17, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3095; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
          }
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query_retries); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_17);
          if (unlikely(PyDict_GetItem(__pyx_t_15, __pyx_n_s_retry_num))) {
            __Pyx_RaiseDoubleKeywordsError("function", __pyx_n_s_retry_num); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3095; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
          if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_retry_num, __pyx_t_17) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3095; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

          /* "cassandra/cluster.py":3095
 *                     if self._metrics is not None:
 *                         self._metrics.on_unavailable()
 *                     retry = retry_policy.on_unavailable(             # <<<<<<<<<<<<<<
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, OverloadedErrorMessage):
 */
          __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, __pyx_t_15); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3095; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_v_retry = __pyx_t_17;
          __pyx_t_17 = 0;
          goto __pyx_L24;
        }

        /* "cassandra/cluster.py":3097
 *                     retry = retry_policy.on_unavailable(
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, OverloadedErrorMessage):             # <<<<<<<<<<<<<<
 *                     if self._metrics is not None:
 *                         self._metrics.on_other_error()
 */
        __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s_OverloadedErrorMessage); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3097; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_6 = PyObject_IsInstance(__pyx_v_response, __pyx_t_17); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3097; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_18 = (__pyx_t_6 != 0);
        if (__pyx_t_18) {

          /* "cassandra/cluster.py":3098
 *                         self.query, retry_num=self._query_retries, **response.info)
 *                 elif isinstance(response, OverloadedErrorMessage):
 *                     if self._metrics is not None:             # <<<<<<<<<<<<<<
 *                         self._metrics.on_other_error()
 *                     # need to retry against a different host here
 */
          __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3098; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_18 = (__pyx_t_17 != Py_None);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __pyx_t_6 = (__pyx_t_18 != 0);
          if (__pyx_t_6) {

            /* "cassandra/cluster.py":3099
 *                 elif isinstance(response, OverloadedErrorMessage):
 *                     if self._metrics is not None:
 *                         self._metrics.on_other_error()             # <<<<<<<<<<<<<<
 *                     # need to retry against a different host here
 *                     log.warning("Host %s is overloaded, retrying against a different "
 */
            __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
            __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_on_other_error); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __pyx_t_15 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_12))) {
              __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_12);
              if (likely(__pyx_t_15)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
                __Pyx_INCREF(__pyx_t_15);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_12, function);
              }
            }
            if (__pyx_t_15) {
              __pyx_t_17 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_15); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            } else {
              __pyx_t_17 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            __Pyx_GOTREF(__pyx_t_17);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            goto __pyx_L28;
          }
          __pyx_L28:;

          /* "cassandra/cluster.py":3101
 *                         self._metrics.on_other_error()
 *                     # need to retry against a different host here
 *                     log.warning("Host %s is overloaded, retrying against a different "             # <<<<<<<<<<<<<<
 *                                 "host", self._current_host)
 *                     self._retry(reuse_connection=False, consistency_level=None)
 */
          __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_warning); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "cassandra/cluster.py":3102
 *                     # need to retry against a different host here
 *                     log.warning("Host %s is overloaded, retrying against a different "
 *                                 "host", self._current_host)             # <<<<<<<<<<<<<<
 *                     self._retry(reuse_connection=False, consistency_level=None)
 *                     return
 */
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_host); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_9 = NULL;
          __pyx_t_11 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
            __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_15);
            if (likely(__pyx_t_9)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
              __Pyx_INCREF(__pyx_t_9);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_15, function);
              __pyx_t_11 = 1;
            }
          }
          __pyx_t_14 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          if (__pyx_t_9) {
            __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9); __pyx_t_9 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_s_Host_s_is_overloaded_retrying_ag);
          __Pyx_GIVEREF(__pyx_kp_s_Host_s_is_overloaded_retrying_ag);
          PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_11, __pyx_kp_s_Host_s_is_overloaded_retrying_ag);
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_11, __pyx_t_12);
          __pyx_t_12 = 0;
          __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_14, NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

          /* "cassandra/cluster.py":3103
 *                     log.warning("Host %s is overloaded, retrying against a different "
 *                                 "host", self._current_host)
 *                     self._retry(reuse_connection=False, consistency_level=None)             # <<<<<<<<<<<<<<
 *                     return
 *                 elif isinstance(response, IsBootstrappingErrorMessage):
 */
          __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_retry); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_15 = PyDict_New(); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_reuse_connection, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_consistency_level, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_empty_tuple, __pyx_t_15); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

          /* "cassandra/cluster.py":3104
 *                                 "host", self._current_host)
 *                     self._retry(reuse_connection=False, consistency_level=None)
 *                     return             # <<<<<<<<<<<<<<
 *                 elif isinstance(response, IsBootstrappingErrorMessage):
 *                     if self._metrics is not None:
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_r = Py_None; __Pyx_INCREF(Py_None);
          goto __pyx_L7_try_return;
        }

        /* "cassandra/cluster.py":3105
 *                     self._retry(reuse_connection=False, consistency_level=None)
 *                     return
 *                 elif isinstance(response, IsBootstrappingErrorMessage):             # <<<<<<<<<<<<<<
 *                     if self._metrics is not None:
 *                         self._metrics.on_other_error()
 */
        __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_IsBootstrappingErrorMessage); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3105; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_6 = PyObject_IsInstance(__pyx_v_response, __pyx_t_14); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3105; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_18 = (__pyx_t_6 != 0);
        if (__pyx_t_18) {

          /* "cassandra/cluster.py":3106
 *                     return
 *                 elif isinstance(response, IsBootstrappingErrorMessage):
 *                     if self._metrics is not None:             # <<<<<<<<<<<<<<
 *                         self._metrics.on_other_error()
 *                     # need to retry against a different host here
 */
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_18 = (__pyx_t_14 != Py_None);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_6 = (__pyx_t_18 != 0);
          if (__pyx_t_6) {

            /* "cassandra/cluster.py":3107
 *                 elif isinstance(response, IsBootstrappingErrorMessage):
 *                     if self._metrics is not None:
 *                         self._metrics.on_other_error()             # <<<<<<<<<<<<<<
 *                     # need to retry against a different host here
 *                     self._retry(reuse_connection=False, consistency_level=None)
 */
            __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3107; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
            __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_on_other_error); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3107; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_17);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __pyx_t_15 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_17))) {
              __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_17);
              if (likely(__pyx_t_15)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
                __Pyx_INCREF(__pyx_t_15);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_17, function);
              }
            }
            if (__pyx_t_15) {
              __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_17, __pyx_t_15); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3107; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            } else {
              __pyx_t_14 = __Pyx_PyObject_CallNoArg(__pyx_t_17); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3107; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            goto __pyx_L29;
          }
          __pyx_L29:;

          /* "cassandra/cluster.py":3109
 *                         self._metrics.on_other_error()
 *                     # need to retry against a different host here
 *                     self._retry(reuse_connection=False, consistency_level=None)             # <<<<<<<<<<<<<<
 *                     return
 *                 elif isinstance(response, PreparedQueryNotFound):
 */
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_retry); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_17 = PyDict_New(); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_17);
          if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_reuse_connection, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_consistency_level, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_empty_tuple, __pyx_t_17); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

          /* "cassandra/cluster.py":3110
 *                     # need to retry against a different host here
 *                     self._retry(reuse_connection=False, consistency_level=None)
 *                     return             # <<<<<<<<<<<<<<
 *                 elif isinstance(response, PreparedQueryNotFound):
 *                     if self.prepared_statement:
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_r = Py_None; __Pyx_INCREF(Py_None);
          goto __pyx_L7_try_return;
        }

        /* "cassandra/cluster.py":3111
 *                     self._retry(reuse_connection=False, consistency_level=None)
 *                     return
 *                 elif isinstance(response, PreparedQueryNotFound):             # <<<<<<<<<<<<<<
 *                     if self.prepared_statement:
 *                         query_id = self.prepared_statement.query_id
 */
        __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_PreparedQueryNotFound); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_6 = PyObject_IsInstance(__pyx_v_response, __pyx_t_15); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_18 = (__pyx_t_6 != 0);
        if (__pyx_t_18) {

          /* "cassandra/cluster.py":3112
 *                     return
 *                 elif isinstance(response, PreparedQueryNotFound):
 *                     if self.prepared_statement:             # <<<<<<<<<<<<<<
 *                         query_id = self.prepared_statement.query_id
 *                         assert query_id == response.info, \
 */
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_prepared_statement); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3112; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3112; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          if (__pyx_t_18) {

            /* "cassandra/cluster.py":3113
 *                 elif isinstance(response, PreparedQueryNotFound):
 *                     if self.prepared_statement:
 *                         query_id = self.prepared_statement.query_id             # <<<<<<<<<<<<<<
 *                         assert query_id == response.info, \
 *                             "Got different query ID in server response (%s) than we " \
 */
            __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_prepared_statement); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
            __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_query_id); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_17);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __pyx_v_query_id = __pyx_t_17;
            __pyx_t_17 = 0;

            /* "cassandra/cluster.py":3114
 *                     if self.prepared_statement:
 *                         query_id = self.prepared_statement.query_id
 *                         assert query_id == response.info, \             # <<<<<<<<<<<<<<
 *                             "Got different query ID in server response (%s) than we " \
 *                             "had before (%s)" % (response.info, query_id)
 */
            #ifndef CYTHON_WITHOUT_ASSERTIONS
            if (unlikely(!Py_OptimizeFlag)) {
              __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_info); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_GOTREF(__pyx_t_17);
              __pyx_t_15 = PyObject_RichCompare(__pyx_v_query_id, __pyx_t_17, Py_EQ); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
              __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
              if (unlikely(!__pyx_t_18)) {

                /* "cassandra/cluster.py":3116
 *                         assert query_id == response.info, \
 *                             "Got different query ID in server response (%s) than we " \
 *                             "had before (%s)" % (response.info, query_id)             # <<<<<<<<<<<<<<
 *                     else:
 *                         query_id = response.info
 */
                __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_info); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3116; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
                __Pyx_GOTREF(__pyx_t_15);
                __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3116; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
                __Pyx_GOTREF(__pyx_t_17);
                __Pyx_GIVEREF(__pyx_t_15);
                PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15);
                __Pyx_INCREF(__pyx_v_query_id);
                __Pyx_GIVEREF(__pyx_v_query_id);
                PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_v_query_id);
                __pyx_t_15 = 0;
                __pyx_t_15 = __Pyx_PyString_Format(__pyx_kp_s_Got_different_query_ID_in_server, __pyx_t_17); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3116; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
                __Pyx_GOTREF(__pyx_t_15);
                __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
                PyErr_SetObject(PyExc_AssertionError, __pyx_t_15);
                __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              }
            }
            #endif
            goto __pyx_L30;
          }
          /*else*/ {

            /* "cassandra/cluster.py":3118
 *                             "had before (%s)" % (response.info, query_id)
 *                     else:
 *                         query_id = response.info             # <<<<<<<<<<<<<<
 * 
 *                     try:
 */
            __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_info); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
            __pyx_v_query_id = __pyx_t_15;
            __pyx_t_15 = 0;
          }
          __pyx_L30:;

          /* "cassandra/cluster.py":3120
 *                         query_id = response.info
 * 
 *                     try:             # <<<<<<<<<<<<<<
 *                         prepared_statement = self.session.cluster._prepared_statements[query_id]
 *                     except KeyError:
 */
          {
            __Pyx_ExceptionSave(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
            __Pyx_XGOTREF(__pyx_t_19);
            __Pyx_XGOTREF(__pyx_t_20);
            __Pyx_XGOTREF(__pyx_t_21);
            /*try:*/ {

              /* "cassandra/cluster.py":3121
 * 
 *                     try:
 *                         prepared_statement = self.session.cluster._prepared_statements[query_id]             # <<<<<<<<<<<<<<
 *                     except KeyError:
 *                         if not self.prepared_statement:
 */
              __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
              __Pyx_GOTREF(__pyx_t_15);
              __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_cluster); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
              __Pyx_GOTREF(__pyx_t_17);
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
              __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_prepared_statements); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
              __Pyx_GOTREF(__pyx_t_15);
              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
              __pyx_t_17 = PyObject_GetItem(__pyx_t_15, __pyx_v_query_id); if (unlikely(__pyx_t_17 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L31_error;};
              __Pyx_GOTREF(__pyx_t_17);
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
              __pyx_v_prepared_statement = __pyx_t_17;
              __pyx_t_17 = 0;
            }
            __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
            __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
            __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
            goto __pyx_L38_try_end;
            __pyx_L31_error:;
            __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;

            /* "cassandra/cluster.py":3122
 *                     try:
 *                         prepared_statement = self.session.cluster._prepared_statements[query_id]
 *                     except KeyError:             # <<<<<<<<<<<<<<
 *                         if not self.prepared_statement:
 *                             log.error("Tried to execute unknown prepared statement: id=%s",
 */
            __pyx_t_22 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
            if (__pyx_t_22) {
              __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._set_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_17, &__pyx_t_15, &__pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3122; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
              __Pyx_GOTREF(__pyx_t_17);
              __Pyx_GOTREF(__pyx_t_15);
              __Pyx_GOTREF(__pyx_t_14);

              /* "cassandra/cluster.py":3123
 *                         prepared_statement = self.session.cluster._prepared_statements[query_id]
 *                     except KeyError:
 *                         if not self.prepared_statement:             # <<<<<<<<<<<<<<
 *                             log.error("Tried to execute unknown prepared statement: id=%s",
 *                                       query_id.encode('hex'))
 */
              __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_prepared_statement); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3123; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
              __Pyx_GOTREF(__pyx_t_12);
              __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3123; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __pyx_t_6 = ((!__pyx_t_18) != 0);
              if (__pyx_t_6) {

                /* "cassandra/cluster.py":3124
 *                     except KeyError:
 *                         if not self.prepared_statement:
 *                             log.error("Tried to execute unknown prepared statement: id=%s",             # <<<<<<<<<<<<<<
 *                                       query_id.encode('hex'))
 *                             self._set_final_exception(response)
 */
                __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3124; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                __Pyx_GOTREF(__pyx_t_9);
                __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_error); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3124; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                __Pyx_GOTREF(__pyx_t_13);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

                /* "cassandra/cluster.py":3125
 *                         if not self.prepared_statement:
 *                             log.error("Tried to execute unknown prepared statement: id=%s",
 *                                       query_id.encode('hex'))             # <<<<<<<<<<<<<<
 *                             self._set_final_exception(response)
 *                             return
 */
                __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_query_id, __pyx_n_s_encode); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                __Pyx_GOTREF(__pyx_t_9);
                __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__146, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                __Pyx_GOTREF(__pyx_t_7);
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                __pyx_t_9 = NULL;
                __pyx_t_11 = 0;
                if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_13))) {
                  __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_13);
                  if (likely(__pyx_t_9)) {
                    PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
                    __Pyx_INCREF(__pyx_t_9);
                    __Pyx_INCREF(function);
                    __Pyx_DECREF_SET(__pyx_t_13, function);
                    __pyx_t_11 = 1;
                  }
                }
                __pyx_t_10 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3124; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                __Pyx_GOTREF(__pyx_t_10);
                if (__pyx_t_9) {
                  __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
                }
                __Pyx_INCREF(__pyx_kp_s_Tried_to_execute_unknown_prepare);
                __Pyx_GIVEREF(__pyx_kp_s_Tried_to_execute_unknown_prepare);
                PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_11, __pyx_kp_s_Tried_to_execute_unknown_prepare);
                __Pyx_GIVEREF(__pyx_t_7);
                PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_11, __pyx_t_7);
                __pyx_t_7 = 0;
                __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_10, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3124; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                __Pyx_GOTREF(__pyx_t_12);
                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

                /* "cassandra/cluster.py":3126
 *                             log.error("Tried to execute unknown prepared statement: id=%s",
 *                                       query_id.encode('hex'))
 *                             self._set_final_exception(response)             # <<<<<<<<<<<<<<
 *                             return
 *                         else:
 */
                __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3126; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                __Pyx_GOTREF(__pyx_t_13);
                __pyx_t_10 = NULL;
                if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_13))) {
                  __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_13);
                  if (likely(__pyx_t_10)) {
                    PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
                    __Pyx_INCREF(__pyx_t_10);
                    __Pyx_INCREF(function);
                    __Pyx_DECREF_SET(__pyx_t_13, function);
                  }
                }
                if (!__pyx_t_10) {
                  __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_response); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3126; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                  __Pyx_GOTREF(__pyx_t_12);
                } else {
                  __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3126; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                  __Pyx_GOTREF(__pyx_t_7);
                  __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10); __pyx_t_10 = NULL;
                  __Pyx_INCREF(__pyx_v_response);
                  __Pyx_GIVEREF(__pyx_v_response);
                  PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_response);
                  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_7, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3126; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                  __Pyx_GOTREF(__pyx_t_12);
                  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
                }
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

                /* "cassandra/cluster.py":3127
 *                                       query_id.encode('hex'))
 *                             self._set_final_exception(response)
 *                             return             # <<<<<<<<<<<<<<
 *                         else:
 *                             prepared_statement = self.prepared_statement
 */
                __Pyx_XDECREF(__pyx_r);
                __pyx_r = Py_None; __Pyx_INCREF(Py_None);
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
                goto __pyx_L34_except_return;
              }
              /*else*/ {

                /* "cassandra/cluster.py":3129
 *                             return
 *                         else:
 *                             prepared_statement = self.prepared_statement             # <<<<<<<<<<<<<<
 *                             self.session.cluster._prepared_statements[query_id] = prepared_statement
 * 
 */
                __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_prepared_statement); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3129; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                __Pyx_GOTREF(__pyx_t_12);
                __Pyx_XDECREF_SET(__pyx_v_prepared_statement, __pyx_t_12);
                __pyx_t_12 = 0;

                /* "cassandra/cluster.py":3130
 *                         else:
 *                             prepared_statement = self.prepared_statement
 *                             self.session.cluster._prepared_statements[query_id] = prepared_statement             # <<<<<<<<<<<<<<
 * 
 *                     current_keyspace = self._connection.keyspace
 */
                __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3130; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                __Pyx_GOTREF(__pyx_t_12);
                __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_cluster); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3130; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                __Pyx_GOTREF(__pyx_t_13);
                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_prepared_statements); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3130; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                __Pyx_GOTREF(__pyx_t_12);
                __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                if (unlikely(PyObject_SetItem(__pyx_t_12, __pyx_v_query_id, __pyx_v_prepared_statement) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3130; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              }
              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              goto __pyx_L32_exception_handled;
            }
            goto __pyx_L33_except_error;
            __pyx_L33_except_error:;
            __Pyx_XGIVEREF(__pyx_t_19);
            __Pyx_XGIVEREF(__pyx_t_20);
            __Pyx_XGIVEREF(__pyx_t_21);
            __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
            goto __pyx_L3_error;
            __pyx_L34_except_return:;
            __Pyx_XGIVEREF(__pyx_t_19);
            __Pyx_XGIVEREF(__pyx_t_20);
            __Pyx_XGIVEREF(__pyx_t_21);
            __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
            goto __pyx_L7_try_return;
            __pyx_L32_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_19);
            __Pyx_XGIVEREF(__pyx_t_20);
            __Pyx_XGIVEREF(__pyx_t_21);
            __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
            __pyx_L38_try_end:;
          }

          /* "cassandra/cluster.py":3132
 *                             self.session.cluster._prepared_statements[query_id] = prepared_statement
 * 
 *                     current_keyspace = self._connection.keyspace             # <<<<<<<<<<<<<<
 *                     prepared_keyspace = prepared_statement.keyspace
 *                     if prepared_keyspace and current_keyspace != prepared_keyspace:
 */
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3132; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_keyspace); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3132; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_v_current_keyspace = __pyx_t_15;
          __pyx_t_15 = 0;

          /* "cassandra/cluster.py":3133
 * 
 *                     current_keyspace = self._connection.keyspace
 *                     prepared_keyspace = prepared_statement.keyspace             # <<<<<<<<<<<<<<
 *                     if prepared_keyspace and current_keyspace != prepared_keyspace:
 *                         self._set_final_exception(
 */
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_prepared_statement, __pyx_n_s_keyspace); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3133; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_v_prepared_keyspace = __pyx_t_15;
          __pyx_t_15 = 0;

          /* "cassandra/cluster.py":3134
 *                     current_keyspace = self._connection.keyspace
 *                     prepared_keyspace = prepared_statement.keyspace
 *                     if prepared_keyspace and current_keyspace != prepared_keyspace:             # <<<<<<<<<<<<<<
 *                         self._set_final_exception(
 *                             ValueError("The Session's current keyspace (%s) does "
 */
          __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_v_prepared_keyspace); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3134; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          if (__pyx_t_18) {
          } else {
            __pyx_t_6 = __pyx_t_18;
            goto __pyx_L43_bool_binop_done;
          }
          __pyx_t_15 = PyObject_RichCompare(__pyx_v_current_keyspace, __pyx_v_prepared_keyspace, Py_NE); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3134; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3134; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_6 = __pyx_t_18;
          __pyx_L43_bool_binop_done:;
          if (__pyx_t_6) {

            /* "cassandra/cluster.py":3135
 *                     prepared_keyspace = prepared_statement.keyspace
 *                     if prepared_keyspace and current_keyspace != prepared_keyspace:
 *                         self._set_final_exception(             # <<<<<<<<<<<<<<
 *                             ValueError("The Session's current keyspace (%s) does "
 *                                        "not match the keyspace the statement was "
 */
            __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_14);

            /* "cassandra/cluster.py":3139
 *                                        "not match the keyspace the statement was "
 *                                        "prepared with (%s)" %
 *                                        (current_keyspace, prepared_keyspace)))             # <<<<<<<<<<<<<<
 *                         return
 * 
 */
            __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_17);
            __Pyx_INCREF(__pyx_v_current_keyspace);
            __Pyx_GIVEREF(__pyx_v_current_keyspace);
            PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_v_current_keyspace);
            __Pyx_INCREF(__pyx_v_prepared_keyspace);
            __Pyx_GIVEREF(__pyx_v_prepared_keyspace);
            PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_v_prepared_keyspace);

            /* "cassandra/cluster.py":3138
 *                             ValueError("The Session's current keyspace (%s) does "
 *                                        "not match the keyspace the statement was "
 *                                        "prepared with (%s)" %             # <<<<<<<<<<<<<<
 *                                        (current_keyspace, prepared_keyspace)))
 *                         return
 */
            __pyx_t_12 = __Pyx_PyString_Format(__pyx_kp_s_The_Session_s_current_keyspace_s, __pyx_t_17); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

            /* "cassandra/cluster.py":3136
 *                     if prepared_keyspace and current_keyspace != prepared_keyspace:
 *                         self._set_final_exception(
 *                             ValueError("The Session's current keyspace (%s) does "             # <<<<<<<<<<<<<<
 *                                        "not match the keyspace the statement was "
 *                                        "prepared with (%s)" %
 */
            __pyx_t_17 = PyTuple_New(1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3136; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_17);
            __Pyx_GIVEREF(__pyx_t_12);
            PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_12);
            __pyx_t_12 = 0;
            __pyx_t_12 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_17, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3136; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            __pyx_t_17 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
              __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_14);
              if (likely(__pyx_t_17)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
                __Pyx_INCREF(__pyx_t_17);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_14, function);
              }
            }
            if (!__pyx_t_17) {
              __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_12); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_GOTREF(__pyx_t_15);
            } else {
              __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_GOTREF(__pyx_t_13);
              __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_17); __pyx_t_17 = NULL;
              __Pyx_GIVEREF(__pyx_t_12);
              PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_12);
              __pyx_t_12 = 0;
              __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_13, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_GOTREF(__pyx_t_15);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            }
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

            /* "cassandra/cluster.py":3140
 *                                        "prepared with (%s)" %
 *                                        (current_keyspace, prepared_keyspace)))
 *                         return             # <<<<<<<<<<<<<<
 * 
 *                     log.debug("Re-preparing unrecognized prepared statement against host %s: %s",
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            goto __pyx_L7_try_return;
          }

          /* "cassandra/cluster.py":3142
 *                         return
 * 
 *                     log.debug("Re-preparing unrecognized prepared statement against host %s: %s",             # <<<<<<<<<<<<<<
 *                               self._current_host, prepared_statement.query_string)
 *                     prepare_message = PrepareMessage(query=prepared_statement.query_string)
 */
          __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_debug); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

          /* "cassandra/cluster.py":3143
 * 
 *                     log.debug("Re-preparing unrecognized prepared statement against host %s: %s",
 *                               self._current_host, prepared_statement.query_string)             # <<<<<<<<<<<<<<
 *                     prepare_message = PrepareMessage(query=prepared_statement.query_string)
 *                     # since this might block, run on the executor to avoid hanging
 */
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_host); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_prepared_statement, __pyx_n_s_query_string); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_17 = NULL;
          __pyx_t_11 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_13))) {
            __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_13);
            if (likely(__pyx_t_17)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
              __Pyx_INCREF(__pyx_t_17);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_13, function);
              __pyx_t_11 = 1;
            }
          }
          __pyx_t_7 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          if (__pyx_t_17) {
            __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_17); __pyx_t_17 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_s_Re_preparing_unrecognized_prepar);
          __Pyx_GIVEREF(__pyx_kp_s_Re_preparing_unrecognized_prepar);
          PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_11, __pyx_kp_s_Re_preparing_unrecognized_prepar);
          __Pyx_GIVEREF(__pyx_t_14);
          PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_11, __pyx_t_14);
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_11, __pyx_t_12);
          __pyx_t_14 = 0;
          __pyx_t_12 = 0;
          __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_7, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

          /* "cassandra/cluster.py":3144
 *                     log.debug("Re-preparing unrecognized prepared statement against host %s: %s",
 *                               self._current_host, prepared_statement.query_string)
 *                     prepare_message = PrepareMessage(query=prepared_statement.query_string)             # <<<<<<<<<<<<<<
 *                     # since this might block, run on the executor to avoid hanging
 *                     # the event loop thread
 */
          __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_PrepareMessage); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_prepared_statement, __pyx_n_s_query_string); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_query, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_empty_tuple, __pyx_t_13); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_v_prepare_message = __pyx_t_7;
          __pyx_t_7 = 0;

          /* "cassandra/cluster.py":3147
 *                     # since this might block, run on the executor to avoid hanging
 *                     # the event loop thread
 *                     self.session.submit(self._reprepare, prepare_message)             # <<<<<<<<<<<<<<
 *                     return
 *                 else:
 */
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_submit); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reprepare); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_12 = NULL;
          __pyx_t_11 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_15))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_15);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_15, function);
              __pyx_t_11 = 1;
            }
          }
          __pyx_t_14 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          if (__pyx_t_12) {
            __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12); __pyx_t_12 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_13);
          PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_11, __pyx_t_13);
          __Pyx_INCREF(__pyx_v_prepare_message);
          __Pyx_GIVEREF(__pyx_v_prepare_message);
          PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_11, __pyx_v_prepare_message);
          __pyx_t_13 = 0;
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_14, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "cassandra/cluster.py":3148
 *                     # the event loop thread
 *                     self.session.submit(self._reprepare, prepare_message)
 *                     return             # <<<<<<<<<<<<<<
 *                 else:
 *                     if hasattr(response, 'to_exception'):
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_r = Py_None; __Pyx_INCREF(Py_None);
          goto __pyx_L7_try_return;
        }
        /*else*/ {

          /* "cassandra/cluster.py":3150
 *                     return
 *                 else:
 *                     if hasattr(response, 'to_exception'):             # <<<<<<<<<<<<<<
 *                         self._set_final_exception(response.to_exception())
 *                     else:
 */
          __pyx_t_6 = PyObject_HasAttr(__pyx_v_response, __pyx_n_s_to_exception); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3150; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __pyx_t_18 = (__pyx_t_6 != 0);
          if (__pyx_t_18) {

            /* "cassandra/cluster.py":3151
 *                 else:
 *                     if hasattr(response, 'to_exception'):
 *                         self._set_final_exception(response.to_exception())             # <<<<<<<<<<<<<<
 *                     else:
 *                         self._set_final_exception(response)
 */
            __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3151; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
            __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_to_exception); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3151; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_12 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_13))) {
              __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
              if (likely(__pyx_t_12)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
                __Pyx_INCREF(__pyx_t_12);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_13, function);
              }
            }
            if (__pyx_t_12) {
              __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3151; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            } else {
              __pyx_t_14 = __Pyx_PyObject_CallNoArg(__pyx_t_13); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3151; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __pyx_t_13 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_15))) {
              __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_15);
              if (likely(__pyx_t_13)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
                __Pyx_INCREF(__pyx_t_13);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_15, function);
              }
            }
            if (!__pyx_t_13) {
              __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_14); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3151; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_GOTREF(__pyx_t_7);
            } else {
              __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3151; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13); __pyx_t_13 = NULL;
              __Pyx_GIVEREF(__pyx_t_14);
              PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_14);
              __pyx_t_14 = 0;
              __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_12, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3151; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_GOTREF(__pyx_t_7);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            }
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            goto __pyx_L45;
          }
          /*else*/ {

            /* "cassandra/cluster.py":3153
 *                         self._set_final_exception(response.to_exception())
 *                     else:
 *                         self._set_final_exception(response)             # <<<<<<<<<<<<<<
 *                     return
 * 
 */
            __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
            __pyx_t_12 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_15))) {
              __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_15);
              if (likely(__pyx_t_12)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
                __Pyx_INCREF(__pyx_t_12);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_15, function);
              }
            }
            if (!__pyx_t_12) {
              __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_v_response); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_GOTREF(__pyx_t_7);
            } else {
              __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12); __pyx_t_12 = NULL;
              __Pyx_INCREF(__pyx_v_response);
              __Pyx_GIVEREF(__pyx_v_response);
              PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_response);
              __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_14, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_GOTREF(__pyx_t_7);
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            }
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
          __pyx_L45:;

          /* "cassandra/cluster.py":3154
 *                     else:
 *                         self._set_final_exception(response)
 *                     return             # <<<<<<<<<<<<<<
 * 
 *                 retry_type, consistency = retry
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_r = Py_None; __Pyx_INCREF(Py_None);
          goto __pyx_L7_try_return;
        }
        __pyx_L24:;

        /* "cassandra/cluster.py":3156
 *                     return
 * 
 *                 retry_type, consistency = retry             # <<<<<<<<<<<<<<
 *                 if retry_type is RetryPolicy.RETRY:
 *                     self._query_retries += 1
 */
        if ((likely(PyTuple_CheckExact(__pyx_v_retry))) || (PyList_CheckExact(__pyx_v_retry))) {
          PyObject* sequence = __pyx_v_retry;
          #if CYTHON_COMPILING_IN_CPYTHON
          Py_ssize_t size = Py_SIZE(sequence);
          #else
          Py_ssize_t size = PySequence_Size(sequence);
          #endif
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
          #if CYTHON_COMPILING_IN_CPYTHON
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_15);
          #else
          __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          #endif
        } else {
          Py_ssize_t index = -1;
          __pyx_t_14 = PyObject_GetIter(__pyx_v_retry); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_23 = Py_TYPE(__pyx_t_14)->tp_iternext;
          index = 0; __pyx_t_7 = __pyx_t_23(__pyx_t_14); if (unlikely(!__pyx_t_7)) goto __pyx_L46_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_7);
          index = 1; __pyx_t_15 = __pyx_t_23(__pyx_t_14); if (unlikely(!__pyx_t_15)) goto __pyx_L46_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_15);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_23(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __pyx_t_23 = NULL;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          goto __pyx_L47_unpacking_done;
          __pyx_L46_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_23 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __pyx_L47_unpacking_done:;
        }
        __pyx_v_retry_type = __pyx_t_7;
        __pyx_t_7 = 0;
        __pyx_v_consistency = __pyx_t_15;
        __pyx_t_15 = 0;

        /* "cassandra/cluster.py":3157
 * 
 *                 retry_type, consistency = retry
 *                 if retry_type is RetryPolicy.RETRY:             # <<<<<<<<<<<<<<
 *                     self._query_retries += 1
 *                     self._retry(reuse_connection=True, consistency_level=consistency)
 */
        __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_RetryPolicy); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3157; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_RETRY); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3157; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_18 = (__pyx_v_retry_type == __pyx_t_7);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_6 = (__pyx_t_18 != 0);
        if (__pyx_t_6) {

          /* "cassandra/cluster.py":3158
 *                 retry_type, consistency = retry
 *                 if retry_type is RetryPolicy.RETRY:
 *                     self._query_retries += 1             # <<<<<<<<<<<<<<
 *                     self._retry(reuse_connection=True, consistency_level=consistency)
 *                 elif retry_type is RetryPolicy.RETHROW:
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query_retries); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3158; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_15 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3158; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_query_retries, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3158; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

          /* "cassandra/cluster.py":3159
 *                 if retry_type is RetryPolicy.RETRY:
 *                     self._query_retries += 1
 *                     self._retry(reuse_connection=True, consistency_level=consistency)             # <<<<<<<<<<<<<<
 *                 elif retry_type is RetryPolicy.RETHROW:
 *                     self._set_final_exception(response.to_exception())
 */
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_retry); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3159; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3159; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_reuse_connection, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3159; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_consistency_level, __pyx_v_consistency) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3159; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3159; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          goto __pyx_L48;
        }

        /* "cassandra/cluster.py":3160
 *                     self._query_retries += 1
 *                     self._retry(reuse_connection=True, consistency_level=consistency)
 *                 elif retry_type is RetryPolicy.RETHROW:             # <<<<<<<<<<<<<<
 *                     self._set_final_exception(response.to_exception())
 *                 else:  # IGNORE
 */
        __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_RetryPolicy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_RETHROW); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_6 = (__pyx_v_retry_type == __pyx_t_7);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_18 = (__pyx_t_6 != 0);
        if (__pyx_t_18) {

          /* "cassandra/cluster.py":3161
 *                     self._retry(reuse_connection=True, consistency_level=consistency)
 *                 elif retry_type is RetryPolicy.RETHROW:
 *                     self._set_final_exception(response.to_exception())             # <<<<<<<<<<<<<<
 *                 else:  # IGNORE
 *                     if self._metrics is not None:
 */
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3161; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_to_exception); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3161; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_12))) {
            __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
            if (likely(__pyx_t_13)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
              __Pyx_INCREF(__pyx_t_13);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_12, function);
            }
          }
          if (__pyx_t_13) {
            __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3161; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          } else {
            __pyx_t_15 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3161; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_14, function);
            }
          }
          if (!__pyx_t_12) {
            __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3161; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_GOTREF(__pyx_t_7);
          } else {
            __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3161; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
            __Pyx_GIVEREF(__pyx_t_15);
            PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_15);
            __pyx_t_15 = 0;
            __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_13, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3161; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          }
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L48;
        }
        /*else*/ {

          /* "cassandra/cluster.py":3163
 *                     self._set_final_exception(response.to_exception())
 *                 else:  # IGNORE
 *                     if self._metrics is not None:             # <<<<<<<<<<<<<<
 *                         self._metrics.on_ignore()
 *                     self._set_final_result(None)
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_18 = (__pyx_t_7 != Py_None);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_6 = (__pyx_t_18 != 0);
          if (__pyx_t_6) {

            /* "cassandra/cluster.py":3164
 *                 else:  # IGNORE
 *                     if self._metrics is not None:
 *                         self._metrics.on_ignore()             # <<<<<<<<<<<<<<
 *                     self._set_final_result(None)
 *             elif isinstance(response, ConnectionException):
 */
            __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3164; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_on_ignore); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3164; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __pyx_t_14 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_13))) {
              __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
              if (likely(__pyx_t_14)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
                __Pyx_INCREF(__pyx_t_14);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_13, function);
              }
            }
            if (__pyx_t_14) {
              __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3164; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            } else {
              __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_13); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3164; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            }
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            goto __pyx_L49;
          }
          __pyx_L49:;

          /* "cassandra/cluster.py":3165
 *                     if self._metrics is not None:
 *                         self._metrics.on_ignore()
 *                     self._set_final_result(None)             # <<<<<<<<<<<<<<
 *             elif isinstance(response, ConnectionException):
 *                 if self._metrics is not None:
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_result); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__147, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
        __pyx_L48:;
        goto __pyx_L16;
      }

      /* "cassandra/cluster.py":3166
 *                         self._metrics.on_ignore()
 *                     self._set_final_result(None)
 *             elif isinstance(response, ConnectionException):             # <<<<<<<<<<<<<<
 *                 if self._metrics is not None:
 *                     self._metrics.on_connection_error()
 */
      __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConnectionException); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_6 = PyObject_IsInstance(__pyx_v_response, __pyx_t_13); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_18 = (__pyx_t_6 != 0);
      if (__pyx_t_18) {

        /* "cassandra/cluster.py":3167
 *                     self._set_final_result(None)
 *             elif isinstance(response, ConnectionException):
 *                 if self._metrics is not None:             # <<<<<<<<<<<<<<
 *                     self._metrics.on_connection_error()
 *                 if not isinstance(response, ConnectionShutdown):
 */
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_18 = (__pyx_t_13 != Py_None);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_6 = (__pyx_t_18 != 0);
        if (__pyx_t_6) {

          /* "cassandra/cluster.py":3168
 *             elif isinstance(response, ConnectionException):
 *                 if self._metrics is not None:
 *                     self._metrics.on_connection_error()             # <<<<<<<<<<<<<<
 *                 if not isinstance(response, ConnectionShutdown):
 *                     self._connection.defunct(response)
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_on_connection_error); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_14);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_14, function);
            }
          }
          if (__pyx_t_7) {
            __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_7); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          } else {
            __pyx_t_13 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L50;
        }
        __pyx_L50:;

        /* "cassandra/cluster.py":3169
 *                 if self._metrics is not None:
 *                     self._metrics.on_connection_error()
 *                 if not isinstance(response, ConnectionShutdown):             # <<<<<<<<<<<<<<
 *                     self._connection.defunct(response)
 *                 self._retry(reuse_connection=False, consistency_level=None)
 */
        __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConnectionShutdown); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3169; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_6 = PyObject_IsInstance(__pyx_v_response, __pyx_t_13); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3169; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_18 = ((!(__pyx_t_6 != 0)) != 0);
        if (__pyx_t_18) {

          /* "cassandra/cluster.py":3170
 *                     self._metrics.on_connection_error()
 *                 if not isinstance(response, ConnectionShutdown):
 *                     self._connection.defunct(response)             # <<<<<<<<<<<<<<
 *                 self._retry(reuse_connection=False, consistency_level=None)
 *             elif isinstance(response, Exception):
 */
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_defunct); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
            }
          }
          if (!__pyx_t_14) {
            __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_response); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_13);
          } else {
            __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14); __pyx_t_14 = NULL;
            __Pyx_INCREF(__pyx_v_response);
            __Pyx_GIVEREF(__pyx_v_response);
            PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_response);
            __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_15, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          }
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L51;
        }
        __pyx_L51:;

        /* "cassandra/cluster.py":3171
 *                 if not isinstance(response, ConnectionShutdown):
 *                     self._connection.defunct(response)
 *                 self._retry(reuse_connection=False, consistency_level=None)             # <<<<<<<<<<<<<<
 *             elif isinstance(response, Exception):
 *                 if hasattr(response, 'to_exception'):
 */
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_retry); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3171; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3171; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_reuse_connection, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3171; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_consistency_level, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3171; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3171; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        goto __pyx_L16;
      }

      /* "cassandra/cluster.py":3172
 *                     self._connection.defunct(response)
 *                 self._retry(reuse_connection=False, consistency_level=None)
 *             elif isinstance(response, Exception):             # <<<<<<<<<<<<<<
 *                 if hasattr(response, 'to_exception'):
 *                     self._set_final_exception(response.to_exception())
 */
      __pyx_t_18 = PyObject_IsInstance(__pyx_v_response, __pyx_builtin_Exception); if (unlikely(__pyx_t_18 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3172; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_t_6 = (__pyx_t_18 != 0);
      if (__pyx_t_6) {

        /* "cassandra/cluster.py":3173
 *                 self._retry(reuse_connection=False, consistency_level=None)
 *             elif isinstance(response, Exception):
 *                 if hasattr(response, 'to_exception'):             # <<<<<<<<<<<<<<
 *                     self._set_final_exception(response.to_exception())
 *                 else:
 */
        __pyx_t_6 = PyObject_HasAttr(__pyx_v_response, __pyx_n_s_to_exception); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __pyx_t_18 = (__pyx_t_6 != 0);
        if (__pyx_t_18) {

          /* "cassandra/cluster.py":3174
 *             elif isinstance(response, Exception):
 *                 if hasattr(response, 'to_exception'):
 *                     self._set_final_exception(response.to_exception())             # <<<<<<<<<<<<<<
 *                 else:
 *                     self._set_final_exception(response)
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_to_exception); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_12 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_14, function);
            }
          }
          if (__pyx_t_12) {
            __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          } else {
            __pyx_t_13 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
            }
          }
          if (!__pyx_t_14) {
            __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_13); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_15);
          } else {
            __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_14); __pyx_t_14 = NULL;
            __Pyx_GIVEREF(__pyx_t_13);
            PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_13);
            __pyx_t_13 = 0;
            __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          }
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          goto __pyx_L52;
        }
        /*else*/ {

          /* "cassandra/cluster.py":3176
 *                     self._set_final_exception(response.to_exception())
 *                 else:
 *                     self._set_final_exception(response)             # <<<<<<<<<<<<<<
 *             else:
 *                 # we got some other kind of response message
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3176; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_12 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
            }
          }
          if (!__pyx_t_12) {
            __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_response); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3176; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
          } else {
            __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3176; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
            __Pyx_INCREF(__pyx_v_response);
            __Pyx_GIVEREF(__pyx_v_response);
            PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_response);
            __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_13, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3176; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          }
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        }
        __pyx_L52:;
        goto __pyx_L16;
      }
      /*else*/ {

        /* "cassandra/cluster.py":3179
 *             else:
 *                 # we got some other kind of response message
 *                 msg = "Got unexpected message: %r" % (response,)             # <<<<<<<<<<<<<<
 *                 exc = ConnectionException(msg, self._current_host)
 *                 self._connection.defunct(exc)
 */
        __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_INCREF(__pyx_v_response);
        __Pyx_GIVEREF(__pyx_v_response);
        PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_response);
        __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_Got_unexpected_message_r, __pyx_t_15); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_v_msg = ((PyObject*)__pyx_t_7);
        __pyx_t_7 = 0;

        /* "cassandra/cluster.py":3180
 *                 # we got some other kind of response message
 *                 msg = "Got unexpected message: %r" % (response,)
 *                 exc = ConnectionException(msg, self._current_host)             # <<<<<<<<<<<<<<
 *                 self._connection.defunct(exc)
 *                 self._set_final_exception(exc)
 */
        __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConnectionException); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_host); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_12 = NULL;
        __pyx_t_11 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_15);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_15, function);
            __pyx_t_11 = 1;
          }
        }
        __pyx_t_14 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_14);
        if (__pyx_t_12) {
          __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12); __pyx_t_12 = NULL;
        }
        __Pyx_INCREF(__pyx_v_msg);
        __Pyx_GIVEREF(__pyx_v_msg);
        PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_11, __pyx_v_msg);
        __Pyx_GIVEREF(__pyx_t_13);
        PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_11, __pyx_t_13);
        __pyx_t_13 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_14, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_v_exc = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "cassandra/cluster.py":3181
 *                 msg = "Got unexpected message: %r" % (response,)
 *                 exc = ConnectionException(msg, self._current_host)
 *                 self._connection.defunct(exc)             # <<<<<<<<<<<<<<
 *                 self._set_final_exception(exc)
 *         except Exception as exc:
 */
        __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_defunct); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_15)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
          }
        }
        if (!__pyx_t_15) {
          __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_exc); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
        } else {
          __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_15); __pyx_t_15 = NULL;
          __Pyx_INCREF(__pyx_v_exc);
          __Pyx_GIVEREF(__pyx_v_exc);
          PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_exc);
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_13, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "cassandra/cluster.py":3182
 *                 exc = ConnectionException(msg, self._current_host)
 *                 self._connection.defunct(exc)
 *                 self._set_final_exception(exc)             # <<<<<<<<<<<<<<
 *         except Exception as exc:
 *             # almost certainly caused by a bug, but we need to set something here
 */
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3182; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_13 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
          }
        }
        if (!__pyx_t_13) {
          __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_exc); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3182; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
        } else {
          __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3182; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL;
          __Pyx_INCREF(__pyx_v_exc);
          __Pyx_GIVEREF(__pyx_v_exc);
          PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_exc);
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_15, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3182; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        }
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __pyx_L16:;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "cassandra/cluster.py":3183
 *                 self._connection.defunct(exc)
 *                 self._set_final_exception(exc)
 *         except Exception as exc:             # <<<<<<<<<<<<<<
 *             # almost certainly caused by a bug, but we need to set something here
 *             log.exception("Unexpected exception while handling result in ResponseFuture:")
 */
    __pyx_t_22 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_22) {
      __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._set_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_14, &__pyx_t_15) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3183; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_XDECREF_SET(__pyx_v_exc, __pyx_t_14);

      /* "cassandra/cluster.py":3185
 *         except Exception as exc:
 *             # almost certainly caused by a bug, but we need to set something here
 *             log.exception("Unexpected exception while handling result in ResponseFuture:")             # <<<<<<<<<<<<<<
 *             self._set_final_exception(exc)
 * 
 */
      __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3185; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_exception); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3185; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__148, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3185; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

      /* "cassandra/cluster.py":3186
 *             # almost certainly caused by a bug, but we need to set something here
 *             log.exception("Unexpected exception while handling result in ResponseFuture:")
 *             self._set_final_exception(exc)             # <<<<<<<<<<<<<<
 * 
 *     def _set_keyspace_completed(self, errors):
 */
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3186; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_17 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_17)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_17);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      if (!__pyx_t_17) {
        __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_exc); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3186; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_13);
      } else {
        __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3186; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_17); __pyx_t_17 = NULL;
        __Pyx_INCREF(__pyx_v_exc);
        __Pyx_GIVEREF(__pyx_v_exc);
        PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_exc);
        __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_10, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3186; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "cassandra/cluster.py":3030
 *             self.send_request()
 * 
 *     def _set_result(self, response):             # <<<<<<<<<<<<<<
 *         try:
 *             if self._current_pool and self._connection:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._set_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_trace_id);
  __Pyx_XDECREF(__pyx_v_session);
  __Pyx_XDECREF(__pyx_v_results);
  __Pyx_XDECREF(__pyx_v_retry_policy);
  __Pyx_XDECREF(__pyx_v_retry);
  __Pyx_XDECREF(__pyx_v_query_id);
  __Pyx_XDECREF(__pyx_v_prepared_statement);
  __Pyx_XDECREF(__pyx_v_current_keyspace);
  __Pyx_XDECREF(__pyx_v_prepared_keyspace);
  __Pyx_XDECREF(__pyx_v_prepare_message);
  __Pyx_XDECREF(__pyx_v_retry_type);
  __Pyx_XDECREF(__pyx_v_consistency);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XDECREF(__pyx_v_exc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3188
 *             self._set_final_exception(exc)
 * 
 *     def _set_keyspace_completed(self, errors):             # <<<<<<<<<<<<<<
 *         if not errors:
 *             self._set_final_result(None)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_27_set_keyspace_completed(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_27_set_keyspace_completed = {"_set_keyspace_completed", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_27_set_keyspace_completed, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_27_set_keyspace_completed(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_errors = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_keyspace_completed (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_errors,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_errors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_keyspace_completed", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_set_keyspace_completed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_errors = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_set_keyspace_completed", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._set_keyspace_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_26_set_keyspace_completed(__pyx_self, __pyx_v_self, __pyx_v_errors);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_26_set_keyspace_completed(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_errors) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_keyspace_completed", 0);

  /* "cassandra/cluster.py":3189
 * 
 *     def _set_keyspace_completed(self, errors):
 *         if not errors:             # <<<<<<<<<<<<<<
 *             self._set_final_result(None)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_errors); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":3190
 *     def _set_keyspace_completed(self, errors):
 *         if not errors:
 *             self._set_final_result(None)             # <<<<<<<<<<<<<<
 *         else:
 *             self._set_final_exception(ConnectionException(
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__149, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cassandra/cluster.py":3192
 *             self._set_final_result(None)
 *         else:
 *             self._set_final_exception(ConnectionException(             # <<<<<<<<<<<<<<
 *                 "Failed to set keyspace on all hosts: %s" % (errors,)))
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConnectionException); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);

    /* "cassandra/cluster.py":3193
 *         else:
 *             self._set_final_exception(ConnectionException(
 *                 "Failed to set keyspace on all hosts: %s" % (errors,)))             # <<<<<<<<<<<<<<
 * 
 *     def _execute_after_prepare(self, response):
 */
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_errors);
    __Pyx_GIVEREF(__pyx_v_errors);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_errors);
    __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_Failed_to_set_keyspace_on_all_ho, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":3188
 *             self._set_final_exception(exc)
 * 
 *     def _set_keyspace_completed(self, errors):             # <<<<<<<<<<<<<<
 *         if not errors:
 *             self._set_final_result(None)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._set_keyspace_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3195
 *                 "Failed to set keyspace on all hosts: %s" % (errors,)))
 * 
 *     def _execute_after_prepare(self, response):             # <<<<<<<<<<<<<<
 *         """
 *         Handle the response to our attempt to prepare a statement.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_29_execute_after_prepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_14ResponseFuture_28_execute_after_prepare[] = "\n        Handle the response to our attempt to prepare a statement.\n        If it succeeded, run the original query again against the same host.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_29_execute_after_prepare = {"_execute_after_prepare", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_29_execute_after_prepare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_14ResponseFuture_28_execute_after_prepare};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_29_execute_after_prepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_response = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_execute_after_prepare (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_response,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_response)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_execute_after_prepare", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_execute_after_prepare") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_response = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_execute_after_prepare", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._execute_after_prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_28_execute_after_prepare(__pyx_self, __pyx_v_self, __pyx_v_response);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_28_execute_after_prepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_response) {
  PyObject *__pyx_v_request_id = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_execute_after_prepare", 0);

  /* "cassandra/cluster.py":3200
 *         If it succeeded, run the original query again against the same host.
 *         """
 *         if self._current_pool and self._connection:             # <<<<<<<<<<<<<<
 *             self._current_pool.return_connection(self._connection)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_pool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cassandra/cluster.py":3201
 *         """
 *         if self._current_pool and self._connection:
 *             self._current_pool.return_connection(self._connection)             # <<<<<<<<<<<<<<
 * 
 *         if self._final_exception:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_pool); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_return_connection); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_connection_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":3203
 *             self._current_pool.return_connection(self._connection)
 * 
 *         if self._final_exception:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_final_exception); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cassandra/cluster.py":3204
 * 
 *         if self._final_exception:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(response, ResultMessage):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":3206
 *             return
 * 
 *         if isinstance(response, ResultMessage):             # <<<<<<<<<<<<<<
 *             if response.kind == RESULT_KIND_PREPARED:
 *                 # use self._query to re-use the same host and
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ResultMessage); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_response, __pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":3207
 * 
 *         if isinstance(response, ResultMessage):
 *             if response.kind == RESULT_KIND_PREPARED:             # <<<<<<<<<<<<<<
 *                 # use self._query to re-use the same host and
 *                 # at the same time properly borrow the connection
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_kind); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_RESULT_KIND_PREPARED); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_3) {

      /* "cassandra/cluster.py":3210
 *                 # use self._query to re-use the same host and
 *                 # at the same time properly borrow the connection
 *                 request_id = self._query(self._current_host)             # <<<<<<<<<<<<<<
 *                 if request_id is None:
 *                     # this host errored out, move on to the next
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_host); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (!__pyx_t_4) {
        __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_request_id = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "cassandra/cluster.py":3211
 *                 # at the same time properly borrow the connection
 *                 request_id = self._query(self._current_host)
 *                 if request_id is None:             # <<<<<<<<<<<<<<
 *                     # this host errored out, move on to the next
 *                     self.send_request()
 */
      __pyx_t_3 = (__pyx_v_request_id == Py_None);
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "cassandra/cluster.py":3213
 *                 if request_id is None:
 *                     # this host errored out, move on to the next
 *                     self.send_request()             # <<<<<<<<<<<<<<
 *             else:
 *                 self._set_final_exception(ConnectionException(
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_send_request); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        if (__pyx_t_6) {
          __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else {
          __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L9;
      }
      __pyx_L9:;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "cassandra/cluster.py":3215
 *                     self.send_request()
 *             else:
 *                 self._set_final_exception(ConnectionException(             # <<<<<<<<<<<<<<
 *                     "Got unexpected response when preparing statement "
 *                     "on host %s: %s" % (self._current_host, response)))
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConnectionException); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);

      /* "cassandra/cluster.py":3217
 *                 self._set_final_exception(ConnectionException(
 *                     "Got unexpected response when preparing statement "
 *                     "on host %s: %s" % (self._current_host, response)))             # <<<<<<<<<<<<<<
 *         elif isinstance(response, ErrorMessage):
 *             if hasattr(response, 'to_exception'):
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_host); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_response);
      __Pyx_GIVEREF(__pyx_v_response);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_response);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Got_unexpected_response_when_pre_2, __pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_8) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_L8:;
    goto __pyx_L7;
  }

  /* "cassandra/cluster.py":3218
 *                     "Got unexpected response when preparing statement "
 *                     "on host %s: %s" % (self._current_host, response)))
 *         elif isinstance(response, ErrorMessage):             # <<<<<<<<<<<<<<
 *             if hasattr(response, 'to_exception'):
 *                 self._set_final_exception(response.to_exception())
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorMessage); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_response, __pyx_t_7); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":3219
 *                     "on host %s: %s" % (self._current_host, response)))
 *         elif isinstance(response, ErrorMessage):
 *             if hasattr(response, 'to_exception'):             # <<<<<<<<<<<<<<
 *                 self._set_final_exception(response.to_exception())
 *             else:
 */
    __pyx_t_3 = PyObject_HasAttr(__pyx_v_response, __pyx_n_s_to_exception); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = (__pyx_t_3 != 0);
    if (__pyx_t_1) {

      /* "cassandra/cluster.py":3220
 *         elif isinstance(response, ErrorMessage):
 *             if hasattr(response, 'to_exception'):
 *                 self._set_final_exception(response.to_exception())             # <<<<<<<<<<<<<<
 *             else:
 *                 self._set_final_exception(response)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_to_exception); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      if (__pyx_t_2) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L10;
    }
    /*else*/ {

      /* "cassandra/cluster.py":3222
 *                 self._set_final_exception(response.to_exception())
 *             else:
 *                 self._set_final_exception(response)             # <<<<<<<<<<<<<<
 *         elif isinstance(response, ConnectionException):
 *             log.debug("Connection error when preparing statement on host %s: %s",
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_response); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
      } else {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_INCREF(__pyx_v_response);
        __Pyx_GIVEREF(__pyx_v_response);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_response);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_L10:;
    goto __pyx_L7;
  }

  /* "cassandra/cluster.py":3223
 *             else:
 *                 self._set_final_exception(response)
 *         elif isinstance(response, ConnectionException):             # <<<<<<<<<<<<<<
 *             log.debug("Connection error when preparing statement on host %s: %s",
 *                       self._current_host, response)
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConnectionException); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_response, __pyx_t_7); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":3224
 *                 self._set_final_exception(response)
 *         elif isinstance(response, ConnectionException):
 *             log.debug("Connection error when preparing statement on host %s: %s",             # <<<<<<<<<<<<<<
 *                       self._current_host, response)
 *             # try again on a different host, preparing again if necessary
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":3225
 *         elif isinstance(response, ConnectionException):
 *             log.debug("Connection error when preparing statement on host %s: %s",
 *                       self._current_host, response)             # <<<<<<<<<<<<<<
 *             # try again on a different host, preparing again if necessary
 *             self._errors[self._current_host] = response
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_host); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_10 = 1;
      }
    }
    __pyx_t_6 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Connection_error_when_preparing);
    __Pyx_GIVEREF(__pyx_kp_s_Connection_error_when_preparing);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_10, __pyx_kp_s_Connection_error_when_preparing);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_10, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_response);
    __Pyx_GIVEREF(__pyx_v_response);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_10, __pyx_v_response);
    __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "cassandra/cluster.py":3227
 *                       self._current_host, response)
 *             # try again on a different host, preparing again if necessary
 *             self._errors[self._current_host] = response             # <<<<<<<<<<<<<<
 *             self.send_request()
 *         else:
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_errors_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_host); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (unlikely(PyObject_SetItem(__pyx_t_7, __pyx_t_9, __pyx_v_response) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "cassandra/cluster.py":3228
 *             # try again on a different host, preparing again if necessary
 *             self._errors[self._current_host] = response
 *             self.send_request()             # <<<<<<<<<<<<<<
 *         else:
 *             self._set_final_exception(ConnectionException(
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_send_request); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "cassandra/cluster.py":3230
 *             self.send_request()
 *         else:
 *             self._set_final_exception(ConnectionException(             # <<<<<<<<<<<<<<
 *                 "Got unexpected response type when preparing "
 *                 "statement on host %s: %s" % (self._current_host, response)))
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_final_exception); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConnectionException); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);

    /* "cassandra/cluster.py":3232
 *             self._set_final_exception(ConnectionException(
 *                 "Got unexpected response type when preparing "
 *                 "statement on host %s: %s" % (self._current_host, response)))             # <<<<<<<<<<<<<<
 * 
 *     def _set_final_result(self, response):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_host); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_INCREF(__pyx_v_response);
    __Pyx_GIVEREF(__pyx_v_response);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_response);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Got_unexpected_response_type_whe, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_9);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __pyx_L7:;

  /* "cassandra/cluster.py":3195
 *                 "Failed to set keyspace on all hosts: %s" % (errors,)))
 * 
 *     def _execute_after_prepare(self, response):             # <<<<<<<<<<<<<<
 *         """
 *         Handle the response to our attempt to prepare a statement.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._execute_after_prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_request_id);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3234
 *                 "statement on host %s: %s" % (self._current_host, response)))
 * 
 *     def _set_final_result(self, response):             # <<<<<<<<<<<<<<
 *         self._cancel_timer()
 *         if self._metrics is not None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_31_set_final_result(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_31_set_final_result = {"_set_final_result", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_31_set_final_result, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_31_set_final_result(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_response = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_final_result (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_response,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_response)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_final_result", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_set_final_result") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_response = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_set_final_result", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._set_final_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_30_set_final_result(__pyx_self, __pyx_v_self, __pyx_v_response);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_30_set_final_result(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_response) {
  PyObject *__pyx_v_callback = NULL;
  PyObject *__pyx_v_fn = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kwargs = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  Py_ssize_t __pyx_t_13;
  PyObject *(*__pyx_t_14)(PyObject *);
  PyObject *(*__pyx_t_15)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_final_result", 0);

  /* "cassandra/cluster.py":3235
 * 
 *     def _set_final_result(self, response):
 *         self._cancel_timer()             # <<<<<<<<<<<<<<
 *         if self._metrics is not None:
 *             self._metrics.request_timer.addValue(time.time() - self._start_time)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cancel_timer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3236
 *     def _set_final_result(self, response):
 *         self._cancel_timer()
 *         if self._metrics is not None:             # <<<<<<<<<<<<<<
 *             self._metrics.request_timer.addValue(time.time() - self._start_time)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":3237
 *         self._cancel_timer()
 *         if self._metrics is not None:
 *             self._metrics.request_timer.addValue(time.time() - self._start_time)             # <<<<<<<<<<<<<<
 * 
 *         with self._callback_lock:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_request_timer); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_addValue); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_time); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_start_time); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":3239
 *             self._metrics.request_timer.addValue(time.time() - self._start_time)
 * 
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             self._final_result = response
 * 
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_callback_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3239; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3239; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3239; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        /*try:*/ {

          /* "cassandra/cluster.py":3240
 * 
 *         with self._callback_lock:
 *             self._final_result = response             # <<<<<<<<<<<<<<
 * 
 *         self._event.set()
 */
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_final_result, __pyx_v_response) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3240; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        }
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L15_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":3239
 *             self._metrics.request_timer.addValue(time.time() - self._start_time)
 * 
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             self._final_result = response
 * 
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._set_final_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3239; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3239; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3239; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (__pyx_t_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3239; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __pyx_t_4 = ((!(__pyx_t_5 != 0)) != 0);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_2);
            __Pyx_XGIVEREF(__pyx_t_3);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
            __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3239; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L9_exception_handled;
        }
        __pyx_L10_except_error:;
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        goto __pyx_L1_error;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        __pyx_L15_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_8) {
          __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__150, NULL);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    goto __pyx_L19;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L1_error;
    __pyx_L19:;
  }

  /* "cassandra/cluster.py":3242
 *             self._final_result = response
 * 
 *         self._event.set()             # <<<<<<<<<<<<<<
 * 
 *         # apply each callback
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_event_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_set); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":3245
 * 
 *         # apply each callback
 *         for callback in self._callbacks:             # <<<<<<<<<<<<<<
 *             fn, args, kwargs = callback
 *             fn(response, *args, **kwargs)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_callbacks); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
  } else {
    __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_14)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_14(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_callback, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "cassandra/cluster.py":3246
 *         # apply each callback
 *         for callback in self._callbacks:
 *             fn, args, kwargs = callback             # <<<<<<<<<<<<<<
 *             fn(response, *args, **kwargs)
 * 
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_callback))) || (PyList_CheckExact(__pyx_v_callback))) {
      PyObject* sequence = __pyx_v_callback;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_v_callback); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_15 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_15(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_2 = __pyx_t_15(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 2; __pyx_t_6 = __pyx_t_15(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_7), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_15 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L23_unpacking_done;
      __pyx_L22_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_15 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L23_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_fn, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_args, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_kwargs, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "cassandra/cluster.py":3247
 *         for callback in self._callbacks:
 *             fn, args, kwargs = callback
 *             fn(response, *args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def _set_final_exception(self, response):
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_response);
    __Pyx_GIVEREF(__pyx_v_response);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_response);
    __pyx_t_2 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_v_kwargs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (likely(PyDict_Check(__pyx_v_kwargs))) {
      __pyx_t_2 = __pyx_v_kwargs;
      __Pyx_INCREF(__pyx_t_2);
    } else {
      __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_fn, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "cassandra/cluster.py":3245
 * 
 *         # apply each callback
 *         for callback in self._callbacks:             # <<<<<<<<<<<<<<
 *             fn, args, kwargs = callback
 *             fn(response, *args, **kwargs)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3234
 *                 "statement on host %s: %s" % (self._current_host, response)))
 * 
 *     def _set_final_result(self, response):             # <<<<<<<<<<<<<<
 *         self._cancel_timer()
 *         if self._metrics is not None:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._set_final_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_callback);
  __Pyx_XDECREF(__pyx_v_fn);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3249
 *             fn(response, *args, **kwargs)
 * 
 *     def _set_final_exception(self, response):             # <<<<<<<<<<<<<<
 *         self._cancel_timer()
 *         if self._metrics is not None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_33_set_final_exception(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_33_set_final_exception = {"_set_final_exception", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_33_set_final_exception, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_33_set_final_exception(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_response = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_final_exception (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_response,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_response)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_final_exception", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3249; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_set_final_exception") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3249; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_response = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_set_final_exception", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3249; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._set_final_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_32_set_final_exception(__pyx_self, __pyx_v_self, __pyx_v_response);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_32_set_final_exception(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_response) {
  PyObject *__pyx_v_errback = NULL;
  PyObject *__pyx_v_fn = NULL;
  PyObject *__pyx_v_args = NULL;
  PyObject *__pyx_v_kwargs = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  Py_ssize_t __pyx_t_13;
  PyObject *(*__pyx_t_14)(PyObject *);
  PyObject *(*__pyx_t_15)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_final_exception", 0);

  /* "cassandra/cluster.py":3250
 * 
 *     def _set_final_exception(self, response):
 *         self._cancel_timer()             # <<<<<<<<<<<<<<
 *         if self._metrics is not None:
 *             self._metrics.request_timer.addValue(time.time() - self._start_time)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cancel_timer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3251
 *     def _set_final_exception(self, response):
 *         self._cancel_timer()
 *         if self._metrics is not None:             # <<<<<<<<<<<<<<
 *             self._metrics.request_timer.addValue(time.time() - self._start_time)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "cassandra/cluster.py":3252
 *         self._cancel_timer()
 *         if self._metrics is not None:
 *             self._metrics.request_timer.addValue(time.time() - self._start_time)             # <<<<<<<<<<<<<<
 * 
 *         with self._callback_lock:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_request_timer); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_addValue); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_time); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_start_time); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":3254
 *             self._metrics.request_timer.addValue(time.time() - self._start_time)
 * 
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             self._final_exception = response
 *         self._event.set()
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_callback_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3254; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3254; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3254; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        /*try:*/ {

          /* "cassandra/cluster.py":3255
 * 
 *         with self._callback_lock:
 *             self._final_exception = response             # <<<<<<<<<<<<<<
 *         self._event.set()
 * 
 */
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_final_exception, __pyx_v_response) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3255; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        }
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L15_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":3254
 *             self._metrics.request_timer.addValue(time.time() - self._start_time)
 * 
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             self._final_exception = response
 *         self._event.set()
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._set_final_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3254; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3254; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3254; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (__pyx_t_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3254; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __pyx_t_4 = ((!(__pyx_t_5 != 0)) != 0);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_2);
            __Pyx_XGIVEREF(__pyx_t_3);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
            __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3254; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L9_exception_handled;
        }
        __pyx_L10_except_error:;
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        goto __pyx_L1_error;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        __pyx_L15_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_8) {
          __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__151, NULL);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    goto __pyx_L19;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L1_error;
    __pyx_L19:;
  }

  /* "cassandra/cluster.py":3256
 *         with self._callback_lock:
 *             self._final_exception = response
 *         self._event.set()             # <<<<<<<<<<<<<<
 * 
 *         for errback in self._errbacks:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_event_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_set); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":3258
 *         self._event.set()
 * 
 *         for errback in self._errbacks:             # <<<<<<<<<<<<<<
 *             fn, args, kwargs = errback
 *             fn(response, *args, **kwargs)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_errbacks); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
  } else {
    __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_14)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_14(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_errback, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "cassandra/cluster.py":3259
 * 
 *         for errback in self._errbacks:
 *             fn, args, kwargs = errback             # <<<<<<<<<<<<<<
 *             fn(response, *args, **kwargs)
 * 
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_errback))) || (PyList_CheckExact(__pyx_v_errback))) {
      PyObject* sequence = __pyx_v_errback;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_v_errback); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_15 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_15(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_2 = __pyx_t_15(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 2; __pyx_t_6 = __pyx_t_15(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_7), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_15 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L23_unpacking_done;
      __pyx_L22_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_15 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L23_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_fn, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_args, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_kwargs, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "cassandra/cluster.py":3260
 *         for errback in self._errbacks:
 *             fn, args, kwargs = errback
 *             fn(response, *args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def _retry(self, reuse_connection, consistency_level):
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_response);
    __Pyx_GIVEREF(__pyx_v_response);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_response);
    __pyx_t_2 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_v_kwargs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (likely(PyDict_Check(__pyx_v_kwargs))) {
      __pyx_t_2 = __pyx_v_kwargs;
      __Pyx_INCREF(__pyx_t_2);
    } else {
      __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_fn, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "cassandra/cluster.py":3258
 *         self._event.set()
 * 
 *         for errback in self._errbacks:             # <<<<<<<<<<<<<<
 *             fn, args, kwargs = errback
 *             fn(response, *args, **kwargs)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3249
 *             fn(response, *args, **kwargs)
 * 
 *     def _set_final_exception(self, response):             # <<<<<<<<<<<<<<
 *         self._cancel_timer()
 *         if self._metrics is not None:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._set_final_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_errback);
  __Pyx_XDECREF(__pyx_v_fn);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3262
 *             fn(response, *args, **kwargs)
 * 
 *     def _retry(self, reuse_connection, consistency_level):             # <<<<<<<<<<<<<<
 *         if self._final_exception:
 *             # the connection probably broke while we were waiting
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_35_retry(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_35_retry = {"_retry", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_35_retry, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_35_retry(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_reuse_connection = 0;
  PyObject *__pyx_v_consistency_level = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_retry (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_reuse_connection,&__pyx_n_s_consistency_level,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reuse_connection)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_retry", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3262; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_consistency_level)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_retry", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3262; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_retry") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3262; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_reuse_connection = values[1];
    __pyx_v_consistency_level = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_retry", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3262; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._retry", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_34_retry(__pyx_self, __pyx_v_self, __pyx_v_reuse_connection, __pyx_v_consistency_level);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_34_retry(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_reuse_connection, PyObject *__pyx_v_consistency_level) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_retry", 0);

  /* "cassandra/cluster.py":3263
 * 
 *     def _retry(self, reuse_connection, consistency_level):
 *         if self._final_exception:             # <<<<<<<<<<<<<<
 *             # the connection probably broke while we were waiting
 *             # to retry the operation
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_final_exception); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":3266
 *             # the connection probably broke while we were waiting
 *             # to retry the operation
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if self._metrics is not None:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":3268
 *             return
 * 
 *         if self._metrics is not None:             # <<<<<<<<<<<<<<
 *             self._metrics.on_retry()
 *         if consistency_level is not None:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":3269
 * 
 *         if self._metrics is not None:
 *             self._metrics.on_retry()             # <<<<<<<<<<<<<<
 *         if consistency_level is not None:
 *             self.message.consistency_level = consistency_level
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metrics_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_on_retry); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cassandra/cluster.py":3270
 *         if self._metrics is not None:
 *             self._metrics.on_retry()
 *         if consistency_level is not None:             # <<<<<<<<<<<<<<
 *             self.message.consistency_level = consistency_level
 * 
 */
  __pyx_t_3 = (__pyx_v_consistency_level != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":3271
 *             self._metrics.on_retry()
 *         if consistency_level is not None:
 *             self.message.consistency_level = consistency_level             # <<<<<<<<<<<<<<
 * 
 *         # don't retry on the event loop thread
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_1, __pyx_n_s_consistency_level, __pyx_v_consistency_level) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "cassandra/cluster.py":3274
 * 
 *         # don't retry on the event loop thread
 *         self.session.submit(self._retry_task, reuse_connection)             # <<<<<<<<<<<<<<
 * 
 *     def _retry_task(self, reuse_connection):
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_submit); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_retry_task); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (__pyx_t_6) {
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_reuse_connection);
  __Pyx_GIVEREF(__pyx_v_reuse_connection);
  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_reuse_connection);
  __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3262
 *             fn(response, *args, **kwargs)
 * 
 *     def _retry(self, reuse_connection, consistency_level):             # <<<<<<<<<<<<<<
 *         if self._final_exception:
 *             # the connection probably broke while we were waiting
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._retry", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3276
 *         self.session.submit(self._retry_task, reuse_connection)
 * 
 *     def _retry_task(self, reuse_connection):             # <<<<<<<<<<<<<<
 *         if self._final_exception:
 *             # the connection probably broke while we were waiting
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_37_retry_task(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_37_retry_task = {"_retry_task", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_37_retry_task, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_37_retry_task(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_reuse_connection = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_retry_task (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_reuse_connection,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reuse_connection)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_retry_task", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_retry_task") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_reuse_connection = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_retry_task", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._retry_task", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_36_retry_task(__pyx_self, __pyx_v_self, __pyx_v_reuse_connection);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_36_retry_task(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_reuse_connection) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_retry_task", 0);

  /* "cassandra/cluster.py":3277
 * 
 *     def _retry_task(self, reuse_connection):
 *         if self._final_exception:             # <<<<<<<<<<<<<<
 *             # the connection probably broke while we were waiting
 *             # to retry the operation
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_final_exception); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":3280
 *             # the connection probably broke while we were waiting
 *             # to retry the operation
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if reuse_connection and self._query(self._current_host) is not None:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":3282
 *             return
 * 
 *         if reuse_connection and self._query(self._current_host) is not None:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_reuse_connection); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_host); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = (__pyx_t_3 != 0);
  __pyx_t_2 = __pyx_t_8;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":3283
 * 
 *         if reuse_connection and self._query(self._current_host) is not None:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         # otherwise, move onto another host
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":3286
 * 
 *         # otherwise, move onto another host
 *         self.send_request()             # <<<<<<<<<<<<<<
 * 
 *     def result(self, timeout=_NOT_SET):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_send_request); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_7) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3276
 *         self.session.submit(self._retry_task, reuse_connection)
 * 
 *     def _retry_task(self, reuse_connection):             # <<<<<<<<<<<<<<
 *         if self._final_exception:
 *             # the connection probably broke while we were waiting
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture._retry_task", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3288
 *         self.send_request()
 * 
 *     def result(self, timeout=_NOT_SET):             # <<<<<<<<<<<<<<
 *         """
 *         Return the final result or raise an Exception if errors were
 */

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_52__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__defaults__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self)->__pyx_arg_timeout);
  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self)->__pyx_arg_timeout);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self)->__pyx_arg_timeout);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_39result(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_14ResponseFuture_38result[] = "\n        Return the final result or raise an Exception if errors were\n        encountered.  If the final result or error has not been set\n        yet, this method will block until that time.\n\n        .. versionchanged:: 2.6.0\n\n        **`timeout` is deprecated. Use timeout in the Session execute functions instead.\n        The following description applies to deprecated behavior:**\n\n        You may set a timeout (in seconds) with the `timeout` parameter.\n        By default, the :attr:`~.default_timeout` for the :class:`.Session`\n        this was created through will be used for the timeout on this\n        operation.\n\n        This timeout applies to the entire request, including any retries\n        (decided internally by the :class:`.policies.RetryPolicy` used with\n        the request).\n\n        If the timeout is exceeded, an :exc:`cassandra.OperationTimedOut` will be raised.\n        This is a client-side timeout. For more information\n        about server-side coordinator timeouts, see :class:`.policies.RetryPolicy`.\n\n        Example usage::\n\n            >>> future = session.execute_async(\"SELECT * FROM mycf\")\n            >>> # do other stuff...\n\n            >>> try:\n            ...     rows = future.result()\n            ...     for row in rows:\n            ...         ... # process results\n            ... except Exception:\n            ...     log.exception(\"Operation failed:\")\n\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_39result = {"result", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_39result, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_14ResponseFuture_38result};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_39result(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_timeout = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("result (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_timeout,0};
    PyObject* values[2] = {0,0};
    __pyx_defaults3 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self);
    values[1] = __pyx_dynamic_args->__pyx_arg_timeout;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "result") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3288; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_timeout = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("result", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3288; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_38result(__pyx_self, __pyx_v_self, __pyx_v_timeout);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_38result(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("result", 0);
  __Pyx_INCREF(__pyx_v_timeout);

  /* "cassandra/cluster.py":3325
 * 
 *         """
 *         if timeout is not _NOT_SET:             # <<<<<<<<<<<<<<
 *             msg = "ResponseFuture.result timeout argument is deprecated. Specify the request timeout via Session.execute[_async]."
 *             warnings.warn(msg, DeprecationWarning)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOT_SET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_v_timeout != __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":3326
 *         """
 *         if timeout is not _NOT_SET:
 *             msg = "ResponseFuture.result timeout argument is deprecated. Specify the request timeout via Session.execute[_async]."             # <<<<<<<<<<<<<<
 *             warnings.warn(msg, DeprecationWarning)
 *             log.warning(msg)
 */
    __Pyx_INCREF(__pyx_kp_s_ResponseFuture_result_timeout_ar);
    __pyx_v_msg = __pyx_kp_s_ResponseFuture_result_timeout_ar;

    /* "cassandra/cluster.py":3327
 *         if timeout is not _NOT_SET:
 *             msg = "ResponseFuture.result timeout argument is deprecated. Specify the request timeout via Session.execute[_async]."
 *             warnings.warn(msg, DeprecationWarning)             # <<<<<<<<<<<<<<
 *             log.warning(msg)
 *         else:
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_warnings); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_warn); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_msg);
    __Pyx_GIVEREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_msg);
    __Pyx_INCREF(__pyx_builtin_DeprecationWarning);
    __Pyx_GIVEREF(__pyx_builtin_DeprecationWarning);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_builtin_DeprecationWarning);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":3328
 *             msg = "ResponseFuture.result timeout argument is deprecated. Specify the request timeout via Session.execute[_async]."
 *             warnings.warn(msg, DeprecationWarning)
 *             log.warning(msg)             # <<<<<<<<<<<<<<
 *         else:
 *             timeout = None
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_warning); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_msg);
      __Pyx_GIVEREF(__pyx_v_msg);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_msg);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cassandra/cluster.py":3330
 *             log.warning(msg)
 *         else:
 *             timeout = None             # <<<<<<<<<<<<<<
 * 
 *         self._event.wait(timeout)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_timeout, Py_None);
  }
  __pyx_L3:;

  /* "cassandra/cluster.py":3332
 *             timeout = None
 * 
 *         self._event.wait(timeout)             # <<<<<<<<<<<<<<
 *         # TODO: remove this conditional when deprecated timeout parameter is removed
 *         if not self._event.is_set():
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_event_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_wait); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_timeout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_v_timeout);
    __Pyx_GIVEREF(__pyx_v_timeout);
    PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_timeout);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3334
 *         self._event.wait(timeout)
 *         # TODO: remove this conditional when deprecated timeout parameter is removed
 *         if not self._event.is_set():             # <<<<<<<<<<<<<<
 *             self._on_timeout()
 *         if self._final_result is not _NOT_SET:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_event_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_is_set); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = ((!__pyx_t_3) != 0);
  if (__pyx_t_2) {

    /* "cassandra/cluster.py":3335
 *         # TODO: remove this conditional when deprecated timeout parameter is removed
 *         if not self._event.is_set():
 *             self._on_timeout()             # <<<<<<<<<<<<<<
 *         if self._final_result is not _NOT_SET:
 *             if self._paging_state is None:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_timeout); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cassandra/cluster.py":3336
 *         if not self._event.is_set():
 *             self._on_timeout()
 *         if self._final_result is not _NOT_SET:             # <<<<<<<<<<<<<<
 *             if self._paging_state is None:
 *                 return self._final_result
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_final_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOT_SET); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = (__pyx_t_1 != __pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":3337
 *             self._on_timeout()
 *         if self._final_result is not _NOT_SET:
 *             if self._paging_state is None:             # <<<<<<<<<<<<<<
 *                 return self._final_result
 *             else:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_paging_state); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = (__pyx_t_5 == Py_None);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "cassandra/cluster.py":3338
 *         if self._final_result is not _NOT_SET:
 *             if self._paging_state is None:
 *                 return self._final_result             # <<<<<<<<<<<<<<
 *             else:
 *                 return PagedResult(self, self._final_result)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_final_result); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "cassandra/cluster.py":3340
 *                 return self._final_result
 *             else:
 *                 return PagedResult(self, self._final_result)             # <<<<<<<<<<<<<<
 *         else:
 *             raise self._final_exception
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_PagedResult); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_final_result); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_6 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_6, __pyx_v_self);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_6, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
    }
  }
  /*else*/ {

    /* "cassandra/cluster.py":3342
 *                 return PagedResult(self, self._final_result)
 *         else:
 *             raise self._final_exception             # <<<<<<<<<<<<<<
 * 
 *     def get_query_trace(self, max_wait=None):
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_final_exception); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cassandra/cluster.py":3288
 *         self.send_request()
 * 
 *     def result(self, timeout=_NOT_SET):             # <<<<<<<<<<<<<<
 *         """
 *         Return the final result or raise an Exception if errors were
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XDECREF(__pyx_v_timeout);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3344
 *             raise self._final_exception
 * 
 *     def get_query_trace(self, max_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the :class:`~.query.QueryTrace` instance representing a trace
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_41get_query_trace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_14ResponseFuture_40get_query_trace[] = "\n        Returns the :class:`~.query.QueryTrace` instance representing a trace\n        of the last attempt for this operation, or :const:`None` if tracing was\n        not enabled for this query.  Note that this may raise an exception if\n        there are problems retrieving the trace details from Cassandra. If the\n        trace is not available after `max_wait` seconds,\n        :exc:`cassandra.query.TraceUnavailable` will be raised.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_41get_query_trace = {"get_query_trace", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_41get_query_trace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_14ResponseFuture_40get_query_trace};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_41get_query_trace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_max_wait = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_query_trace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_max_wait,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_wait);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_query_trace") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_max_wait = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_query_trace", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.get_query_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_40get_query_trace(__pyx_self, __pyx_v_self, __pyx_v_max_wait);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_40get_query_trace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_max_wait) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_query_trace", 0);

  /* "cassandra/cluster.py":3353
 *         :exc:`cassandra.query.TraceUnavailable` will be raised.
 *         """
 *         if not self._query_trace:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query_trace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "cassandra/cluster.py":3354
 *         """
 *         if not self._query_trace:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         self._query_trace.populate(max_wait)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "cassandra/cluster.py":3356
 *             return None
 * 
 *         self._query_trace.populate(max_wait)             # <<<<<<<<<<<<<<
 *         return self._query_trace
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query_trace); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_populate); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_max_wait); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_max_wait);
    __Pyx_GIVEREF(__pyx_v_max_wait);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_max_wait);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3357
 * 
 *         self._query_trace.populate(max_wait)
 *         return self._query_trace             # <<<<<<<<<<<<<<
 * 
 *     def add_callback(self, fn, *args, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query_trace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":3344
 *             raise self._final_exception
 * 
 *     def get_query_trace(self, max_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the :class:`~.query.QueryTrace` instance representing a trace
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.get_query_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3359
 *         return self._query_trace
 * 
 *     def add_callback(self, fn, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Attaches a callback function to be called when the final results arrive.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_43add_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_14ResponseFuture_42add_callback[] = "\n        Attaches a callback function to be called when the final results arrive.\n\n        By default, `fn` will be called with the results as the first and only\n        argument.  If `*args` or `**kwargs` are supplied, they will be passed\n        through as additional positional or keyword arguments to `fn`.\n\n        If an error is hit while executing the operation, a callback attached\n        here will not be called.  Use :meth:`.add_errback()` or :meth:`add_callbacks()`\n        if you wish to handle that case.\n\n        If the final result has already been seen when this method is called,\n        the callback will be called immediately (before this method returns).\n\n        Note: in the case that the result is not available when the callback is added,\n        the callback is executed by IO event thread. This means that the callback\n        should not block or attempt further synchronous requests, because no further\n        IO will be processed until the callback returns.\n\n        **Important**: if the callback you attach results in an exception being\n        raised, **the exception will be ignored**, so please ensure your\n        callback handles all error cases that you care about.\n\n        Usage example::\n\n            >>> session = cluster.connect(\"mykeyspace\")\n\n            >>> def handle_results(rows, start_time, should_log=False):\n            ...     if should_log:\n            ...         log.info(\"Total time: %f\", time.time() - start_time)\n            ...     ...\n\n            >>> future = session.execute_async(\"SELECT * FROM users\")\n            >>> future.add_callback(handle_results, time.time(), should_log=True)\n\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_43add_callback = {"add_callback", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_43add_callback, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_14ResponseFuture_42add_callback};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_43add_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_fn = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_callback (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_fn,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_callback", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "add_callback") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_fn = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_callback", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.add_callback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_42add_callback(__pyx_self, __pyx_v_self, __pyx_v_fn, __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_42add_callback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fn, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  int __pyx_v_run_now;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_callback", 0);

  /* "cassandra/cluster.py":3396
 * 
 *         """
 *         run_now = False             # <<<<<<<<<<<<<<
 *         with self._callback_lock:
 *             if self._final_result is not _NOT_SET:
 */
  __pyx_v_run_now = 0;

  /* "cassandra/cluster.py":3397
 *         """
 *         run_now = False
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             if self._final_result is not _NOT_SET:
 *                 run_now = True
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_callback_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cassandra/cluster.py":3398
 *         run_now = False
 *         with self._callback_lock:
 *             if self._final_result is not _NOT_SET:             # <<<<<<<<<<<<<<
 *                 run_now = True
 *             else:
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_final_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3398; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOT_SET); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3398; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_9 = (__pyx_t_1 != __pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_10 = (__pyx_t_9 != 0);
          if (__pyx_t_10) {

            /* "cassandra/cluster.py":3399
 *         with self._callback_lock:
 *             if self._final_result is not _NOT_SET:
 *                 run_now = True             # <<<<<<<<<<<<<<
 *             else:
 *                 self._callbacks.append((fn, args, kwargs))
 */
            __pyx_v_run_now = 1;
            goto __pyx_L15;
          }
          /*else*/ {

            /* "cassandra/cluster.py":3401
 *                 run_now = True
 *             else:
 *                 self._callbacks.append((fn, args, kwargs))             # <<<<<<<<<<<<<<
 *         if run_now:
 *             fn(self._final_result, *args, **kwargs)
 */
            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_callbacks); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3401; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3401; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_INCREF(__pyx_v_fn);
            __Pyx_GIVEREF(__pyx_v_fn);
            PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fn);
            __Pyx_INCREF(__pyx_v_args);
            __Pyx_GIVEREF(__pyx_v_args);
            PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_args);
            __Pyx_INCREF(__pyx_v_kwargs);
            __Pyx_GIVEREF(__pyx_v_kwargs);
            PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_kwargs);
            __pyx_t_11 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_t_1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3401; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          }
          __pyx_L15:;
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":3397
 *         """
 *         run_now = False
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             if self._final_result is not _NOT_SET:
 *                 run_now = True
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.add_callback", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_9 = ((!(__pyx_t_10 != 0)) != 0);
          if (__pyx_t_9) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_4);
            __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__152, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L19;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L19:;
  }

  /* "cassandra/cluster.py":3402
 *             else:
 *                 self._callbacks.append((fn, args, kwargs))
 *         if run_now:             # <<<<<<<<<<<<<<
 *             fn(self._final_result, *args, **kwargs)
 *         return self
 */
  __pyx_t_9 = (__pyx_v_run_now != 0);
  if (__pyx_t_9) {

    /* "cassandra/cluster.py":3403
 *                 self._callbacks.append((fn, args, kwargs))
 *         if run_now:
 *             fn(self._final_result, *args, **kwargs)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_final_result); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __pyx_v_kwargs;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_fn, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L20;
  }
  __pyx_L20:;

  /* "cassandra/cluster.py":3404
 *         if run_now:
 *             fn(self._final_result, *args, **kwargs)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def add_errback(self, fn, *args, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "cassandra/cluster.py":3359
 *         return self._query_trace
 * 
 *     def add_callback(self, fn, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Attaches a callback function to be called when the final results arrive.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.add_callback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3406
 *         return self
 * 
 *     def add_errback(self, fn, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Like :meth:`.add_callback()`, but handles error cases.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_45add_errback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_14ResponseFuture_44add_errback[] = "\n        Like :meth:`.add_callback()`, but handles error cases.\n        An Exception instance will be passed as the first positional argument\n        to `fn`.\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_45add_errback = {"add_errback", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_45add_errback, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_14ResponseFuture_44add_errback};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_45add_errback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_fn = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_errback (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_fn,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_errback", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3406; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "add_errback") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3406; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_fn = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_errback", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3406; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.add_errback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_44add_errback(__pyx_self, __pyx_v_self, __pyx_v_fn, __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_44add_errback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fn, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  int __pyx_v_run_now;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_errback", 0);

  /* "cassandra/cluster.py":3412
 *         to `fn`.
 *         """
 *         run_now = False             # <<<<<<<<<<<<<<
 *         with self._callback_lock:
 *             if self._final_exception:
 */
  __pyx_v_run_now = 0;

  /* "cassandra/cluster.py":3413
 *         """
 *         run_now = False
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             if self._final_exception:
 *                 run_now = True
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_callback_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3413; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3413; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3413; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cassandra/cluster.py":3414
 *         run_now = False
 *         with self._callback_lock:
 *             if self._final_exception:             # <<<<<<<<<<<<<<
 *                 run_now = True
 *             else:
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_final_exception); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3414; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3414; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_9) {

            /* "cassandra/cluster.py":3415
 *         with self._callback_lock:
 *             if self._final_exception:
 *                 run_now = True             # <<<<<<<<<<<<<<
 *             else:
 *                 self._errbacks.append((fn, args, kwargs))
 */
            __pyx_v_run_now = 1;
            goto __pyx_L15;
          }
          /*else*/ {

            /* "cassandra/cluster.py":3417
 *                 run_now = True
 *             else:
 *                 self._errbacks.append((fn, args, kwargs))             # <<<<<<<<<<<<<<
 *         if run_now:
 *             fn(self._final_exception, *args, **kwargs)
 */
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_errbacks); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3417; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3417; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_INCREF(__pyx_v_fn);
            __Pyx_GIVEREF(__pyx_v_fn);
            PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fn);
            __Pyx_INCREF(__pyx_v_args);
            __Pyx_GIVEREF(__pyx_v_args);
            PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_args);
            __Pyx_INCREF(__pyx_v_kwargs);
            __Pyx_GIVEREF(__pyx_v_kwargs);
            PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_kwargs);
            __pyx_t_10 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_t_3); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3417; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          }
          __pyx_L15:;
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "cassandra/cluster.py":3413
 *         """
 *         run_now = False
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             if self._final_exception:
 *                 run_now = True
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.add_errback", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3413; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3413; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3413; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (__pyx_t_9 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3413; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_12 = ((!(__pyx_t_9 != 0)) != 0);
          if (__pyx_t_12) {
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestore(__pyx_t_3, __pyx_t_1, __pyx_t_4);
            __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3413; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__153, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L19;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L19:;
  }

  /* "cassandra/cluster.py":3418
 *             else:
 *                 self._errbacks.append((fn, args, kwargs))
 *         if run_now:             # <<<<<<<<<<<<<<
 *             fn(self._final_exception, *args, **kwargs)
 *         return self
 */
  __pyx_t_12 = (__pyx_v_run_now != 0);
  if (__pyx_t_12) {

    /* "cassandra/cluster.py":3419
 *                 self._errbacks.append((fn, args, kwargs))
 *         if run_now:
 *             fn(self._final_exception, *args, **kwargs)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_final_exception); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __pyx_v_kwargs;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_fn, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L20;
  }
  __pyx_L20:;

  /* "cassandra/cluster.py":3420
 *         if run_now:
 *             fn(self._final_exception, *args, **kwargs)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def add_callbacks(self, callback, errback,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "cassandra/cluster.py":3406
 *         return self
 * 
 *     def add_errback(self, fn, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Like :meth:`.add_callback()`, but handles error cases.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.add_errback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3422
 *         return self
 * 
 *     def add_callbacks(self, callback, errback,             # <<<<<<<<<<<<<<
 *                       callback_args=(), callback_kwargs=None,
 *                       errback_args=(), errback_kwargs=None):
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_47add_callbacks(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9cassandra_7cluster_14ResponseFuture_46add_callbacks[] = "\n        A convenient combination of :meth:`.add_callback()` and\n        :meth:`.add_errback()`.\n\n        Example usage::\n\n            >>> session = cluster.connect()\n            >>> query = \"SELECT * FROM mycf\"\n            >>> future = session.execute_async(query)\n\n            >>> def log_results(results, level='debug'):\n            ...     for row in results:\n            ...         log.log(level, \"Result: %s\", row)\n\n            >>> def log_error(exc, query):\n            ...     log.error(\"Query '%s' failed: %s\", query, exc)\n\n            >>> future.add_callbacks(\n            ...     callback=log_results, callback_kwargs={'level': 'info'},\n            ...     errback=log_error, errback_args=(query,))\n\n        ";
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_47add_callbacks = {"add_callbacks", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_47add_callbacks, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9cassandra_7cluster_14ResponseFuture_46add_callbacks};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_47add_callbacks(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_callback = 0;
  PyObject *__pyx_v_errback = 0;
  PyObject *__pyx_v_callback_args = 0;
  PyObject *__pyx_v_callback_kwargs = 0;
  PyObject *__pyx_v_errback_args = 0;
  PyObject *__pyx_v_errback_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_callbacks (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_callback,&__pyx_n_s_errback,&__pyx_n_s_callback_args,&__pyx_n_s_callback_kwargs,&__pyx_n_s_errback_args,&__pyx_n_s_errback_kwargs,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};

    /* "cassandra/cluster.py":3423
 * 
 *     def add_callbacks(self, callback, errback,
 *                       callback_args=(), callback_kwargs=None,             # <<<<<<<<<<<<<<
 *                       errback_args=(), errback_kwargs=None):
 *         """
 */
    values[3] = ((PyObject *)((PyObject*)__pyx_empty_tuple));
    values[4] = ((PyObject *)((PyObject *)Py_None));

    /* "cassandra/cluster.py":3424
 *     def add_callbacks(self, callback, errback,
 *                       callback_args=(), callback_kwargs=None,
 *                       errback_args=(), errback_kwargs=None):             # <<<<<<<<<<<<<<
 *         """
 *         A convenient combination of :meth:`.add_callback()` and
 */
    values[5] = ((PyObject *)((PyObject*)__pyx_empty_tuple));
    values[6] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_callbacks", 0, 3, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3422; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_errback)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_callbacks", 0, 3, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3422; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_callback_args);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_callback_kwargs);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_errback_args);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_errback_kwargs);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_callbacks") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3422; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_callback = values[1];
    __pyx_v_errback = values[2];
    __pyx_v_callback_args = values[3];
    __pyx_v_callback_kwargs = values[4];
    __pyx_v_errback_args = values[5];
    __pyx_v_errback_kwargs = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_callbacks", 0, 3, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3422; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.add_callbacks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_46add_callbacks(__pyx_self, __pyx_v_self, __pyx_v_callback, __pyx_v_errback, __pyx_v_callback_args, __pyx_v_callback_kwargs, __pyx_v_errback_args, __pyx_v_errback_kwargs);

  /* "cassandra/cluster.py":3422
 *         return self
 * 
 *     def add_callbacks(self, callback, errback,             # <<<<<<<<<<<<<<
 *                       callback_args=(), callback_kwargs=None,
 *                       errback_args=(), errback_kwargs=None):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_46add_callbacks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_errback, PyObject *__pyx_v_callback_args, PyObject *__pyx_v_callback_kwargs, PyObject *__pyx_v_errback_args, PyObject *__pyx_v_errback_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_callbacks", 0);

  /* "cassandra/cluster.py":3447
 * 
 *         """
 *         self.add_callback(callback, *callback_args, **(callback_kwargs or {}))             # <<<<<<<<<<<<<<
 *         self.add_errback(errback, *errback_args, **(errback_kwargs or {}))
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_add_callback); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_callback);
  __Pyx_GIVEREF(__pyx_v_callback);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_callback);
  __pyx_t_3 = PySequence_Tuple(__pyx_v_callback_args); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_callback_kwargs); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_5) {
  } else {
    __Pyx_INCREF(__pyx_v_callback_kwargs);
    __pyx_t_2 = __pyx_v_callback_kwargs;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_2 = __pyx_t_6;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_L3_bool_binop_done:;
  if (unlikely(__pyx_t_2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (likely(PyDict_Check(__pyx_t_2))) {
    __pyx_t_3 = __pyx_t_2;
    __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":3448
 *         """
 *         self.add_callback(callback, *callback_args, **(callback_kwargs or {}))
 *         self.add_errback(errback, *errback_args, **(errback_kwargs or {}))             # <<<<<<<<<<<<<<
 * 
 *     def clear_callbacks(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_add_errback); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_errback);
  __Pyx_GIVEREF(__pyx_v_errback);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_errback);
  __pyx_t_4 = PySequence_Tuple(__pyx_v_errback_args); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_errback_kwargs); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_5) {
  } else {
    __Pyx_INCREF(__pyx_v_errback_kwargs);
    __pyx_t_3 = __pyx_v_errback_kwargs;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_3 = __pyx_t_6;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_3 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (likely(PyDict_Check(__pyx_t_3))) {
    __pyx_t_4 = __pyx_t_3;
    __Pyx_INCREF(__pyx_t_4);
  } else {
    __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cassandra/cluster.py":3422
 *         return self
 * 
 *     def add_callbacks(self, callback, errback,             # <<<<<<<<<<<<<<
 *                       callback_args=(), callback_kwargs=None,
 *                       errback_args=(), errback_kwargs=None):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.add_callbacks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3450
 *         self.add_errback(errback, *errback_args, **(errback_kwargs or {}))
 * 
 *     def clear_callbacks(self):             # <<<<<<<<<<<<<<
 *         with self._callback_lock:
 *             self._callback = []
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_49clear_callbacks(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_49clear_callbacks = {"clear_callbacks", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_49clear_callbacks, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_49clear_callbacks(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear_callbacks (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_48clear_callbacks(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_48clear_callbacks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clear_callbacks", 0);

  /* "cassandra/cluster.py":3451
 * 
 *     def clear_callbacks(self):
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             self._callback = []
 *             self._errback = []
 */
  /*with:*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_callback_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3451; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3451; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3451; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cassandra/cluster.py":3452
 *     def clear_callbacks(self):
 *         with self._callback_lock:
 *             self._callback = []             # <<<<<<<<<<<<<<
 *             self._errback = []
 * 
 */
          __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3452; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_callback_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3452; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "cassandra/cluster.py":3453
 *         with self._callback_lock:
 *             self._callback = []
 *             self._errback = []             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
          __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3453; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_GOTREF(__pyx_t_1);
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_errback_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3453; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L14_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "cassandra/cluster.py":3451
 * 
 *     def clear_callbacks(self):
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             self._callback = []
 *             self._errback = []
 */
        /*except:*/ {
          __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.clear_callbacks", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3451; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3451; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3451; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3451; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_XGIVEREF(__pyx_t_4);
            __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_4);
            __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; 
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3451; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        __pyx_L14_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_2) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__154, NULL);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L18;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L1_error;
    __pyx_L18:;
  }

  /* "cassandra/cluster.py":3450
 *         self.add_errback(errback, *errback_args, **(errback_kwargs or {}))
 * 
 *     def clear_callbacks(self):             # <<<<<<<<<<<<<<
 *         with self._callback_lock:
 *             self._callback = []
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.clear_callbacks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3455
 *             self._errback = []
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         result = "(no result yet)" if self._final_result is _NOT_SET else self._final_result
 *         return "<ResponseFuture: query='%s' request_id=%s result=%s exception=%s host=%s>" \
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_51__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_14ResponseFuture_51__str__ = {"__str__", (PyCFunction)__pyx_pw_9cassandra_7cluster_14ResponseFuture_51__str__, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_14ResponseFuture_51__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_14ResponseFuture_50__str__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_14ResponseFuture_50__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "cassandra/cluster.py":3456
 * 
 *     def __str__(self):
 *         result = "(no result yet)" if self._final_result is _NOT_SET else self._final_result             # <<<<<<<<<<<<<<
 *         return "<ResponseFuture: query='%s' request_id=%s result=%s exception=%s host=%s>" \
 *                % (self.query, self._req_id, result, self._final_exception, self._current_host)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_final_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOT_SET); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = (__pyx_t_2 == __pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((__pyx_t_4 != 0)) {
    __Pyx_INCREF(__pyx_kp_s_no_result_yet);
    __pyx_t_1 = __pyx_kp_s_no_result_yet;
  } else {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_final_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3457
 *     def __str__(self):
 *         result = "(no result yet)" if self._final_result is _NOT_SET else self._final_result
 *         return "<ResponseFuture: query='%s' request_id=%s result=%s exception=%s host=%s>" \             # <<<<<<<<<<<<<<
 *                % (self.query, self._req_id, result, self._final_exception, self._current_host)
 *     __repr__ = __str__
 */
  __Pyx_XDECREF(__pyx_r);

  /* "cassandra/cluster.py":3458
 *         result = "(no result yet)" if self._final_result is _NOT_SET else self._final_result
 *         return "<ResponseFuture: query='%s' request_id=%s result=%s exception=%s host=%s>" \
 *                % (self.query, self._req_id, result, self._final_exception, self._current_host)             # <<<<<<<<<<<<<<
 *     __repr__ = __str__
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_query); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_req_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_final_exception); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_host); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_INCREF(__pyx_v_result);
  __Pyx_GIVEREF(__pyx_v_result);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_result);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_5);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_ResponseFuture_query_s_request, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":3455
 *             self._errback = []
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         result = "(no result yet)" if self._final_result is _NOT_SET else self._final_result
 *         return "<ResponseFuture: query='%s' request_id=%s result=%s exception=%s host=%s>" \
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cassandra.cluster.ResponseFuture.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3497
 *     response_future = None
 * 
 *     def __init__(self, response_future, initial_response):             # <<<<<<<<<<<<<<
 *         self.response_future = response_future
 *         self.current_response = iter(initial_response)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_11PagedResult_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_11PagedResult_1__init__ = {"__init__", (PyCFunction)__pyx_pw_9cassandra_7cluster_11PagedResult_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_11PagedResult_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_response_future = 0;
  PyObject *__pyx_v_initial_response = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_response_future,&__pyx_n_s_initial_response,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_response_future)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3497; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_initial_response)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3497; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3497; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_response_future = values[1];
    __pyx_v_initial_response = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3497; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cassandra.cluster.PagedResult.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9cassandra_7cluster_11PagedResult___init__(__pyx_self, __pyx_v_self, __pyx_v_response_future, __pyx_v_initial_response);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_11PagedResult___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_response_future, PyObject *__pyx_v_initial_response) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cassandra/cluster.py":3498
 * 
 *     def __init__(self, response_future, initial_response):
 *         self.response_future = response_future             # <<<<<<<<<<<<<<
 *         self.current_response = iter(initial_response)
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_response_future, __pyx_v_response_future) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3499
 *     def __init__(self, response_future, initial_response):
 *         self.response_future = response_future
 *         self.current_response = iter(initial_response)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_1 = PyObject_GetIter(__pyx_v_initial_response); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_current_response, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3497
 *     response_future = None
 * 
 *     def __init__(self, response_future, initial_response):             # <<<<<<<<<<<<<<
 *         self.response_future = response_future
 *         self.current_response = iter(initial_response)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cassandra.cluster.PagedResult.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3501
 *         self.current_response = iter(initial_response)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_11PagedResult_3__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_11PagedResult_3__iter__ = {"__iter__", (PyCFunction)__pyx_pw_9cassandra_7cluster_11PagedResult_3__iter__, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_11PagedResult_3__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_11PagedResult_2__iter__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_11PagedResult_2__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "cassandra/cluster.py":3502
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def next(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "cassandra/cluster.py":3501
 *         self.current_response = iter(initial_response)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cassandra/cluster.py":3504
 *         return self
 * 
 *     def next(self):             # <<<<<<<<<<<<<<
 *         try:
 *             return next(self.current_response)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9cassandra_7cluster_11PagedResult_5next(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_9cassandra_7cluster_11PagedResult_5next = {"next", (PyCFunction)__pyx_pw_9cassandra_7cluster_11PagedResult_5next, METH_O, 0};
static PyObject *__pyx_pw_9cassandra_7cluster_11PagedResult_5next(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("next (wrapper)", 0);
  __pyx_r = __pyx_pf_9cassandra_7cluster_11PagedResult_4next(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9cassandra_7cluster_11PagedResult_4next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("next", 0);

  /* "cassandra/cluster.py":3505
 * 
 *     def next(self):
 *         try:             # <<<<<<<<<<<<<<
 *             return next(self.current_response)
 *         except StopIteration:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cassandra/cluster.py":3506
 *     def next(self):
 *         try:
 *             return next(self.current_response)             # <<<<<<<<<<<<<<
 *         except StopIteration:
 *             if not self.response_future.has_more_pages:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_response); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3506; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyIter_Next(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3506; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_try_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cassandra/cluster.py":3507
 *         try:
 *             return next(self.current_response)
 *         except StopIteration:             # <<<<<<<<<<<<<<
 *             if not self.response_future.has_more_pages:
 *                 raise
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("cassandra.cluster.PagedResult.next", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3507; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_7);

      /* "cassandra/cluster.py":3508
 *             return next(self.current_response)
 *         except StopIteration:
 *             if not self.response_future.has_more_pages:             # <<<<<<<<<<<<<<
 *                 raise
 * 
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_response_future); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3508; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_has_more_pages); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3508; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3508; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_11 = ((!__pyx_t_10) != 0);
      if (__pyx_t_11) {

        /* "cassandra/cluster.py":3509
 *         except StopIteration:
 *             if not self.response_future.has_more_pages:
 *                 raise             # <<<<<<<<<<<<<<
 * 
 *         self.response_future.start_fetching_next_page()
 */
        __Pyx_GIVEREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ErrRestore(__pyx_t_5, __pyx_t_4, __pyx_t_7);
        __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_7 = 0; 
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  }

  /* "cassandra/cluster.py":3511
 *                 raise
 * 
 *         self.response_future.start_fetching_next_page()             # <<<<<<<<<<<<<<
 *         result = self.response_future.result()
 *         if self.response_future.has_more_pages:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_response_future); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_start_fetching_next_page); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "cassandra/cluster.py":3512
 * 
 *         self.response_future.start_fetching_next_page()
 *         result = self.response_future.result()             # <<<<<<<<<<<<<<
 *         if self.response_future.has_more_pages:
 *             self.current_response = result.current_response
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_response_future); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_result); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_result = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "cassandra/cluster.py":3513
 *         self.response_future.start_fetching_next_page()
 *         result = self.response_future.result()
 *         if self.response_future.has_more_pages:             # <<<<<<<<<<<<<<
 *             self.current_response = result.current_response
 *         else:
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_response_future); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_has_more_pages); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_11) {

    /* "cassandra/cluster.py":3514
 *         result = self.response_future.result()
 *         if self.response_future.has_more_pages:
 *             self.current_response = result.current_response             # <<<<<<<<<<<<<<
 *         else:
 *             self.current_response = iter(result)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_current_response); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_current_response, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L14;
  }
  /*else*/ {

    /* "cassandra/cluster.py":3516
 *             self.current_response = result.current_response
 *         else:
 *             self.current_response = iter(result)             # <<<<<<<<<<<<<<
 * 
 *         return next(self.current_response)
 */
    __pyx_t_4 = PyObject_GetIter(__pyx_v_result); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_current_response, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L14:;

  /* "cassandra/cluster.py":3518
 *             self.current_response = iter(result)
 * 
 *         return next(self.current_response)             # <<<<<<<<<<<<<<
 * 
 *     __next__ = next
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_current_response); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyIter_Next(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "cassandra/cluster.py":3504
 *         return self
 * 
 *     def next(self):             # <<<<<<<<<<<<<<
 *         try:
 *             return next(self.current_response)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cassandra.cluster.PagedResult.next", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct__run_in_executor[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct__run_in_executor = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct__run_in_executor(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct__run_in_executor > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct__run_in_executor[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct__run_in_executor];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct__run_in_executor(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_f);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct__run_in_executor < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct__run_in_executor[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct__run_in_executor++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct__run_in_executor(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor *)o;
  if (p->__pyx_v_f) {
    e = (*v)(p->__pyx_v_f, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct__run_in_executor(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor *)o;
  tmp = ((PyObject*)p->__pyx_v_f);
  p->__pyx_v_f = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct__run_in_executor = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct__run_in_executor", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct__run_in_executor), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct__run_in_executor, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct__run_in_executor, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct__run_in_executor, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct__run_in_executor, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_1_on_add[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_1_on_add = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_1_on_add(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_1_on_add > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_1_on_add[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_1_on_add];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_1_on_add(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_futures);
  Py_CLEAR(p->__pyx_v_futures_lock);
  Py_CLEAR(p->__pyx_v_futures_results);
  Py_CLEAR(p->__pyx_v_host);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_1_on_add < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_1_on_add[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_1_on_add++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_1_on_add(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add *)o;
  if (p->__pyx_v_futures) {
    e = (*v)(p->__pyx_v_futures, a); if (e) return e;
  }
  if (p->__pyx_v_futures_lock) {
    e = (*v)(p->__pyx_v_futures_lock, a); if (e) return e;
  }
  if (p->__pyx_v_futures_results) {
    e = (*v)(p->__pyx_v_futures_results, a); if (e) return e;
  }
  if (p->__pyx_v_host) {
    e = (*v)(p->__pyx_v_host, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_1_on_add(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add *)o;
  tmp = ((PyObject*)p->__pyx_v_futures);
  p->__pyx_v_futures = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_futures_lock);
  p->__pyx_v_futures_lock = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_futures_results);
  p->__pyx_v_futures_results = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_host);
  p->__pyx_v_host = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_1_on_add = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_1_on_add", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_1_on_add), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_1_on_add, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_1_on_add, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_1_on_add, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_1_on_add, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_function);
  Py_CLEAR(p->__pyx_v_table);
  Py_CLEAR(p->__pyx_v_usertype);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema *)o;
  if (p->__pyx_v_function) {
    e = (*v)(p->__pyx_v_function, a); if (e) return e;
  }
  if (p->__pyx_v_table) {
    e = (*v)(p->__pyx_v_table, a); if (e) return e;
  }
  if (p->__pyx_v_usertype) {
    e = (*v)(p->__pyx_v_usertype, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema *)o;
  tmp = ((PyObject*)p->__pyx_v_function);
  p->__pyx_v_function = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_table);
  p->__pyx_v_table = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_usertype);
  p->__pyx_v_usertype = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_2__validate_refresh_schema", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_3_genexpr[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_3_genexpr = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_3_genexpr[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_3_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_3_genexpr(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_e);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_3_genexpr[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_e) {
    e = (*v)(p->__pyx_v_e, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_3_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_e);
  p->__pyx_v_e = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_3_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_3_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_3_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_3_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_distance);
  Py_CLEAR(p->__pyx_v_host);
  Py_CLEAR(p->__pyx_v_is_host_addition);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool *)o;
  if (p->__pyx_v_distance) {
    e = (*v)(p->__pyx_v_distance, a); if (e) return e;
  }
  if (p->__pyx_v_host) {
    e = (*v)(p->__pyx_v_host, a); if (e) return e;
  }
  if (p->__pyx_v_is_host_addition) {
    e = (*v)(p->__pyx_v_is_host_addition, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool *)o;
  tmp = ((PyObject*)p->__pyx_v_distance);
  p->__pyx_v_distance = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_host);
  p->__pyx_v_host = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_is_host_addition);
  p->__pyx_v_is_host_addition = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_4_add_or_renew_pool", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_5_on_down[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_5_on_down = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_5_on_down(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_5_on_down > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_5_on_down[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_5_on_down];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_5_on_down(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_5_on_down < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_5_on_down[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_5_on_down++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_5_on_down(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down *)o;
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_5_on_down(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_5_on_down = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_5_on_down", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_5_on_down), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_5_on_down, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_5_on_down, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_5_on_down, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_5_on_down, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_callback);
  Py_CLEAR(p->__pyx_v_errors);
  Py_CLEAR(p->__pyx_v_remaining_callbacks);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools *)o;
  if (p->__pyx_v_callback) {
    e = (*v)(p->__pyx_v_callback, a); if (e) return e;
  }
  if (p->__pyx_v_errors) {
    e = (*v)(p->__pyx_v_errors, a); if (e) return e;
  }
  if (p->__pyx_v_remaining_callbacks) {
    e = (*v)(p->__pyx_v_remaining_callbacks, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools *)o;
  tmp = ((PyObject*)p->__pyx_v_callback);
  p->__pyx_v_callback = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_errors);
  p->__pyx_v_errors = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_remaining_callbacks);
  p->__pyx_v_remaining_callbacks = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_6__set_keyspace_for_all_pools", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_type_meta);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered *)o;
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  if (p->__pyx_v_type_meta) {
    e = (*v)(p->__pyx_v_type_meta, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_type_meta);
  p->__pyx_v_type_meta = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_7_user_type_registered", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_8_encode[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_8_encode = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_8_encode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_8_encode > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_8_encode[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_8_encode];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_8_encode(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_val);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_8_encode < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_8_encode[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_8_encode++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_8_encode(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_val) {
    e = (*v)(p->__pyx_v_val, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_8_encode(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_val);
  p->__pyx_v_val = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_8_encode = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_8_encode", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_8_encode, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_8_encode, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_8_encode, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_8_encode, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_9_genexpr[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_9_genexpr = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_9_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_9_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_9_genexpr[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_9_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_9_genexpr(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_field_name);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_9_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_9_genexpr[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_9_genexpr++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_9_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_field_name) {
    e = (*v)(p->__pyx_v_field_name, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_9_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_8_encode *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_field_name);
  p->__pyx_v_field_name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_9_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_9_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_9_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_9_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_9_genexpr, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_9_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_9_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state *)o;
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_10_get_pool_state", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_11_genexpr[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_11_genexpr = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_11_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_11_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_11_genexpr[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_11_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_11_genexpr(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_host);
  Py_CLEAR(p->__pyx_v_pool);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_11_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_11_genexpr[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_11_genexpr++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_11_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_host) {
    e = (*v)(p->__pyx_v_host, a); if (e) return e;
  }
  if (p->__pyx_v_pool) {
    e = (*v)(p->__pyx_v_pool, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_11_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_host);
  p->__pyx_v_host = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_pool);
  p->__pyx_v_pool = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_11_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_11_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_11_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_11_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_11_genexpr, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_11_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_11_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_aggregate);
  Py_CLEAR(p->__pyx_v_function);
  Py_CLEAR(p->__pyx_v_table);
  Py_CLEAR(p->__pyx_v_usertype);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *)o;
  if (p->__pyx_v_aggregate) {
    e = (*v)(p->__pyx_v_aggregate, a); if (e) return e;
  }
  if (p->__pyx_v_function) {
    e = (*v)(p->__pyx_v_function, a); if (e) return e;
  }
  if (p->__pyx_v_table) {
    e = (*v)(p->__pyx_v_table, a); if (e) return e;
  }
  if (p->__pyx_v_usertype) {
    e = (*v)(p->__pyx_v_usertype, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *)o;
  tmp = ((PyObject*)p->__pyx_v_aggregate);
  p->__pyx_v_aggregate = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_function);
  p->__pyx_v_function = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_table);
  p->__pyx_v_table = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_usertype);
  p->__pyx_v_usertype = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_12__refresh_schema", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_13_genexpr[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_13_genexpr = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_13_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_13_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_13_genexpr[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_13_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_13_genexpr(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_arg);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_13_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_13_genexpr[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_13_genexpr++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_13_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_arg) {
    e = (*v)(p->__pyx_v_arg, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_13_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_arg);
  p->__pyx_v_arg = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_13_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_13_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_13_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_13_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_13_genexpr, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_13_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_13_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_14_genexpr[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_14_genexpr = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_14_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_14_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_14_genexpr[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_14_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_14_genexpr(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_t);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_14_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_14_genexpr[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_14_genexpr++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_14_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_t) {
    e = (*v)(p->__pyx_v_t, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_14_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_t);
  p->__pyx_v_t = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_14_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_14_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_14_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_14_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_14_genexpr, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_14_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_14_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_15_genexpr[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_15_genexpr = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_15_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_15_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_15_genexpr[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_15_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_15_genexpr(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_t);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_15_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_15_genexpr[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_15_genexpr++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_15_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_t) {
    e = (*v)(p->__pyx_v_t, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_15_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_t);
  p->__pyx_v_t = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_15_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_15_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_15_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_15_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_15_genexpr, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_15_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_15_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_versions);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches *)o;
  if (p->__pyx_v_versions) {
    e = (*v)(p->__pyx_v_versions, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches *)o;
  tmp = ((PyObject*)p->__pyx_v_versions);
  p->__pyx_v_versions = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_16__get_schema_mismatches", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr *__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_17_genexpr[8];
static int __pyx_freecount_9cassandra_7cluster___pyx_scope_struct_17_genexpr = 0;

static PyObject *__pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_17_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_17_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr)))) {
    o = (PyObject*)__pyx_freelist_9cassandra_7cluster___pyx_scope_struct_17_genexpr[--__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_17_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_17_genexpr(PyObject *o) {
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_nodes);
  Py_CLEAR(p->__pyx_v_version);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_17_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr)))) {
    __pyx_freelist_9cassandra_7cluster___pyx_scope_struct_17_genexpr[__pyx_freecount_9cassandra_7cluster___pyx_scope_struct_17_genexpr++] = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_17_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_nodes) {
    e = (*v)(p->__pyx_v_nodes, a); if (e) return e;
  }
  if (p->__pyx_v_version) {
    e = (*v)(p->__pyx_v_version, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_17_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_nodes);
  p->__pyx_v_nodes = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_version);
  p->__pyx_v_version = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_9cassandra_7cluster___pyx_scope_struct_17_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cassandra.cluster.__pyx_scope_struct_17_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_9cassandra_7cluster___pyx_scope_struct_17_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9cassandra_7cluster___pyx_scope_struct_17_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9cassandra_7cluster___pyx_scope_struct_17_genexpr, /*tp_traverse*/
  __pyx_tp_clear_9cassandra_7cluster___pyx_scope_struct_17_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9cassandra_7cluster___pyx_scope_struct_17_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    "cluster",
    __pyx_k_This_module_houses_the_main_cla, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_0_0_0_0, __pyx_k_0_0_0_0, sizeof(__pyx_k_0_0_0_0), 0, 0, 1, 0},
  {&__pyx_kp_s_127_0_0_1, __pyx_k_127_0_0_1, sizeof(__pyx_k_127_0_0_1), 0, 0, 1, 0},
  {&__pyx_kp_s_A_collection_of_connection_pool, __pyx_k_A_collection_of_connection_pool, sizeof(__pyx_k_A_collection_of_connection_pool), 0, 0, 1, 0},
  {&__pyx_kp_u_A_convenient_combination_of_met, __pyx_k_A_convenient_combination_of_met, sizeof(__pyx_k_A_convenient_combination_of_met), 0, 1, 0, 0},
  {&__pyx_kp_s_Added_pool_for_host_s_to_session, __pyx_k_Added_pool_for_host_s_to_session, sizeof(__pyx_k_Added_pool_for_host_s_to_session), 0, 0, 1, 0},
  {&__pyx_kp_s_All_connections_for_host_s_are_a, __pyx_k_All_connections_for_host_s_are_a, sizeof(__pyx_k_All_connections_for_host_s_are_a), 0, 0, 1, 0},
  {&__pyx_kp_s_All_futures_have_completed_for_a, __pyx_k_All_futures_have_completed_for_a, sizeof(__pyx_k_All_futures_have_completed_for_a), 0, 0, 1, 0},
  {&__pyx_kp_s_An_asynchronous_response_delive, __pyx_k_An_asynchronous_response_delive, sizeof(__pyx_k_An_asynchronous_response_delive), 0, 0, 1, 0},
  {&__pyx_kp_s_An_attempt_was_made_to_use_a_us, __pyx_k_An_attempt_was_made_to_use_a_us, sizeof(__pyx_k_An_attempt_was_made_to_use_a_us), 0, 0, 1, 0},
  {&__pyx_kp_s_An_internally_scheduled_tasked_f, __pyx_k_An_internally_scheduled_tasked_f, sizeof(__pyx_k_An_internally_scheduled_tasked_f), 0, 0, 1, 0},
  {&__pyx_kp_s_An_iterator_over_the_rows_from, __pyx_k_An_iterator_over_the_rows_from, sizeof(__pyx_k_An_iterator_over_the_rows_from), 0, 0, 1, 0},
  {&__pyx_kp_s_Another_thread_is_already_handli, __pyx_k_Another_thread_is_already_handli, sizeof(__pyx_k_Another_thread_is_already_handli), 0, 0, 1, 0},
  {&__pyx_n_s_AsyncoreConnection, __pyx_k_AsyncoreConnection, sizeof(__pyx_k_AsyncoreConnection), 0, 0, 1, 1},
  {&__pyx_kp_u_Attaches_a_callback_function_to, __pyx_k_Attaches_a_callback_function_to, sizeof(__pyx_k_Attaches_a_callback_function_to), 0, 1, 0, 0},
  {&__pyx_kp_s_Attempting_to_open_new_connectio, __pyx_k_Attempting_to_open_new_connectio, sizeof(__pyx_k_Attempting_to_open_new_connectio), 0, 0, 1, 0},
  {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  {&__pyx_n_s_AuthenticationFailed, __pyx_k_AuthenticationFailed, sizeof(__pyx_k_AuthenticationFailed), 0, 0, 1, 1},
  {&__pyx_n_s_BatchMessage, __pyx_k_BatchMessage, sizeof(__pyx_k_BatchMessage), 0, 0, 1, 1},
  {&__pyx_n_s_BatchStatement, __pyx_k_BatchStatement, sizeof(__pyx_k_BatchStatement), 0, 0, 1, 1},
  {&__pyx_kp_s_BatchStatement_execution_is_only, __pyx_k_BatchStatement_execution_is_only, sizeof(__pyx_k_BatchStatement_execution_is_only), 0, 0, 1, 0},
  {&__pyx_n_s_BoundStatement, __pyx_k_BoundStatement, sizeof(__pyx_k_BoundStatement), 0, 0, 1, 1},
  {&__pyx_n_s_CPython, __pyx_k_CPython, sizeof(__pyx_k_CPython), 0, 0, 1, 1},
  {&__pyx_kp_s_Cannot_downgrade_protocol_versio, __pyx_k_Cannot_downgrade_protocol_versio, sizeof(__pyx_k_Cannot_downgrade_protocol_versio), 0, 0, 1, 0},
  {&__pyx_kp_s_Cassandra_host_s_removed, __pyx_k_Cassandra_host_s_removed, sizeof(__pyx_k_Cassandra_host_s_removed), 0, 0, 1, 0},
  {&__pyx_n_s_Cluster, __pyx_k_Cluster, sizeof(__pyx_k_Cluster), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster___init, __pyx_k_Cluster___init, sizeof(__pyx_k_Cluster___init), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster__cleanup_failed_on_up_ha, __pyx_k_Cluster__cleanup_failed_on_up_ha, sizeof(__pyx_k_Cluster__cleanup_failed_on_up_ha), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster__ensure_core_connections, __pyx_k_Cluster__ensure_core_connections, sizeof(__pyx_k_Cluster__ensure_core_connections), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster__finalize_add, __pyx_k_Cluster__finalize_add, sizeof(__pyx_k_Cluster__finalize_add), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster__make_connection_factory, __pyx_k_Cluster__make_connection_factory, sizeof(__pyx_k_Cluster__make_connection_factory), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster__make_connection_kwargs, __pyx_k_Cluster__make_connection_kwargs, sizeof(__pyx_k_Cluster__make_connection_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster__new_session, __pyx_k_Cluster__new_session, sizeof(__pyx_k_Cluster__new_session), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster__on_up_future_completed, __pyx_k_Cluster__on_up_future_completed, sizeof(__pyx_k_Cluster__on_up_future_completed), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster__prepare_all_queries, __pyx_k_Cluster__prepare_all_queries, sizeof(__pyx_k_Cluster__prepare_all_queries), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster__prepare_all_queries_loc, __pyx_k_Cluster__prepare_all_queries_loc, sizeof(__pyx_k_Cluster__prepare_all_queries_loc), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster__start_reconnector, __pyx_k_Cluster__start_reconnector, sizeof(__pyx_k_Cluster__start_reconnector), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster__validate_refresh_schema, __pyx_k_Cluster__validate_refresh_schema, sizeof(__pyx_k_Cluster__validate_refresh_schema), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster__validate_refresh_schema_2, __pyx_k_Cluster__validate_refresh_schema_2, sizeof(__pyx_k_Cluster__validate_refresh_schema_2), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_add_host, __pyx_k_Cluster_add_host, sizeof(__pyx_k_Cluster_add_host), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_auth_provider, __pyx_k_Cluster_auth_provider, sizeof(__pyx_k_Cluster_auth_provider), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_connect, __pyx_k_Cluster_connect, sizeof(__pyx_k_Cluster_connect), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_connection_factory, __pyx_k_Cluster_connection_factory, sizeof(__pyx_k_Cluster_connection_factory), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_get_connection_holders, __pyx_k_Cluster_get_connection_holders, sizeof(__pyx_k_Cluster_get_connection_holders), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_get_core_connections_per, __pyx_k_Cluster_get_core_connections_per, sizeof(__pyx_k_Cluster_get_core_connections_per), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_get_max_connections_per, __pyx_k_Cluster_get_max_connections_per, sizeof(__pyx_k_Cluster_get_max_connections_per), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_get_max_requests_per_con, __pyx_k_Cluster_get_max_requests_per_con, sizeof(__pyx_k_Cluster_get_max_requests_per_con), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_get_min_requests_per_con, __pyx_k_Cluster_get_min_requests_per_con, sizeof(__pyx_k_Cluster_get_min_requests_per_con), 0, 0, 1, 1},
  {&__pyx_kp_s_Cluster_is_already_shut_down, __pyx_k_Cluster_is_already_shut_down, sizeof(__pyx_k_Cluster_is_already_shut_down), 0, 0, 1, 0},
  {&__pyx_n_s_Cluster_listeners, __pyx_k_Cluster_listeners, sizeof(__pyx_k_Cluster_listeners), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_on_add, __pyx_k_Cluster_on_add, sizeof(__pyx_k_Cluster_on_add), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_on_add_locals_future_com, __pyx_k_Cluster_on_add_locals_future_com, sizeof(__pyx_k_Cluster_on_add_locals_future_com), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_on_down, __pyx_k_Cluster_on_down, sizeof(__pyx_k_Cluster_on_down), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_on_remove, __pyx_k_Cluster_on_remove, sizeof(__pyx_k_Cluster_on_remove), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_on_up, __pyx_k_Cluster_on_up, sizeof(__pyx_k_Cluster_on_up), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_prepare_on_all_sessions, __pyx_k_Cluster_prepare_on_all_sessions, sizeof(__pyx_k_Cluster_prepare_on_all_sessions), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_protocol_downgrade, __pyx_k_Cluster_protocol_downgrade, sizeof(__pyx_k_Cluster_protocol_downgrade), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_refresh_keyspace_metadat, __pyx_k_Cluster_refresh_keyspace_metadat, sizeof(__pyx_k_Cluster_refresh_keyspace_metadat), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_refresh_nodes, __pyx_k_Cluster_refresh_nodes, sizeof(__pyx_k_Cluster_refresh_nodes), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_refresh_schema, __pyx_k_Cluster_refresh_schema, sizeof(__pyx_k_Cluster_refresh_schema), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_refresh_schema_metadata, __pyx_k_Cluster_refresh_schema_metadata, sizeof(__pyx_k_Cluster_refresh_schema_metadata), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_refresh_table_metadata, __pyx_k_Cluster_refresh_table_metadata, sizeof(__pyx_k_Cluster_refresh_table_metadata), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_refresh_user_aggregate_m, __pyx_k_Cluster_refresh_user_aggregate_m, sizeof(__pyx_k_Cluster_refresh_user_aggregate_m), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_refresh_user_function_me, __pyx_k_Cluster_refresh_user_function_me, sizeof(__pyx_k_Cluster_refresh_user_function_me), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_refresh_user_type_metada, __pyx_k_Cluster_refresh_user_type_metada, sizeof(__pyx_k_Cluster_refresh_user_type_metada), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_register_listener, __pyx_k_Cluster_register_listener, sizeof(__pyx_k_Cluster_register_listener), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_register_user_type, __pyx_k_Cluster_register_user_type, sizeof(__pyx_k_Cluster_register_user_type), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_remove_host, __pyx_k_Cluster_remove_host, sizeof(__pyx_k_Cluster_remove_host), 0, 0, 1, 1},
  {&__pyx_kp_s_Cluster_set_core_connections_per, __pyx_k_Cluster_set_core_connections_per, sizeof(__pyx_k_Cluster_set_core_connections_per), 0, 0, 1, 0},
  {&__pyx_n_s_Cluster_set_core_connections_per_2, __pyx_k_Cluster_set_core_connections_per_2, sizeof(__pyx_k_Cluster_set_core_connections_per_2), 0, 0, 1, 1},
  {&__pyx_kp_s_Cluster_set_max_connections_per, __pyx_k_Cluster_set_max_connections_per, sizeof(__pyx_k_Cluster_set_max_connections_per), 0, 0, 1, 0},
  {&__pyx_n_s_Cluster_set_max_connections_per_2, __pyx_k_Cluster_set_max_connections_per_2, sizeof(__pyx_k_Cluster_set_max_connections_per_2), 0, 0, 1, 1},
  {&__pyx_kp_s_Cluster_set_max_requests_per_con, __pyx_k_Cluster_set_max_requests_per_con, sizeof(__pyx_k_Cluster_set_max_requests_per_con), 0, 0, 1, 0},
  {&__pyx_n_s_Cluster_set_max_requests_per_con_2, __pyx_k_Cluster_set_max_requests_per_con_2, sizeof(__pyx_k_Cluster_set_max_requests_per_con_2), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_set_meta_refresh_enabled, __pyx_k_Cluster_set_meta_refresh_enabled, sizeof(__pyx_k_Cluster_set_meta_refresh_enabled), 0, 0, 1, 1},
  {&__pyx_kp_s_Cluster_set_min_requests_per_con, __pyx_k_Cluster_set_min_requests_per_con, sizeof(__pyx_k_Cluster_set_min_requests_per_con), 0, 0, 1, 0},
  {&__pyx_n_s_Cluster_set_min_requests_per_con_2, __pyx_k_Cluster_set_min_requests_per_con_2, sizeof(__pyx_k_Cluster_set_min_requests_per_con_2), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_shutdown, __pyx_k_Cluster_shutdown, sizeof(__pyx_k_Cluster_shutdown), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_signal_connection_failur, __pyx_k_Cluster_signal_connection_failur, sizeof(__pyx_k_Cluster_signal_connection_failur), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_submit_schema_refresh, __pyx_k_Cluster_submit_schema_refresh, sizeof(__pyx_k_Cluster_submit_schema_refresh), 0, 0, 1, 1},
  {&__pyx_n_s_Cluster_unregister_listener, __pyx_k_Cluster_unregister_listener, sizeof(__pyx_k_Cluster_unregister_listener), 0, 0, 1, 1},
  {&__pyx_kp_s_Connecting_to_cluster_contact_po, __pyx_k_Connecting_to_cluster_contact_po, sizeof(__pyx_k_Connecting_to_cluster_contact_po), 0, 0, 1, 0},
  {&__pyx_n_s_ConnectionException, __pyx_k_ConnectionException, sizeof(__pyx_k_ConnectionException), 0, 0, 1, 1},
  {&__pyx_n_s_ConnectionHeartbeat, __pyx_k_ConnectionHeartbeat, sizeof(__pyx_k_ConnectionHeartbeat), 0, 0, 1, 1},
  {&__pyx_n_s_ConnectionShutdown, __pyx_k_ConnectionShutdown, sizeof(__pyx_k_ConnectionShutdown), 0, 0, 1, 1},
  {&__pyx_kp_s_Connection_error_when_preparing, __pyx_k_Connection_error_when_preparing, sizeof(__pyx_k_Connection_error_when_preparing), 0, 0, 1, 0},
  {&__pyx_kp_s_Connection_pool_could_not_be_cre, __pyx_k_Connection_pool_could_not_be_cre, sizeof(__pyx_k_Connection_pool_could_not_be_cre), 0, 0, 1, 0},
  {&__pyx_kp_s_Connection_pools_established_for, __pyx_k_Connection_pools_established_for, sizeof(__pyx_k_Connection_pools_established_for), 0, 0, 1, 0},
  {&__pyx_n_s_ConsistencyLevel, __pyx_k_ConsistencyLevel, sizeof(__pyx_k_ConsistencyLevel), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection, __pyx_k_ControlConnection, sizeof(__pyx_k_ControlConnection), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection___init, __pyx_k_ControlConnection___init, sizeof(__pyx_k_ControlConnection___init), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__delay_for_eve, __pyx_k_ControlConnection__delay_for_eve, sizeof(__pyx_k_ControlConnection__delay_for_eve), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__get_and_set_r, __pyx_k_ControlConnection__get_and_set_r, sizeof(__pyx_k_ControlConnection__get_and_set_r), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__get_schema_mi, __pyx_k_ControlConnection__get_schema_mi, sizeof(__pyx_k_ControlConnection__get_schema_mi), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__get_schema_mi_2, __pyx_k_ControlConnection__get_schema_mi_2, sizeof(__pyx_k_ControlConnection__get_schema_mi_2), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__handle_schema, __pyx_k_ControlConnection__handle_schema, sizeof(__pyx_k_ControlConnection__handle_schema), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__handle_status, __pyx_k_ControlConnection__handle_status, sizeof(__pyx_k_ControlConnection__handle_status), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__handle_topolo, __pyx_k_ControlConnection__handle_topolo, sizeof(__pyx_k_ControlConnection__handle_topolo), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__reconnect, __pyx_k_ControlConnection__reconnect, sizeof(__pyx_k_ControlConnection__reconnect), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__reconnect_int, __pyx_k_ControlConnection__reconnect_int, sizeof(__pyx_k_ControlConnection__reconnect_int), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__refresh_node, __pyx_k_ControlConnection__refresh_node, sizeof(__pyx_k_ControlConnection__refresh_node), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__refresh_schem, __pyx_k_ControlConnection__refresh_schem, sizeof(__pyx_k_ControlConnection__refresh_schem), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__refresh_schem_2, __pyx_k_ControlConnection__refresh_schem_2, sizeof(__pyx_k_ControlConnection__refresh_schem_2), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__refresh_schem_3, __pyx_k_ControlConnection__refresh_schem_3, sizeof(__pyx_k_ControlConnection__refresh_schem_3), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__set_new_conne, __pyx_k_ControlConnection__set_new_conne, sizeof(__pyx_k_ControlConnection__set_new_conne), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__signal_error, __pyx_k_ControlConnection__signal_error, sizeof(__pyx_k_ControlConnection__signal_error), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__submit, __pyx_k_ControlConnection__submit, sizeof(__pyx_k_ControlConnection__submit), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__try_connect, __pyx_k_ControlConnection__try_connect, sizeof(__pyx_k_ControlConnection__try_connect), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection__update_locati, __pyx_k_ControlConnection__update_locati, sizeof(__pyx_k_ControlConnection__update_locati), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection_connect, __pyx_k_ControlConnection_connect, sizeof(__pyx_k_ControlConnection_connect), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection_get_connection, __pyx_k_ControlConnection_get_connection, sizeof(__pyx_k_ControlConnection_get_connection), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection_on_add, __pyx_k_ControlConnection_on_add, sizeof(__pyx_k_ControlConnection_on_add), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection_on_down, __pyx_k_ControlConnection_on_down, sizeof(__pyx_k_ControlConnection_on_down), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection_on_remove, __pyx_k_ControlConnection_on_remove, sizeof(__pyx_k_ControlConnection_on_remove), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection_on_up, __pyx_k_ControlConnection_on_up, sizeof(__pyx_k_ControlConnection_on_up), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection_reconnect, __pyx_k_ControlConnection_reconnect, sizeof(__pyx_k_ControlConnection_reconnect), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection_refresh_node_l, __pyx_k_ControlConnection_refresh_node_l, sizeof(__pyx_k_ControlConnection_refresh_node_l), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection_refresh_schema, __pyx_k_ControlConnection_refresh_schema, sizeof(__pyx_k_ControlConnection_refresh_schema), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection_return_connect, __pyx_k_ControlConnection_return_connect, sizeof(__pyx_k_ControlConnection_return_connect), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection_set_meta_refre, __pyx_k_ControlConnection_set_meta_refre, sizeof(__pyx_k_ControlConnection_set_meta_refre), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection_shutdown, __pyx_k_ControlConnection_shutdown, sizeof(__pyx_k_ControlConnection_shutdown), 0, 0, 1, 1},
  {&__pyx_n_s_ControlConnection_wait_for_schem, __pyx_k_ControlConnection_wait_for_schem, sizeof(__pyx_k_ControlConnection_wait_for_schem), 0, 0, 1, 1},
  {&__pyx_n_s_ControlReconnectionHandler, __pyx_k_ControlReconnectionHandler, sizeof(__pyx_k_ControlReconnectionHandler), 0, 0, 1, 1},
  {&__pyx_n_s_ControlReconnectionHandler___in, __pyx_k_ControlReconnectionHandler___in, sizeof(__pyx_k_ControlReconnectionHandler___in), 0, 0, 1, 1},
  {&__pyx_n_s_ControlReconnectionHandler_on_e, __pyx_k_ControlReconnectionHandler_on_e, sizeof(__pyx_k_ControlReconnectionHandler_on_e), 0, 0, 1, 1},
  {&__pyx_n_s_ControlReconnectionHandler_on_r, __pyx_k_ControlReconnectionHandler_on_r, sizeof(__pyx_k_ControlReconnectionHandler_on_r), 0, 0, 1, 1},
  {&__pyx_n_s_ControlReconnectionHandler_try, __pyx_k_ControlReconnectionHandler_try, sizeof(__pyx_k_ControlReconnectionHandler_try), 0, 0, 1, 1},
  {&__pyx_kp_s_Control_connection_created, __pyx_k_Control_connection_created, sizeof(__pyx_k_Control_connection_created), 0, 0, 1, 0},
  {&__pyx_kp_s_Control_connection_failed_to_con, __pyx_k_Control_connection_failed_to_con, sizeof(__pyx_k_Control_connection_failed_to_con), 0, 0, 1, 0},
  {&__pyx_n_s_DCAwareRoundRobinPolicy, __pyx_k_DCAwareRoundRobinPolicy, sizeof(__pyx_k_DCAwareRoundRobinPolicy), 0, 0, 1, 1},
  {&__pyx_n_s_DEFAULT_MAX_CONNECTIONS_PER_LOCA, __pyx_k_DEFAULT_MAX_CONNECTIONS_PER_LOCA, sizeof(__pyx_k_DEFAULT_MAX_CONNECTIONS_PER_LOCA), 0, 0, 1, 1},
  {&__pyx_n_s_DEFAULT_MAX_CONNECTIONS_PER_REMO, __pyx_k_DEFAULT_MAX_CONNECTIONS_PER_REMO, sizeof(__pyx_k_DEFAULT_MAX_CONNECTIONS_PER_REMO), 0, 0, 1, 1},
  {&__pyx_n_s_DEFAULT_MAX_REQUESTS, __pyx_k_DEFAULT_MAX_REQUESTS, sizeof(__pyx_k_DEFAULT_MAX_REQUESTS), 0, 0, 1, 1},
  {&__pyx_n_s_DEFAULT_MIN_CONNECTIONS_PER_LOCA, __pyx_k_DEFAULT_MIN_CONNECTIONS_PER_LOCA, sizeof(__pyx_k_DEFAULT_MIN_CONNECTIONS_PER_LOCA), 0, 0, 1, 1},
  {&__pyx_n_s_DEFAULT_MIN_CONNECTIONS_PER_REMO, __pyx_k_DEFAULT_MIN_CONNECTIONS_PER_REMO, sizeof(__pyx_k_DEFAULT_MIN_CONNECTIONS_PER_REMO), 0, 0, 1, 1},
  {&__pyx_n_s_DEFAULT_MIN_REQUESTS, __pyx_k_DEFAULT_MIN_REQUESTS, sizeof(__pyx_k_DEFAULT_MIN_REQUESTS), 0, 0, 1, 1},
  {&__pyx_n_s_DOWN, __pyx_k_DOWN, sizeof(__pyx_k_DOWN), 0, 0, 1, 1},
  {&__pyx_n_s_DefaultConnection, __pyx_k_DefaultConnection, sizeof(__pyx_k_DefaultConnection), 0, 0, 1, 1},
  {&__pyx_n_s_DeprecationWarning, __pyx_k_DeprecationWarning, sizeof(__pyx_k_DeprecationWarning), 0, 0, 1, 1},
  {&__pyx_kp_s_Done_preparing_all_known_prepare, __pyx_k_Done_preparing_all_known_prepare, sizeof(__pyx_k_Done_preparing_all_known_prepare), 0, 0, 1, 0},
  {&__pyx_kp_s_Done_preparing_all_queries_for_h, __pyx_k_Done_preparing_all_queries_for_h, sizeof(__pyx_k_Done_preparing_all_queries_for_h), 0, 0, 1, 0},
  {&__pyx_kp_s_Done_preparing_queries_for_new_h, __pyx_k_Done_preparing_queries_for_new_h, sizeof(__pyx_k_Done_preparing_queries_for_new_h), 0, 0, 1, 0},
  {&__pyx_kp_s_Downgrading_core_protocol_versio, __pyx_k_Downgrading_core_protocol_versio, sizeof(__pyx_k_Downgrading_core_protocol_versio), 0, 0, 1, 0},
  {&__pyx_n_s_Empty, __pyx_k_Empty, sizeof(__pyx_k_Empty), 0, 0, 1, 1},
  {&__pyx_n_s_Encoder, __pyx_k_Encoder, sizeof(__pyx_k_Encoder), 0, 0, 1, 1},
  {&__pyx_n_s_ErrorMessage, __pyx_k_ErrorMessage, sizeof(__pyx_k_ErrorMessage), 0, 0, 1, 1},
  {&__pyx_kp_s_Error_preparing_query, __pyx_k_Error_preparing_query, sizeof(__pyx_k_Error_preparing_query), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_preparing_query_for_host_s, __pyx_k_Error_preparing_query_for_host_s, sizeof(__pyx_k_Error_preparing_query_for_host_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_preparing_query_on_all_hos, __pyx_k_Error_preparing_query_on_all_hos, sizeof(__pyx_k_Error_preparing_query_on_all_hos), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_querying_host_s, __pyx_k_Error_querying_host_s, sizeof(__pyx_k_Error_querying_host_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_trying_to_prepare_all_stat, __pyx_k_Error_trying_to_prepare_all_stat, sizeof(__pyx_k_Error_trying_to_prepare_all_stat), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_trying_to_prepare_all_stat_2, __pyx_k_Error_trying_to_prepare_all_stat_2, sizeof(__pyx_k_Error_trying_to_prepare_all_stat_2), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_trying_to_reconnect_contro, __pyx_k_Error_trying_to_reconnect_contro, sizeof(__pyx_k_Error_trying_to_reconnect_contro), 0, 0, 1, 0},
  {&__pyx_kp_s_Error_waiting_for_schema_agreeme, __pyx_k_Error_waiting_for_schema_agreeme, sizeof(__pyx_k_Error_waiting_for_schema_agreeme), 0, 0, 1, 0},
  {&__pyx_n_s_Event, __pyx_k_Event, sizeof(__pyx_k_Event), 0, 0, 1, 1},
  {&__pyx_n_s_EventletConnection, __pyx_k_EventletConnection, sizeof(__pyx_k_EventletConnection), 0, 0, 1, 1},
  {&__pyx_n_s_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 0, 0, 1, 1},
  {&__pyx_kp_s_Exception_refreshing_schema_in_r, __pyx_k_Exception_refreshing_schema_in_r, sizeof(__pyx_k_Exception_refreshing_schema_in_r), 0, 0, 1, 0},
  {&__pyx_kp_s_Excluding_host_s_with_no_tokens, __pyx_k_Excluding_host_s_with_no_tokens, sizeof(__pyx_k_Excluding_host_s_with_no_tokens), 0, 0, 1, 0},
  {&__pyx_n_s_ExecuteMessage, __pyx_k_ExecuteMessage, sizeof(__pyx_k_ExecuteMessage), 0, 0, 1, 1},
  {&__pyx_kp_u_Execute_the_given_query_and_ret, __pyx_k_Execute_the_given_query_and_ret, sizeof(__pyx_k_Execute_the_given_query_and_ret), 0, 1, 0, 0},
  {&__pyx_n_s_ExponentialReconnectionPolicy, __pyx_k_ExponentialReconnectionPolicy, sizeof(__pyx_k_ExponentialReconnectionPolicy), 0, 0, 1, 1},
  {&__pyx_n_s_FETCH_SIZE_UNSET, __pyx_k_FETCH_SIZE_UNSET, sizeof(__pyx_k_FETCH_SIZE_UNSET), 0, 0, 1, 1},
  {&__pyx_kp_s_Failed_to_create_connection_pool, __pyx_k_Failed_to_create_connection_pool, sizeof(__pyx_k_Failed_to_create_connection_pool), 0, 0, 1, 0},
  {&__pyx_kp_s_Failed_to_prepare_query_for_host, __pyx_k_Failed_to_prepare_query_for_host, sizeof(__pyx_k_Failed_to_prepare_query_for_host), 0, 0, 1, 0},
  {&__pyx_kp_s_Failed_to_run_task_on_executor, __pyx_k_Failed_to_run_task_on_executor, sizeof(__pyx_k_Failed_to_run_task_on_executor), 0, 0, 1, 0},
  {&__pyx_kp_s_Failed_to_set_keyspace_on_all_ho, __pyx_k_Failed_to_set_keyspace_on_all_ho, sizeof(__pyx_k_Failed_to_set_keyspace_on_all_ho), 0, 0, 1, 0},
  {&__pyx_kp_s_Failed_to_submit_task_to_executo, __pyx_k_Failed_to_submit_task_to_executo, sizeof(__pyx_k_Failed_to_submit_task_to_executo), 0, 0, 1, 0},
  {&__pyx_n_s_GeventConnection, __pyx_k_GeventConnection, sizeof(__pyx_k_GeventConnection), 0, 0, 1, 1},
  {&__pyx_kp_s_Got_different_query_ID_in_server, __pyx_k_Got_different_query_ID_in_server, sizeof(__pyx_k_Got_different_query_ID_in_server), 0, 0, 1, 0},
  {&__pyx_kp_s_Got_unexpected_message_r, __pyx_k_Got_unexpected_message_r, sizeof(__pyx_k_Got_unexpected_message_r), 0, 0, 1, 0},
  {&__pyx_kp_s_Got_unexpected_response_type_whe, __pyx_k_Got_unexpected_response_type_whe, sizeof(__pyx_k_Got_unexpected_response_type_whe), 0, 0, 1, 0},
  {&__pyx_kp_s_Got_unexpected_response_when_pre, __pyx_k_Got_unexpected_response_when_pre, sizeof(__pyx_k_Got_unexpected_response_when_pre), 0, 0, 1, 0},
  {&__pyx_kp_s_Got_unexpected_response_when_pre_2, __pyx_k_Got_unexpected_response_when_pre_2, sizeof(__pyx_k_Got_unexpected_response_when_pre_2), 0, 0, 1, 0},
  {&__pyx_kp_s_Handling_new_host_r_and_notifyin, __pyx_k_Handling_new_host_r_and_notifyin, sizeof(__pyx_k_Handling_new_host_r_and_notifyin), 0, 0, 1, 0},
  {&__pyx_n_s_Host, __pyx_k_Host, sizeof(__pyx_k_Host), 0, 0, 1, 1},
  {&__pyx_n_s_HostConnection, __pyx_k_HostConnection, sizeof(__pyx_k_HostConnection), 0, 0, 1, 1},
  {&__pyx_n_s_HostConnectionPool, __pyx_k_HostConnectionPool, sizeof(__pyx_k_HostConnectionPool), 0, 0, 1, 1},
  {&__pyx_n_s_HostDistance, __pyx_k_HostDistance, sizeof(__pyx_k_HostDistance), 0, 0, 1, 1},
  {&__pyx_n_s_HostReconnectionHandler, __pyx_k_HostReconnectionHandler, sizeof(__pyx_k_HostReconnectionHandler), 0, 0, 1, 1},
  {&__pyx_kp_s_Host_has_been_marked_down_or_rem, __pyx_k_Host_has_been_marked_down_or_rem, sizeof(__pyx_k_Host_has_been_marked_down_or_rem), 0, 0, 1, 0},
  {&__pyx_kp_s_Host_s_has_been_marked_down, __pyx_k_Host_s_has_been_marked_down, sizeof(__pyx_k_Host_s_has_been_marked_down), 0, 0, 1, 0},
  {&__pyx_kp_s_Host_s_is_overloaded_retrying_ag, __pyx_k_Host_s_is_overloaded_retrying_ag, sizeof(__pyx_k_Host_s_is_overloaded_retrying_ag), 0, 0, 1, 0},
  {&__pyx_kp_s_Host_s_may_be_up_will_prepare_qu, __pyx_k_Host_s_may_be_up_will_prepare_qu, sizeof(__pyx_k_Host_s_may_be_up_will_prepare_qu), 0, 0, 1, 0},
  {&__pyx_kp_s_Host_s_was_already_marked_up, __pyx_k_Host_s_was_already_marked_up, sizeof(__pyx_k_Host_s_was_already_marked_up), 0, 0, 1, 0},
  {&__pyx_n_s_IGNORED, __pyx_k_IGNORED, sizeof(__pyx_k_IGNORED), 0, 0, 1, 1},
  {&__pyx_kp_s_Ignoring_schedule_unique_for_alr, __pyx_k_Ignoring_schedule_unique_for_alr, sizeof(__pyx_k_Ignoring_schedule_unique_for_alr), 0, 0, 1, 0},
  {&__pyx_kp_s_Ignoring_scheduled_task_after_sh, __pyx_k_Ignoring_scheduled_task_after_sh, sizeof(__pyx_k_Ignoring_scheduled_task_after_sh), 0, 0, 1, 0},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_kp_s_Internal, __pyx_k_Internal, sizeof(__pyx_k_Internal), 0, 0, 1, 0},
  {&__pyx_n_s_InvalidRequest, __pyx_k_InvalidRequest, sizeof(__pyx_k_InvalidRequest), 0, 0, 1, 1},
  {&__pyx_n_s_IsBootstrappingErrorMessage, __pyx_k_IsBootstrappingErrorMessage, sizeof(__pyx_k_IsBootstrappingErrorMessage), 0, 0, 1, 1},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_kp_s_Keyspace_metadata_was_not_refres, __pyx_k_Keyspace_metadata_was_not_refres, sizeof(__pyx_k_Keyspace_metadata_was_not_refres), 0, 0, 1, 0},
  {&__pyx_kp_s_Keyspace_s_does_not_exist_or_has, __pyx_k_Keyspace_s_does_not_exist_or_has, sizeof(__pyx_k_Keyspace_s_does_not_exist_or_has), 0, 0, 1, 0},
  {&__pyx_n_s_LOCAL, __pyx_k_LOCAL, sizeof(__pyx_k_LOCAL), 0, 0, 1, 1},
  {&__pyx_n_s_LibevConnection, __pyx_k_LibevConnection, sizeof(__pyx_k_LibevConnection), 0, 0, 1, 1},
  {&__pyx_n_s_Lock, __pyx_k_Lock, sizeof(__pyx_k_Lock), 0, 0, 1, 1},
  {&__pyx_n_s_MIN_SUPPORTED_VERSION, __pyx_k_MIN_SUPPORTED_VERSION, sizeof(__pyx_k_MIN_SUPPORTED_VERSION), 0, 0, 1, 1},
  {&__pyx_n_s_MOVED_NODE, __pyx_k_MOVED_NODE, sizeof(__pyx_k_MOVED_NODE), 0, 0, 1, 1},
  {&__pyx_n_s_Metadata, __pyx_k_Metadata, sizeof(__pyx_k_Metadata), 0, 0, 1, 1},
  {&__pyx_n_s_Metrics, __pyx_k_Metrics, sizeof(__pyx_k_Metrics), 0, 0, 1, 1},
  {&__pyx_n_s_NEW_NODE, __pyx_k_NEW_NODE, sizeof(__pyx_k_NEW_NODE), 0, 0, 1, 1},
  {&__pyx_n_s_NOT_SET, __pyx_k_NOT_SET, sizeof(__pyx_k_NOT_SET), 0, 0, 1, 1},
  {&__pyx_kp_s_New_Cassandra_host_r_discovered, __pyx_k_New_Cassandra_host_r_discovered, sizeof(__pyx_k_New_Cassandra_host_r_discovered), 0, 0, 1, 0},
  {&__pyx_n_s_NoConnectionsAvailable, __pyx_k_NoConnectionsAvailable, sizeof(__pyx_k_NoConnectionsAvailable), 0, 0, 1, 1},
  {&__pyx_n_s_NoHostAvailable, __pyx_k_NoHostAvailable, sizeof(__pyx_k_NoHostAvailable), 0, 0, 1, 1},
  {&__pyx_n_s_NoHostAvailable___init, __pyx_k_NoHostAvailable___init, sizeof(__pyx_k_NoHostAvailable___init), 0, 0, 1, 1},
  {&__pyx_kp_s_Node_list_was_not_refreshed_See, __pyx_k_Node_list_was_not_refreshed_See, sizeof(__pyx_k_Node_list_was_not_refreshed_See), 0, 0, 1, 0},
  {&__pyx_kp_s_Node_s_is_reporting_a_schema_dis, __pyx_k_Node_s_is_reporting_a_schema_dis, sizeof(__pyx_k_Node_s_is_reporting_a_schema_dis), 0, 0, 1, 0},
  {&__pyx_kp_s_Not_adding_connection_pool_for_n, __pyx_k_Not_adding_connection_pool_for_n, sizeof(__pyx_k_Not_adding_connection_pool_for_n), 0, 0, 1, 0},
  {&__pyx_kp_s_Not_executing_scheduled_task_due, __pyx_k_Not_executing_scheduled_task_due, sizeof(__pyx_k_Not_executing_scheduled_task_due), 0, 0, 1, 0},
  {&__pyx_kp_s_Now_that_host_s_is_up_cancelling, __pyx_k_Now_that_host_s_is_up_cancelling, sizeof(__pyx_k_Now_that_host_s_is_up_cancelling), 0, 0, 1, 0},
  {&__pyx_n_s_ONE, __pyx_k_ONE, sizeof(__pyx_k_ONE), 0, 0, 1, 1},
  {&__pyx_kp_s_Old_host_reconnector_found_for_s, __pyx_k_Old_host_reconnector_found_for_s, sizeof(__pyx_k_Old_host_reconnector_found_for_s), 0, 0, 1, 0},
  {&__pyx_n_s_OperationTimedOut, __pyx_k_OperationTimedOut, sizeof(__pyx_k_OperationTimedOut), 0, 0, 1, 1},
  {&__pyx_n_s_OverloadedErrorMessage, __pyx_k_OverloadedErrorMessage, sizeof(__pyx_k_OverloadedErrorMessage), 0, 0, 1, 1},
  {&__pyx_n_s_PY2, __pyx_k_PY2, sizeof(__pyx_k_PY2), 0, 0, 1, 1},
  {&__pyx_n_s_PagedResult, __pyx_k_PagedResult, sizeof(__pyx_k_PagedResult), 0, 0, 1, 1},
  {&__pyx_n_s_PagedResult___init, __pyx_k_PagedResult___init, sizeof(__pyx_k_PagedResult___init), 0, 0, 1, 1},
  {&__pyx_n_s_PagedResult___iter, __pyx_k_PagedResult___iter, sizeof(__pyx_k_PagedResult___iter), 0, 0, 1, 1},
  {&__pyx_n_s_PagedResult_next, __pyx_k_PagedResult_next, sizeof(__pyx_k_PagedResult_next), 0, 0, 1, 1},
  {&__pyx_kp_s_Pool_is_shutdown, __pyx_k_Pool_is_shutdown, sizeof(__pyx_k_Pool_is_shutdown), 0, 0, 1, 0},
  {&__pyx_n_s_PrepareMessage, __pyx_k_PrepareMessage, sizeof(__pyx_k_PrepareMessage), 0, 0, 1, 1},
  {&__pyx_n_s_PreparedQueryNotFound, __pyx_k_PreparedQueryNotFound, sizeof(__pyx_k_PreparedQueryNotFound), 0, 0, 1, 1},
  {&__pyx_n_s_PreparedStatement, __pyx_k_PreparedStatement, sizeof(__pyx_k_PreparedStatement), 0, 0, 1, 1},
  {&__pyx_kp_u_Prepares_a_query_string_returni, __pyx_k_Prepares_a_query_string_returni, sizeof(__pyx_k_Prepares_a_query_string_returni), 0, 1, 0, 0},
  {&__pyx_kp_s_Preparing_all_known_prepared_sta, __pyx_k_Preparing_all_known_prepared_sta, sizeof(__pyx_k_Preparing_all_known_prepared_sta), 0, 0, 1, 0},
  {&__pyx_n_s_PriorityQueue, __pyx_k_PriorityQueue, sizeof(__pyx_k_PriorityQueue), 0, 0, 1, 1},
  {&__pyx_n_s_ProtocolHandler, __pyx_k_ProtocolHandler, sizeof(__pyx_k_ProtocolHandler), 0, 0, 1, 1},
  {&__pyx_n_s_ProtocolVersionUnsupported, __pyx_k_ProtocolVersionUnsupported, sizeof(__pyx_k_ProtocolVersionUnsupported), 0, 0, 1, 1},
  {&__pyx_n_s_QueryExhausted, __pyx_k_QueryExhausted, sizeof(__pyx_k_QueryExhausted), 0, 0, 1, 1},
  {&__pyx_n_s_QueryMessage, __pyx_k_QueryMessage, sizeof(__pyx_k_QueryMessage), 0, 0, 1, 1},
  {&__pyx_n_s_QueryTrace, __pyx_k_QueryTrace, sizeof(__pyx_k_QueryTrace), 0, 0, 1, 1},
  {&__pyx_n_s_Queue, __pyx_k_Queue, sizeof(__pyx_k_Queue), 0, 0, 1, 1},
  {&__pyx_n_s_REMOTE, __pyx_k_REMOTE, sizeof(__pyx_k_REMOTE), 0, 0, 1, 1},
  {&__pyx_n_s_REMOVED_NODE, __pyx_k_REMOVED_NODE, sizeof(__pyx_k_REMOVED_NODE), 0, 0, 1, 1},
  {&__pyx_n_s_RESULT_KIND_PREPARED, __pyx_k_RESULT_KIND_PREPARED, sizeof(__pyx_k_RESULT_KIND_PREPARED), 0, 0, 1, 1},
  {&__pyx_n_s_RESULT_KIND_ROWS, __pyx_k_RESULT_KIND_ROWS, sizeof(__pyx_k_RESULT_KIND_ROWS), 0, 0, 1, 1},
  {&__pyx_n_s_RESULT_KIND_SCHEMA_CHANGE, __pyx_k_RESULT_KIND_SCHEMA_CHANGE, sizeof(__pyx_k_RESULT_KIND_SCHEMA_CHANGE), 0, 0, 1, 1},
  {&__pyx_n_s_RESULT_KIND_SET_KEYSPACE, __pyx_k_RESULT_KIND_SET_KEYSPACE, sizeof(__pyx_k_RESULT_KIND_SET_KEYSPACE), 0, 0, 1, 1},
  {&__pyx_n_s_RETHROW, __pyx_k_RETHROW, sizeof(__pyx_k_RETHROW), 0, 0, 1, 1},
  {&__pyx_n_s_RETRY, __pyx_k_RETRY, sizeof(__pyx_k_RETRY), 0, 0, 1, 1},
  {&__pyx_n_s_RLock, __pyx_k_RLock, sizeof(__pyx_k_RLock), 0, 0, 1, 1},
  {&__pyx_kp_s_Raised_when_an_operation_is_att, __pyx_k_Raised_when_an_operation_is_att, sizeof(__pyx_k_Raised_when_an_operation_is_att), 0, 0, 1, 0},
  {&__pyx_kp_s_Raised_when_meth_ResponseFuture, __pyx_k_Raised_when_meth_ResponseFuture, sizeof(__pyx_k_Raised_when_meth_ResponseFuture), 0, 0, 1, 0},
  {&__pyx_kp_s_Re_preparing_unrecognized_prepar, __pyx_k_Re_preparing_unrecognized_prepar, sizeof(__pyx_k_Re_preparing_unrecognized_prepar), 0, 0, 1, 0},
  {&__pyx_n_s_ReadTimeoutErrorMessage, __pyx_k_ReadTimeoutErrorMessage, sizeof(__pyx_k_ReadTimeoutErrorMessage), 0, 0, 1, 1},
  {&__pyx_n_s_ReconnectionHandler, __pyx_k_ReconnectionHandler, sizeof(__pyx_k_ReconnectionHandler), 0, 0, 1, 1},
  {&__pyx_n_s_ReferenceError, __pyx_k_ReferenceError, sizeof(__pyx_k_ReferenceError), 0, 0, 1, 1},
  {&__pyx_kp_s_Refreshing_schema_in_response_to, __pyx_k_Refreshing_schema_in_response_to, sizeof(__pyx_k_Refreshing_schema_in_response_to), 0, 0, 1, 0},
  {&__pyx_kp_s_Removed_connection_pool_for_r, __pyx_k_Removed_connection_pool_for_r, sizeof(__pyx_k_Removed_connection_pool_for_r), 0, 0, 1, 0},
  {&__pyx_kp_s_Removing_host_s, __pyx_k_Removing_host_s, sizeof(__pyx_k_Removing_host_s), 0, 0, 1, 0},
  {&__pyx_n_s_ResponseFuture, __pyx_k_ResponseFuture, sizeof(__pyx_k_ResponseFuture), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture___init, __pyx_k_ResponseFuture___init, sizeof(__pyx_k_ResponseFuture___init), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture___str, __pyx_k_ResponseFuture___str, sizeof(__pyx_k_ResponseFuture___str), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture__cancel_timer, __pyx_k_ResponseFuture__cancel_timer, sizeof(__pyx_k_ResponseFuture__cancel_timer), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture__execute_after_pr, __pyx_k_ResponseFuture__execute_after_pr, sizeof(__pyx_k_ResponseFuture__execute_after_pr), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture__make_query_plan, __pyx_k_ResponseFuture__make_query_plan, sizeof(__pyx_k_ResponseFuture__make_query_plan), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture__on_timeout, __pyx_k_ResponseFuture__on_timeout, sizeof(__pyx_k_ResponseFuture__on_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture__query, __pyx_k_ResponseFuture__query, sizeof(__pyx_k_ResponseFuture__query), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture__reprepare, __pyx_k_ResponseFuture__reprepare, sizeof(__pyx_k_ResponseFuture__reprepare), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture__retry, __pyx_k_ResponseFuture__retry, sizeof(__pyx_k_ResponseFuture__retry), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture__retry_task, __pyx_k_ResponseFuture__retry_task, sizeof(__pyx_k_ResponseFuture__retry_task), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture__set_final_except, __pyx_k_ResponseFuture__set_final_except, sizeof(__pyx_k_ResponseFuture__set_final_except), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture__set_final_result, __pyx_k_ResponseFuture__set_final_result, sizeof(__pyx_k_ResponseFuture__set_final_result), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture__set_keyspace_com, __pyx_k_ResponseFuture__set_keyspace_com, sizeof(__pyx_k_ResponseFuture__set_keyspace_com), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture__set_result, __pyx_k_ResponseFuture__set_result, sizeof(__pyx_k_ResponseFuture__set_result), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture__start_timer, __pyx_k_ResponseFuture__start_timer, sizeof(__pyx_k_ResponseFuture__start_timer), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture_add_callback, __pyx_k_ResponseFuture_add_callback, sizeof(__pyx_k_ResponseFuture_add_callback), 0, 0, 1, 1},
  {&__pyx_kp_u_ResponseFuture_add_callback_line, __pyx_k_ResponseFuture_add_callback_line, sizeof(__pyx_k_ResponseFuture_add_callback_line), 0, 1, 0, 0},
  {&__pyx_n_s_ResponseFuture_add_callbacks, __pyx_k_ResponseFuture_add_callbacks, sizeof(__pyx_k_ResponseFuture_add_callbacks), 0, 0, 1, 1},
  {&__pyx_kp_u_ResponseFuture_add_callbacks_lin, __pyx_k_ResponseFuture_add_callbacks_lin, sizeof(__pyx_k_ResponseFuture_add_callbacks_lin), 0, 1, 0, 0},
  {&__pyx_n_s_ResponseFuture_add_errback, __pyx_k_ResponseFuture_add_errback, sizeof(__pyx_k_ResponseFuture_add_errback), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture_clear_callbacks, __pyx_k_ResponseFuture_clear_callbacks, sizeof(__pyx_k_ResponseFuture_clear_callbacks), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture_custom_payload, __pyx_k_ResponseFuture_custom_payload, sizeof(__pyx_k_ResponseFuture_custom_payload), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture_get_query_trace, __pyx_k_ResponseFuture_get_query_trace, sizeof(__pyx_k_ResponseFuture_get_query_trace), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture_has_more_pages, __pyx_k_ResponseFuture_has_more_pages, sizeof(__pyx_k_ResponseFuture_has_more_pages), 0, 0, 1, 1},
  {&__pyx_kp_s_ResponseFuture_query_s_request, __pyx_k_ResponseFuture_query_s_request, sizeof(__pyx_k_ResponseFuture_query_s_request), 0, 0, 1, 0},
  {&__pyx_n_s_ResponseFuture_result, __pyx_k_ResponseFuture_result, sizeof(__pyx_k_ResponseFuture_result), 0, 0, 1, 1},
  {&__pyx_kp_u_ResponseFuture_result_line_3288, __pyx_k_ResponseFuture_result_line_3288, sizeof(__pyx_k_ResponseFuture_result_line_3288), 0, 1, 0, 0},
  {&__pyx_kp_s_ResponseFuture_result_timeout_ar, __pyx_k_ResponseFuture_result_timeout_ar, sizeof(__pyx_k_ResponseFuture_result_timeout_ar), 0, 0, 1, 0},
  {&__pyx_n_s_ResponseFuture_send_request, __pyx_k_ResponseFuture_send_request, sizeof(__pyx_k_ResponseFuture_send_request), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture_start_fetching_ne, __pyx_k_ResponseFuture_start_fetching_ne, sizeof(__pyx_k_ResponseFuture_start_fetching_ne), 0, 0, 1, 1},
  {&__pyx_n_s_ResponseFuture_warnings, __pyx_k_ResponseFuture_warnings, sizeof(__pyx_k_ResponseFuture_warnings), 0, 0, 1, 1},
  {&__pyx_n_s_ResultMessage, __pyx_k_ResultMessage, sizeof(__pyx_k_ResultMessage), 0, 0, 1, 1},
  {&__pyx_n_s_RetryPolicy, __pyx_k_RetryPolicy, sizeof(__pyx_k_RetryPolicy), 0, 0, 1, 1},
  {&__pyx_kp_u_Return_the_final_result_or_rais, __pyx_k_Return_the_final_result_or_rais, sizeof(__pyx_k_Return_the_final_result_or_rais), 0, 1, 0, 0},
  {&__pyx_n_s_SCHEMA_CHANGE, __pyx_k_SCHEMA_CHANGE, sizeof(__pyx_k_SCHEMA_CHANGE), 0, 0, 1, 1},
  {&__pyx_n_s_SELECT_AGGREGATES, __pyx_k_SELECT_AGGREGATES, sizeof(__pyx_k_SELECT_AGGREGATES), 0, 0, 1, 1},
  {&__pyx_n_s_SELECT_COLUMNS, __pyx_k_SELECT_COLUMNS, sizeof(__pyx_k_SELECT_COLUMNS), 0, 0, 1, 1},
  {&__pyx_n_s_SELECT_COLUMN_FAMILIES, __pyx_k_SELECT_COLUMN_FAMILIES, sizeof(__pyx_k_SELECT_COLUMN_FAMILIES), 0, 0, 1, 1},
  {&__pyx_kp_s_SELECT_FROM_system_schema_aggreg, __pyx_k_SELECT_FROM_system_schema_aggreg, sizeof(__pyx_k_SELECT_FROM_system_schema_aggreg), 0, 0, 1, 0},
  {&__pyx_kp_s_SELECT_FROM_system_schema_column, __pyx_k_SELECT_FROM_system_schema_column, sizeof(__pyx_k_SELECT_FROM_system_schema_column), 0, 0, 1, 0},
  {&__pyx_kp_s_SELECT_FROM_system_schema_column_2, __pyx_k_SELECT_FROM_system_schema_column_2, sizeof(__pyx_k_SELECT_FROM_system_schema_column_2), 0, 0, 1, 0},
  {&__pyx_kp_s_SELECT_FROM_system_schema_functi, __pyx_k_SELECT_FROM_system_schema_functi, sizeof(__pyx_k_SELECT_FROM_system_schema_functi), 0, 0, 1, 0},
  {&__pyx_kp_s_SELECT_FROM_system_schema_keyspa, __pyx_k_SELECT_FROM_system_schema_keyspa, sizeof(__pyx_k_SELECT_FROM_system_schema_keyspa), 0, 0, 1, 0},
  {&__pyx_kp_s_SELECT_FROM_system_schema_trigge, __pyx_k_SELECT_FROM_system_schema_trigge, sizeof(__pyx_k_SELECT_FROM_system_schema_trigge), 0, 0, 1, 0},
  {&__pyx_kp_s_SELECT_FROM_system_schema_userty, __pyx_k_SELECT_FROM_system_schema_userty, sizeof(__pyx_k_SELECT_FROM_system_schema_userty), 0, 0, 1, 0},
  {&__pyx_n_s_SELECT_FUNCTIONS, __pyx_k_SELECT_FUNCTIONS, sizeof(__pyx_k_SELECT_FUNCTIONS), 0, 0, 1, 1},
  {&__pyx_n_s_SELECT_KEYSPACES, __pyx_k_SELECT_KEYSPACES, sizeof(__pyx_k_SELECT_KEYSPACES), 0, 0, 1, 1},
  {&__pyx_n_s_SELECT_LOCAL, __pyx_k_SELECT_LOCAL, sizeof(__pyx_k_SELECT_LOCAL), 0, 0, 1, 1},
  {&__pyx_n_s_SELECT_PEERS, __pyx_k_SELECT_PEERS, sizeof(__pyx_k_SELECT_PEERS), 0, 0, 1, 1},
  {&__pyx_n_s_SELECT_SCHEMA_LOCAL, __pyx_k_SELECT_SCHEMA_LOCAL, sizeof(__pyx_k_SELECT_SCHEMA_LOCAL), 0, 0, 1, 1},
  {&__pyx_n_s_SELECT_SCHEMA_PEERS, __pyx_k_SELECT_SCHEMA_PEERS, sizeof(__pyx_k_SELECT_SCHEMA_PEERS), 0, 0, 1, 1},
  {&__pyx_n_s_SELECT_TRIGGERS, __pyx_k_SELECT_TRIGGERS, sizeof(__pyx_k_SELECT_TRIGGERS), 0, 0, 1, 1},
  {&__pyx_n_s_SELECT_USERTYPES, __pyx_k_SELECT_USERTYPES, sizeof(__pyx_k_SELECT_USERTYPES), 0, 0, 1, 1},
  {&__pyx_kp_s_SELECT_cluster_name_data_center, __pyx_k_SELECT_cluster_name_data_center, sizeof(__pyx_k_SELECT_cluster_name_data_center), 0, 0, 1, 0},
  {&__pyx_kp_s_SELECT_peer_data_center_rack_tok, __pyx_k_SELECT_peer_data_center_rack_tok, sizeof(__pyx_k_SELECT_peer_data_center_rack_tok), 0, 0, 1, 0},
  {&__pyx_kp_s_SELECT_peer_rpc_address_schema_v, __pyx_k_SELECT_peer_rpc_address_schema_v, sizeof(__pyx_k_SELECT_peer_rpc_address_schema_v), 0, 0, 1, 0},
  {&__pyx_kp_s_SELECT_schema_version_FROM_syste, __pyx_k_SELECT_schema_version_FROM_syste, sizeof(__pyx_k_SELECT_schema_version_FROM_syste), 0, 0, 1, 0},
  {&__pyx_n_s_STATUS_CHANGE, __pyx_k_STATUS_CHANGE, sizeof(__pyx_k_STATUS_CHANGE), 0, 0, 1, 1},
  {&__pyx_n_s_Scheduler, __pyx_k_Scheduler, sizeof(__pyx_k_Scheduler), 0, 0, 1, 1},
  {&__pyx_n_s_Scheduler___init, __pyx_k_Scheduler___init, sizeof(__pyx_k_Scheduler___init), 0, 0, 1, 1},
  {&__pyx_n_s_Scheduler__insert_task, __pyx_k_Scheduler__insert_task, sizeof(__pyx_k_Scheduler__insert_task), 0, 0, 1, 1},
  {&__pyx_n_s_Scheduler__log_if_failed, __pyx_k_Scheduler__log_if_failed, sizeof(__pyx_k_Scheduler__log_if_failed), 0, 0, 1, 1},
  {&__pyx_n_s_Scheduler_run, __pyx_k_Scheduler_run, sizeof(__pyx_k_Scheduler_run), 0, 0, 1, 1},
  {&__pyx_n_s_Scheduler_schedule, __pyx_k_Scheduler_schedule, sizeof(__pyx_k_Scheduler_schedule), 0, 0, 1, 1},
  {&__pyx_n_s_Scheduler_schedule_unique, __pyx_k_Scheduler_schedule_unique, sizeof(__pyx_k_Scheduler_schedule_unique), 0, 0, 1, 1},
  {&__pyx_n_s_Scheduler_shutdown, __pyx_k_Scheduler_shutdown, sizeof(__pyx_k_Scheduler_shutdown), 0, 0, 1, 1},
  {&__pyx_kp_s_Schema_metadata_was_not_refreshe, __pyx_k_Schema_metadata_was_not_refreshe, sizeof(__pyx_k_Schema_metadata_was_not_refreshe), 0, 0, 1, 0},
  {&__pyx_kp_s_Schema_was_not_refreshed_See_log, __pyx_k_Schema_was_not_refreshed_See_log, sizeof(__pyx_k_Schema_was_not_refreshed_See_log), 0, 0, 1, 0},
  {&__pyx_n_s_Session, __pyx_k_Session, sizeof(__pyx_k_Session), 0, 0, 1, 1},
  {&__pyx_n_s_Session___init, __pyx_k_Session___init, sizeof(__pyx_k_Session___init), 0, 0, 1, 1},
  {&__pyx_n_s_Session__create_response_future, __pyx_k_Session__create_response_future, sizeof(__pyx_k_Session__create_response_future), 0, 0, 1, 1},
  {&__pyx_n_s_Session__set_keyspace_for_all_po, __pyx_k_Session__set_keyspace_for_all_po, sizeof(__pyx_k_Session__set_keyspace_for_all_po), 0, 0, 1, 1},
  {&__pyx_n_s_Session__set_keyspace_for_all_po_2, __pyx_k_Session__set_keyspace_for_all_po_2, sizeof(__pyx_k_Session__set_keyspace_for_all_po_2), 0, 0, 1, 1},
  {&__pyx_n_s_Session_add_or_renew_pool, __pyx_k_Session_add_or_renew_pool, sizeof(__pyx_k_Session_add_or_renew_pool), 0, 0, 1, 1},
  {&__pyx_n_s_Session_add_or_renew_pool_locals, __pyx_k_Session_add_or_renew_pool_locals, sizeof(__pyx_k_Session_add_or_renew_pool_locals), 0, 0, 1, 1},
  {&__pyx_n_s_Session_execute, __pyx_k_Session_execute, sizeof(__pyx_k_Session_execute), 0, 0, 1, 1},
  {&__pyx_n_s_Session_execute_async, __pyx_k_Session_execute_async, sizeof(__pyx_k_Session_execute_async), 0, 0, 1, 1},
  {&__pyx_kp_u_Session_execute_async_line_1615, __pyx_k_Session_execute_async_line_1615, sizeof(__pyx_k_Session_execute_async_line_1615), 0, 1, 0, 0},
  {&__pyx_n_s_Session_get_pool_state, __pyx_k_Session_get_pool_state, sizeof(__pyx_k_Session_get_pool_state), 0, 0, 1, 1},
  {&__pyx_n_s_Session_get_pool_state_locals_ge, __pyx_k_Session_get_pool_state_locals_ge, sizeof(__pyx_k_Session_get_pool_state_locals_ge), 0, 0, 1, 1},
  {&__pyx_n_s_Session_get_pools, __pyx_k_Session_get_pools, sizeof(__pyx_k_Session_get_pools), 0, 0, 1, 1},
  {&__pyx_n_s_Session_on_down, __pyx_k_Session_on_down, sizeof(__pyx_k_Session_on_down), 0, 0, 1, 1},
  {&__pyx_n_s_Session_on_down_locals_lambda, __pyx_k_Session_on_down_locals_lambda, sizeof(__pyx_k_Session_on_down_locals_lambda), 0, 0, 1, 1},
  {&__pyx_n_s_Session_on_remove, __pyx_k_Session_on_remove, sizeof(__pyx_k_Session_on_remove), 0, 0, 1, 1},
  {&__pyx_n_s_Session_prepare, __pyx_k_Session_prepare, sizeof(__pyx_k_Session_prepare), 0, 0, 1, 1},
  {&__pyx_kp_u_Session_prepare_line_1725, __pyx_k_Session_prepare_line_1725, sizeof(__pyx_k_Session_prepare_line_1725), 0, 1, 0, 0},
  {&__pyx_n_s_Session_prepare_on_all_hosts, __pyx_k_Session_prepare_on_all_hosts, sizeof(__pyx_k_Session_prepare_on_all_hosts), 0, 0, 1, 1},
  {&__pyx_n_s_Session_remove_pool, __pyx_k_Session_remove_pool, sizeof(__pyx_k_Session_remove_pool), 0, 0, 1, 1},
  {&__pyx_n_s_Session_set_keyspace, __pyx_k_Session_set_keyspace, sizeof(__pyx_k_Session_set_keyspace), 0, 0, 1, 1},
  {&__pyx_n_s_Session_shutdown, __pyx_k_Session_shutdown, sizeof(__pyx_k_Session_shutdown), 0, 0, 1, 1},
  {&__pyx_n_s_Session_submit, __pyx_k_Session_submit, sizeof(__pyx_k_Session_submit), 0, 0, 1, 1},
  {&__pyx_n_s_Session_update_created_pools, __pyx_k_Session_update_created_pools, sizeof(__pyx_k_Session_update_created_pools), 0, 0, 1, 1},
  {&__pyx_n_s_Session_user_type_registered, __pyx_k_Session_user_type_registered, sizeof(__pyx_k_Session_user_type_registered), 0, 0, 1, 1},
  {&__pyx_n_s_Session_user_type_registered_loc, __pyx_k_Session_user_type_registered_loc, sizeof(__pyx_k_Session_user_type_registered_loc), 0, 0, 1, 1},
  {&__pyx_n_s_Session_user_type_registered_loc_2, __pyx_k_Session_user_type_registered_loc_2, sizeof(__pyx_k_Session_user_type_registered_loc_2), 0, 0, 1, 1},
  {&__pyx_kp_s_Shutting_down_Cluster_Scheduler, __pyx_k_Shutting_down_Cluster_Scheduler, sizeof(__pyx_k_Shutting_down_Cluster_Scheduler), 0, 0, 1, 0},
  {&__pyx_kp_s_Shutting_down_control_connection, __pyx_k_Shutting_down_control_connection, sizeof(__pyx_k_Shutting_down_control_connection), 0, 0, 1, 0},
  {&__pyx_kp_s_Signalling_to_control_connection, __pyx_k_Signalling_to_control_connection, sizeof(__pyx_k_Signalling_to_control_connection), 0, 0, 1, 0},
  {&__pyx_kp_s_Signalling_to_load_balancing_pol, __pyx_k_Signalling_to_load_balancing_pol, sizeof(__pyx_k_Signalling_to_load_balancing_pol), 0, 0, 1, 0},
  {&__pyx_n_s_SimpleConvictionPolicy, __pyx_k_SimpleConvictionPolicy, sizeof(__pyx_k_SimpleConvictionPolicy), 0, 0, 1, 1},
  {&__pyx_n_s_SimpleStatement, __pyx_k_SimpleStatement, sizeof(__pyx_k_SimpleStatement), 0, 0, 1, 1},
  {&__pyx_kp_s_Skipping_schema_refresh_due_to_l, __pyx_k_Skipping_schema_refresh_due_to_l, sizeof(__pyx_k_Skipping_schema_refresh_due_to_l), 0, 0, 1, 0},
  {&__pyx_kp_s_Skipping_schema_refresh_in_respo, __pyx_k_Skipping_schema_refresh_in_respo, sizeof(__pyx_k_Skipping_schema_refresh_in_respo), 0, 0, 1, 0},
  {&__pyx_kp_s_Starting_reconnector_for_host_s, __pyx_k_Starting_reconnector_for_host_s, sizeof(__pyx_k_Starting_reconnector_for_host_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Starting_to_handle_up_status_of, __pyx_k_Starting_to_handle_up_status_of, sizeof(__pyx_k_Starting_to_handle_up_status_of), 0, 0, 1, 0},
  {&__pyx_n_s_Statement, __pyx_k_Statement, sizeof(__pyx_k_Statement), 0, 0, 1, 1},
  {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
  {&__pyx_n_s_TOPOLOGY_CHANGE, __pyx_k_TOPOLOGY_CHANGE, sizeof(__pyx_k_TOPOLOGY_CHANGE), 0, 0, 1, 1},
  {&__pyx_kp_s_Table_metadata_was_not_refreshed, __pyx_k_Table_metadata_was_not_refreshed, sizeof(__pyx_k_Table_metadata_was_not_refreshed), 0, 0, 1, 0},
  {&__pyx_kp_s_Task_Scheduler, __pyx_k_Task_Scheduler, sizeof(__pyx_k_Task_Scheduler), 0, 0, 1, 0},
  {&__pyx_kp_s_The_Session_s_current_keyspace_s, __pyx_k_The_Session_s_current_keyspace_s, sizeof(__pyx_k_The_Session_s_current_keyspace_s), 0, 0, 1, 0},
  {&__pyx_kp_s_The_main_class_to_use_when_inte, __pyx_k_The_main_class_to_use_when_inte, sizeof(__pyx_k_The_main_class_to_use_when_inte), 0, 0, 1, 0},
  {&__pyx_kp_s_The_query_argument_must_be_an_in, __pyx_k_The_query_argument_must_be_an_in, sizeof(__pyx_k_The_query_argument_must_be_an_in), 0, 0, 1, 0},
  {&__pyx_n_s_Thread, __pyx_k_Thread, sizeof(__pyx_k_Thread), 0, 0, 1, 1},
  {&__pyx_n_s_ThreadPoolExecutor, __pyx_k_ThreadPoolExecutor, sizeof(__pyx_k_ThreadPoolExecutor), 0, 0, 1, 1},
  {&__pyx_kp_s_Timed_out_trying_to_prepare_all, __pyx_k_Timed_out_trying_to_prepare_all, sizeof(__pyx_k_Timed_out_trying_to_prepare_all), 0, 0, 1, 0},
  {&__pyx_n_s_TokenAwarePolicy, __pyx_k_TokenAwarePolicy, sizeof(__pyx_k_TokenAwarePolicy), 0, 0, 1, 1},
  {&__pyx_kp_s_Tried_to_execute_unknown_prepare, __pyx_k_Tried_to_execute_unknown_prepare, sizeof(__pyx_k_Tried_to_execute_unknown_prepare), 0, 0, 1, 0},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_UP, __pyx_k_UP, sizeof(__pyx_k_UP), 0, 0, 1, 1},
  {&__pyx_kp_s_USE_s, __pyx_k_USE_s, sizeof(__pyx_k_USE_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Unable_to_complete_the_operation, __pyx_k_Unable_to_complete_the_operation, sizeof(__pyx_k_Unable_to_complete_the_operation), 0, 0, 1, 0},
  {&__pyx_kp_s_Unable_to_connect_to_any_servers, __pyx_k_Unable_to_connect_to_any_servers, sizeof(__pyx_k_Unable_to_connect_to_any_servers), 0, 0, 1, 0},
  {&__pyx_kp_s_Unable_to_fetch_query_trace, __pyx_k_Unable_to_fetch_query_trace, sizeof(__pyx_k_Unable_to_fetch_query_trace), 0, 0, 1, 0},
  {&__pyx_n_s_Unauthorized, __pyx_k_Unauthorized, sizeof(__pyx_k_Unauthorized), 0, 0, 1, 1},
  {&__pyx_n_s_UnavailableErrorMessage, __pyx_k_UnavailableErrorMessage, sizeof(__pyx_k_UnavailableErrorMessage), 0, 0, 1, 1},
  {&__pyx_kp_s_Unexpected_exception_while_handl, __pyx_k_Unexpected_exception_while_handl, sizeof(__pyx_k_Unexpected_exception_while_handl), 0, 0, 1, 0},
  {&__pyx_kp_s_Unexpected_failure_handling_node, __pyx_k_Unexpected_failure_handling_node, sizeof(__pyx_k_Unexpected_failure_handling_node), 0, 0, 1, 0},
  {&__pyx_kp_s_Unexpected_failure_while_adding, __pyx_k_Unexpected_failure_while_adding, sizeof(__pyx_k_Unexpected_failure_while_adding), 0, 0, 1, 0},
  {&__pyx_kp_s_Unexpected_failure_while_marking, __pyx_k_Unexpected_failure_while_marking, sizeof(__pyx_k_Unexpected_failure_while_marking), 0, 0, 1, 0},
  {&__pyx_n_s_UnsupportedOperation, __pyx_k_UnsupportedOperation, sizeof(__pyx_k_UnsupportedOperation), 0, 0, 1, 1},
  {&__pyx_n_s_UserType, __pyx_k_UserType, sizeof(__pyx_k_UserType), 0, 0, 1, 1},
  {&__pyx_n_s_UserTypeDoesNotExist, __pyx_k_UserTypeDoesNotExist, sizeof(__pyx_k_UserTypeDoesNotExist), 0, 0, 1, 1},
  {&__pyx_kp_s_User_Aggregate_metadata_was_not, __pyx_k_User_Aggregate_metadata_was_not, sizeof(__pyx_k_User_Aggregate_metadata_was_not), 0, 0, 1, 0},
  {&__pyx_kp_s_User_Function_metadata_was_not_r, __pyx_k_User_Function_metadata_was_not_r, sizeof(__pyx_k_User_Function_metadata_was_not_r), 0, 0, 1, 0},
  {&__pyx_kp_s_User_Type_metadata_was_not_refre, __pyx_k_User_Type_metadata_was_not_refre, sizeof(__pyx_k_User_Type_metadata_was_not_refre), 0, 0, 1, 0},
  {&__pyx_kp_s_User_Type_serialization_is_only, __pyx_k_User_Type_serialization_is_only, sizeof(__pyx_k_User_Type_serialization_is_only), 0, 0, 1, 0},
  {&__pyx_kp_s_User_type_s_does_not_exist_in_ke, __pyx_k_User_type_s_does_not_exist_in_ke, sizeof(__pyx_k_User_type_s_does_not_exist_in_ke), 0, 0, 1, 0},
  {&__pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_k_Users_adamholmberg_git_python_m, sizeof(__pyx_k_Users_adamholmberg_git_python_m), 0, 0, 1, 0},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_kp_s_WHERE_keyspace_name_s, __pyx_k_WHERE_keyspace_name_s, sizeof(__pyx_k_WHERE_keyspace_name_s), 0, 0, 1, 0},
  {&__pyx_kp_s_WHERE_keyspace_name_s_AND_aggre, __pyx_k_WHERE_keyspace_name_s_AND_aggre, sizeof(__pyx_k_WHERE_keyspace_name_s_AND_aggre), 0, 0, 1, 0},
  {&__pyx_kp_s_WHERE_keyspace_name_s_AND_colum, __pyx_k_WHERE_keyspace_name_s_AND_colum, sizeof(__pyx_k_WHERE_keyspace_name_s_AND_colum), 0, 0, 1, 0},
  {&__pyx_kp_s_WHERE_keyspace_name_s_AND_funct, __pyx_k_WHERE_keyspace_name_s_AND_funct, sizeof(__pyx_k_WHERE_keyspace_name_s_AND_funct), 0, 0, 1, 0},
  {&__pyx_kp_s_WHERE_keyspace_name_s_AND_type, __pyx_k_WHERE_keyspace_name_s_AND_type, sizeof(__pyx_k_WHERE_keyspace_name_s_AND_type), 0, 0, 1, 0},
  {&__pyx_kp_s_Waiting_to_acquire_lock_for_hand, __pyx_k_Waiting_to_acquire_lock_for_hand, sizeof(__pyx_k_Waiting_to_acquire_lock_for_hand), 0, 0, 1, 0},
  {&__pyx_n_s_WeakSet, __pyx_k_WeakSet, sizeof(__pyx_k_WeakSet), 0, 0, 1, 1},
  {&__pyx_n_s_WeakValueDictionary, __pyx_k_WeakValueDictionary, sizeof(__pyx_k_WeakValueDictionary), 0, 0, 1, 1},
  {&__pyx_n_s_WriteTimeoutErrorMessage, __pyx_k_WriteTimeoutErrorMessage, sizeof(__pyx_k_WriteTimeoutErrorMessage), 0, 0, 1, 1},
  {&__pyx_kp_s__101, __pyx_k__101, sizeof(__pyx_k__101), 0, 0, 1, 0},
  {&__pyx_kp_s__159, __pyx_k__159, sizeof(__pyx_k__159), 0, 0, 1, 0},
  {&__pyx_n_s__359, __pyx_k__359, sizeof(__pyx_k__359), 0, 0, 1, 1},
  {&__pyx_kp_s__67, __pyx_k__67, sizeof(__pyx_k__67), 0, 0, 1, 0},
  {&__pyx_kp_s__85, __pyx_k__85, sizeof(__pyx_k__85), 0, 0, 1, 0},
  {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
  {&__pyx_n_s_addValue, __pyx_k_addValue, sizeof(__pyx_k_addValue), 0, 0, 1, 1},
  {&__pyx_n_s_add_callback, __pyx_k_add_callback, sizeof(__pyx_k_add_callback), 0, 0, 1, 1},
  {&__pyx_n_s_add_callbacks, __pyx_k_add_callbacks, sizeof(__pyx_k_add_callbacks), 0, 0, 1, 1},
  {&__pyx_n_s_add_done_callback, __pyx_k_add_done_callback, sizeof(__pyx_k_add_done_callback), 0, 0, 1, 1},
  {&__pyx_n_s_add_errback, __pyx_k_add_errback, sizeof(__pyx_k_add_errback), 0, 0, 1, 1},
  {&__pyx_n_s_add_host, __pyx_k_add_host, sizeof(__pyx_k_add_host), 0, 0, 1, 1},
  {&__pyx_n_s_add_or_renew_pool, __pyx_k_add_or_renew_pool, sizeof(__pyx_k_add_or_renew_pool), 0, 0, 1, 1},
  {&__pyx_n_s_add_or_return_host, __pyx_k_add_or_return_host, sizeof(__pyx_k_add_or_return_host), 0, 0, 1, 1},
  {&__pyx_n_s_addr, __pyx_k_addr, sizeof(__pyx_k_addr), 0, 0, 1, 1},
  {&__pyx_n_s_address, __pyx_k_address, sizeof(__pyx_k_address), 0, 0, 1, 1},
  {&__pyx_n_s_aggregate, __pyx_k_aggregate, sizeof(__pyx_k_aggregate), 0, 0, 1, 1},
  {&__pyx_n_s_aggregate_changed, __pyx_k_aggregate_changed, sizeof(__pyx_k_aggregate_changed), 0, 0, 1, 1},
  {&__pyx_n_s_aggregates_query, __pyx_k_aggregates_query, sizeof(__pyx_k_aggregates_query), 0, 0, 1, 1},
  {&__pyx_n_s_aggregates_result, __pyx_k_aggregates_result, sizeof(__pyx_k_aggregates_result), 0, 0, 1, 1},
  {&__pyx_n_s_aggregates_success, __pyx_k_aggregates_success, sizeof(__pyx_k_aggregates_success), 0, 0, 1, 1},
  {&__pyx_n_s_agreed, __pyx_k_agreed, sizeof(__pyx_k_agreed), 0, 0, 1, 1},
  {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
  {&__pyx_n_s_all_hosts, __pyx_k_all_hosts, sizeof(__pyx_k_all_hosts), 0, 0, 1, 1},
  {&__pyx_n_s_any, __pyx_k_any, sizeof(__pyx_k_any), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_atexit, __pyx_k_atexit, sizeof(__pyx_k_atexit), 0, 0, 1, 1},
  {&__pyx_n_s_auth_exc, __pyx_k_auth_exc, sizeof(__pyx_k_auth_exc), 0, 0, 1, 1},
  {&__pyx_n_s_auth_provider, __pyx_k_auth_provider, sizeof(__pyx_k_auth_provider), 0, 0, 1, 1},
  {&__pyx_n_s_auth_provider_2, __pyx_k_auth_provider_2, sizeof(__pyx_k_auth_provider_2), 0, 0, 1, 1},
  {&__pyx_n_s_auth_provider_callable, __pyx_k_auth_provider_callable, sizeof(__pyx_k_auth_provider_callable), 0, 0, 1, 1},
  {&__pyx_kp_s_auth_provider_must_be_callable_w, __pyx_k_auth_provider_must_be_callable_w, sizeof(__pyx_k_auth_provider_must_be_callable_w), 0, 0, 1, 0},
  {&__pyx_kp_s_auth_provider_must_implement_the, __pyx_k_auth_provider_must_implement_the, sizeof(__pyx_k_auth_provider_must_implement_the), 0, 0, 1, 0},
  {&__pyx_n_s_authenticator, __pyx_k_authenticator, sizeof(__pyx_k_authenticator), 0, 0, 1, 1},
  {&__pyx_n_s_batch_type, __pyx_k_batch_type, sizeof(__pyx_k_batch_type), 0, 0, 1, 1},
  {&__pyx_n_s_bind, __pyx_k_bind, sizeof(__pyx_k_bind), 0, 0, 1, 1},
  {&__pyx_n_s_bind_params, __pyx_k_bind_params, sizeof(__pyx_k_bind_params), 0, 0, 1, 1},
  {&__pyx_n_s_block, __pyx_k_block, sizeof(__pyx_k_block), 0, 0, 1, 1},
  {&__pyx_n_s_borrow_connection, __pyx_k_borrow_connection, sizeof(__pyx_k_borrow_connection), 0, 0, 1, 1},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_n_s_callback, __pyx_k_callback, sizeof(__pyx_k_callback), 0, 0, 1, 1},
  {&__pyx_n_s_callback_2, __pyx_k_callback_2, sizeof(__pyx_k_callback_2), 0, 0, 1, 1},
  {&__pyx_n_s_callback_args, __pyx_k_callback_args, sizeof(__pyx_k_callback_args), 0, 0, 1, 1},
  {&__pyx_n_s_callback_kwargs, __pyx_k_callback_kwargs, sizeof(__pyx_k_callback_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_callback_lock, __pyx_k_callback_lock, sizeof(__pyx_k_callback_lock), 0, 0, 1, 1},
  {&__pyx_n_s_callbacks, __pyx_k_callbacks, sizeof(__pyx_k_callbacks), 0, 0, 1, 1},
  {&__pyx_n_s_cancel, __pyx_k_cancel, sizeof(__pyx_k_cancel), 0, 0, 1, 1},
  {&__pyx_n_s_cancel_timer, __pyx_k_cancel_timer, sizeof(__pyx_k_cancel_timer), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra, __pyx_k_cassandra, sizeof(__pyx_k_cassandra), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_cluster, __pyx_k_cassandra_cluster, sizeof(__pyx_k_cassandra_cluster), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_connection, __pyx_k_cassandra_connection, sizeof(__pyx_k_cassandra_connection), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_cqltypes, __pyx_k_cassandra_cqltypes, sizeof(__pyx_k_cassandra_cqltypes), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_encoder, __pyx_k_cassandra_encoder, sizeof(__pyx_k_cassandra_encoder), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_io_asyncorereactor, __pyx_k_cassandra_io_asyncorereactor, sizeof(__pyx_k_cassandra_io_asyncorereactor), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_io_eventletreactor, __pyx_k_cassandra_io_eventletreactor, sizeof(__pyx_k_cassandra_io_eventletreactor), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_io_geventreactor, __pyx_k_cassandra_io_geventreactor, sizeof(__pyx_k_cassandra_io_geventreactor), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_io_libevreactor, __pyx_k_cassandra_io_libevreactor, sizeof(__pyx_k_cassandra_io_libevreactor), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_metadata, __pyx_k_cassandra_metadata, sizeof(__pyx_k_cassandra_metadata), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_metrics, __pyx_k_cassandra_metrics, sizeof(__pyx_k_cassandra_metrics), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_policies, __pyx_k_cassandra_policies, sizeof(__pyx_k_cassandra_policies), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_pool, __pyx_k_cassandra_pool, sizeof(__pyx_k_cassandra_pool), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_protocol, __pyx_k_cassandra_protocol, sizeof(__pyx_k_cassandra_protocol), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_query, __pyx_k_cassandra_query, sizeof(__pyx_k_cassandra_query), 0, 0, 1, 1},
  {&__pyx_n_s_cassandra_util, __pyx_k_cassandra_util, sizeof(__pyx_k_cassandra_util), 0, 0, 1, 1},
  {&__pyx_n_s_cb, __pyx_k_cb, sizeof(__pyx_k_cb), 0, 0, 1, 1},
  {&__pyx_n_s_cf_query, __pyx_k_cf_query, sizeof(__pyx_k_cf_query), 0, 0, 1, 1},
  {&__pyx_n_s_cf_result, __pyx_k_cf_result, sizeof(__pyx_k_cf_result), 0, 0, 1, 1},
  {&__pyx_n_s_cf_success, __pyx_k_cf_success, sizeof(__pyx_k_cf_success), 0, 0, 1, 1},
  {&__pyx_n_s_change_type, __pyx_k_change_type, sizeof(__pyx_k_change_type), 0, 0, 1, 1},
  {&__pyx_n_s_check_supported, __pyx_k_check_supported, sizeof(__pyx_k_check_supported), 0, 0, 1, 1},
  {&__pyx_n_s_chunks, __pyx_k_chunks, sizeof(__pyx_k_chunks), 0, 0, 1, 1},
  {&__pyx_n_s_cl, __pyx_k_cl, sizeof(__pyx_k_cl), 0, 0, 1, 1},
  {&__pyx_n_s_cleanup_failed_on_up_handling, __pyx_k_cleanup_failed_on_up_handling, sizeof(__pyx_k_cleanup_failed_on_up_handling), 0, 0, 1, 1},
  {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
  {&__pyx_n_s_clear_callbacks, __pyx_k_clear_callbacks, sizeof(__pyx_k_clear_callbacks), 0, 0, 1, 1},
  {&__pyx_n_s_clear_watcher, __pyx_k_clear_watcher, sizeof(__pyx_k_clear_watcher), 0, 0, 1, 1},
  {&__pyx_n_s_client_protocol_handler, __pyx_k_client_protocol_handler, sizeof(__pyx_k_client_protocol_handler), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_cluster, __pyx_k_cluster, sizeof(__pyx_k_cluster), 0, 0, 1, 1},
  {&__pyx_n_s_cluster_2, __pyx_k_cluster_2, sizeof(__pyx_k_cluster_2), 0, 0, 1, 1},
  {&__pyx_n_s_cluster_name, __pyx_k_cluster_name, sizeof(__pyx_k_cluster_name), 0, 0, 1, 1},
  {&__pyx_n_s_col_query, __pyx_k_col_query, sizeof(__pyx_k_col_query), 0, 0, 1, 1},
  {&__pyx_n_s_col_result, __pyx_k_col_result, sizeof(__pyx_k_col_result), 0, 0, 1, 1},
  {&__pyx_n_s_col_success, __pyx_k_col_success, sizeof(__pyx_k_col_success), 0, 0, 1, 1},
  {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
  {&__pyx_n_s_column_metadata, __pyx_k_column_metadata, sizeof(__pyx_k_column_metadata), 0, 0, 1, 1},
  {&__pyx_n_s_compression, __pyx_k_compression, sizeof(__pyx_k_compression), 0, 0, 1, 1},
  {&__pyx_n_s_concurrent_futures, __pyx_k_concurrent_futures, sizeof(__pyx_k_concurrent_futures), 0, 0, 1, 1},
  {&__pyx_n_s_conn, __pyx_k_conn, sizeof(__pyx_k_conn), 0, 0, 1, 1},
  {&__pyx_n_s_conn_exc, __pyx_k_conn_exc, sizeof(__pyx_k_conn_exc), 0, 0, 1, 1},
  {&__pyx_n_s_conn_factory, __pyx_k_conn_factory, sizeof(__pyx_k_conn_factory), 0, 0, 1, 1},
  {&__pyx_n_s_connect, __pyx_k_connect, sizeof(__pyx_k_connect), 0, 0, 1, 1},
  {&__pyx_n_s_connect_timeout, __pyx_k_connect_timeout, sizeof(__pyx_k_connect_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_connect_to_remote_hosts, __pyx_k_connect_to_remote_hosts, sizeof(__pyx_k_connect_to_remote_hosts), 0, 0, 1, 1},
  {&__pyx_n_s_connection, __pyx_k_connection, sizeof(__pyx_k_connection), 0, 0, 1, 1},
  {&__pyx_n_s_connection_2, __pyx_k_connection_2, sizeof(__pyx_k_connection_2), 0, 0, 1, 1},
  {&__pyx_n_s_connection_class, __pyx_k_connection_class, sizeof(__pyx_k_connection_class), 0, 0, 1, 1},
  {&__pyx_n_s_connection_exc, __pyx_k_connection_exc, sizeof(__pyx_k_connection_exc), 0, 0, 1, 1},
  {&__pyx_n_s_connection_factory, __pyx_k_connection_factory, sizeof(__pyx_k_connection_factory), 0, 0, 1, 1},
  {&__pyx_n_s_consistency, __pyx_k_consistency, sizeof(__pyx_k_consistency), 0, 0, 1, 1},
  {&__pyx_n_s_consistency_level, __pyx_k_consistency_level, sizeof(__pyx_k_consistency_level), 0, 0, 1, 1},
  {&__pyx_n_s_contact_points, __pyx_k_contact_points, sizeof(__pyx_k_contact_points), 0, 0, 1, 1},
  {&__pyx_kp_s_contact_points_should_not_be_a_s, __pyx_k_contact_points_should_not_be_a_s, sizeof(__pyx_k_contact_points_should_not_be_a_s), 0, 0, 1, 0},
  {&__pyx_n_s_control_conn, __pyx_k_control_conn, sizeof(__pyx_k_control_conn), 0, 0, 1, 1},
  {&__pyx_n_s_control_conn_disposed, __pyx_k_control_conn_disposed, sizeof(__pyx_k_control_conn_disposed), 0, 0, 1, 1},
  {&__pyx_n_s_control_connection, __pyx_k_control_connection, sizeof(__pyx_k_control_connection), 0, 0, 1, 1},
  {&__pyx_kp_s_control_connection_Aborting_wai, __pyx_k_control_connection_Aborting_wai, sizeof(__pyx_k_control_connection_Aborting_wai), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Attempting_t, __pyx_k_control_connection_Attempting_t, sizeof(__pyx_k_control_connection_Attempting_t), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Attempting_t_2, __pyx_k_control_connection_Attempting_t_2, sizeof(__pyx_k_control_connection_Attempting_t_2), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Closing_old, __pyx_k_control_connection_Closing_old, sizeof(__pyx_k_control_connection_Closing_old), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Control_conn, __pyx_k_control_connection_Control_conn, sizeof(__pyx_k_control_connection_Control_conn), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Error_connec, __pyx_k_control_connection_Error_connec, sizeof(__pyx_k_control_connection_Error_connec), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Error_refres, __pyx_k_control_connection_Error_refres, sizeof(__pyx_k_control_connection_Error_refres), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Error_refres_2, __pyx_k_control_connection_Error_refres_2, sizeof(__pyx_k_control_connection_Error_refres_2), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Established, __pyx_k_control_connection_Established, sizeof(__pyx_k_control_connection_Established), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Fetched_keys, __pyx_k_control_connection_Fetched_keys, sizeof(__pyx_k_control_connection_Fetched_keys), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Fetched_sche, __pyx_k_control_connection_Fetched_sche, sizeof(__pyx_k_control_connection_Fetched_sche), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Fetched_tabl, __pyx_k_control_connection_Fetched_tabl, sizeof(__pyx_k_control_connection_Fetched_tabl), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Fetched_user, __pyx_k_control_connection_Fetched_user, sizeof(__pyx_k_control_connection_Fetched_user), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Fetched_user_2, __pyx_k_control_connection_Fetched_user_2, sizeof(__pyx_k_control_connection_Fetched_user_2), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Fetched_user_3, __pyx_k_control_connection_Fetched_user_3, sizeof(__pyx_k_control_connection_Fetched_user_3), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Finished_fet, __pyx_k_control_connection_Finished_fet, sizeof(__pyx_k_control_connection_Finished_fet), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Found_host_t, __pyx_k_control_connection_Found_host_t, sizeof(__pyx_k_control_connection_Found_host_t), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Found_new_ho, __pyx_k_control_connection_Found_new_ho, sizeof(__pyx_k_control_connection_Found_new_ho), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Opening_new, __pyx_k_control_connection_Opening_new, sizeof(__pyx_k_control_connection_Opening_new), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Rebuilding_t, __pyx_k_control_connection_Rebuilding_t, sizeof(__pyx_k_control_connection_Rebuilding_t), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Refreshing_n, __pyx_k_control_connection_Refreshing_n, sizeof(__pyx_k_control_connection_Refreshing_n), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Refreshing_n_2, __pyx_k_control_connection_Refreshing_n_2, sizeof(__pyx_k_control_connection_Refreshing_n_2), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Schemas_matc, __pyx_k_control_connection_Schemas_matc, sizeof(__pyx_k_control_connection_Schemas_matc), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Schemas_mism, __pyx_k_control_connection_Schemas_mism, sizeof(__pyx_k_control_connection_Schemas_mism), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Skipping_nod, __pyx_k_control_connection_Skipping_nod, sizeof(__pyx_k_control_connection_Skipping_nod), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Skipping_sch, __pyx_k_control_connection_Skipping_sch, sizeof(__pyx_k_control_connection_Skipping_sch), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Timed_out_wa, __pyx_k_control_connection_Timed_out_wa, sizeof(__pyx_k_control_connection_Timed_out_wa), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_Waiting_for, __pyx_k_control_connection_Waiting_for, sizeof(__pyx_k_control_connection_Waiting_for), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_error_reconn, __pyx_k_control_connection_error_reconn, sizeof(__pyx_k_control_connection_error_reconn), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_this_version, __pyx_k_control_connection_this_version, sizeof(__pyx_k_control_connection_this_version), 0, 0, 1, 0},
  {&__pyx_n_s_control_connection_timeout, __pyx_k_control_connection_timeout, sizeof(__pyx_k_control_connection_timeout), 0, 0, 1, 1},
  {&__pyx_kp_s_control_connection_triggers_tab, __pyx_k_control_connection_triggers_tab, sizeof(__pyx_k_control_connection_triggers_tab), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_user_aggrega, __pyx_k_control_connection_user_aggrega, sizeof(__pyx_k_control_connection_user_aggrega), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_user_functio, __pyx_k_control_connection_user_functio, sizeof(__pyx_k_control_connection_user_functio), 0, 0, 1, 0},
  {&__pyx_kp_s_control_connection_user_types_t, __pyx_k_control_connection_user_types_t, sizeof(__pyx_k_control_connection_user_types_t), 0, 0, 1, 0},
  {&__pyx_n_s_conviction_policy_factory, __pyx_k_conviction_policy_factory, sizeof(__pyx_k_conviction_policy_factory), 0, 0, 1, 1},
  {&__pyx_kp_s_conviction_policy_factory_must_b, __pyx_k_conviction_policy_factory_must_b, sizeof(__pyx_k_conviction_policy_factory_must_b), 0, 0, 1, 0},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_n_s_core_connections, __pyx_k_core_connections, sizeof(__pyx_k_core_connections), 0, 0, 1, 1},
  {&__pyx_n_s_core_connections_per_host, __pyx_k_core_connections_per_host, sizeof(__pyx_k_core_connections_per_host), 0, 0, 1, 1},
  {&__pyx_n_s_cql_encode_all_types, __pyx_k_cql_encode_all_types, sizeof(__pyx_k_cql_encode_all_types), 0, 0, 1, 1},
  {&__pyx_n_s_cql_version, __pyx_k_cql_version, sizeof(__pyx_k_cql_version), 0, 0, 1, 1},
  {&__pyx_n_s_create_response_future, __pyx_k_create_response_future, sizeof(__pyx_k_create_response_future), 0, 0, 1, 1},
  {&__pyx_n_s_create_timer, __pyx_k_create_timer, sizeof(__pyx_k_create_timer), 0, 0, 1, 1},
  {&__pyx_n_s_current_host, __pyx_k_current_host, sizeof(__pyx_k_current_host), 0, 0, 1, 1},
  {&__pyx_n_s_current_keyspace, __pyx_k_current_keyspace, sizeof(__pyx_k_current_keyspace), 0, 0, 1, 1},
  {&__pyx_n_s_current_pool, __pyx_k_current_pool, sizeof(__pyx_k_current_pool), 0, 0, 1, 1},
  {&__pyx_n_s_current_response, __pyx_k_current_response, sizeof(__pyx_k_current_response), 0, 0, 1, 1},
  {&__pyx_n_s_currently_handling_node_up, __pyx_k_currently_handling_node_up, sizeof(__pyx_k_currently_handling_node_up), 0, 0, 1, 1},
  {&__pyx_n_s_custom_payload, __pyx_k_custom_payload, sizeof(__pyx_k_custom_payload), 0, 0, 1, 1},
  {&__pyx_n_s_custom_payload_2, __pyx_k_custom_payload_2, sizeof(__pyx_k_custom_payload_2), 0, 0, 1, 1},
  {&__pyx_kp_s_custom_payload_cannot_be_retriev, __pyx_k_custom_payload_cannot_be_retriev, sizeof(__pyx_k_custom_payload_cannot_be_retriev), 0, 0, 1, 0},
  {&__pyx_n_s_daemon, __pyx_k_daemon, sizeof(__pyx_k_daemon), 0, 0, 1, 1},
  {&__pyx_n_s_data_center, __pyx_k_data_center, sizeof(__pyx_k_data_center), 0, 0, 1, 1},
  {&__pyx_n_s_datacenter, __pyx_k_datacenter, sizeof(__pyx_k_datacenter), 0, 0, 1, 1},
  {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
  {&__pyx_n_s_decode_message, __pyx_k_decode_message, sizeof(__pyx_k_decode_message), 0, 0, 1, 1},
  {&__pyx_n_s_decoder, __pyx_k_decoder, sizeof(__pyx_k_decoder), 0, 0, 1, 1},
  {&__pyx_n_s_default_consistency_level, __pyx_k_default_consistency_level, sizeof(__pyx_k_default_consistency_level), 0, 0, 1, 1},
  {&__pyx_n_s_default_fetch_size, __pyx_k_default_fetch_size, sizeof(__pyx_k_default_fetch_size), 0, 0, 1, 1},
  {&__pyx_n_s_default_lbp_factory, __pyx_k_default_lbp_factory, sizeof(__pyx_k_default_lbp_factory), 0, 0, 1, 1},
  {&__pyx_n_s_default_retry_policy, __pyx_k_default_retry_policy, sizeof(__pyx_k_default_retry_policy), 0, 0, 1, 1},
  {&__pyx_kp_s_default_retry_policy_should_not, __pyx_k_default_retry_policy_should_not, sizeof(__pyx_k_default_retry_policy_should_not), 0, 0, 1, 0},
  {&__pyx_n_s_default_timeout, __pyx_k_default_timeout, sizeof(__pyx_k_default_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_defaultdict, __pyx_k_defaultdict, sizeof(__pyx_k_defaultdict), 0, 0, 1, 1},
  {&__pyx_n_s_defunct, __pyx_k_defunct, sizeof(__pyx_k_defunct), 0, 0, 1, 1},
  {&__pyx_n_s_delay, __pyx_k_delay, sizeof(__pyx_k_delay), 0, 0, 1, 1},
  {&__pyx_n_s_delay_for_event_type, __pyx_k_delay_for_event_type, sizeof(__pyx_k_delay_for_event_type), 0, 0, 1, 1},
  {&__pyx_n_s_delay_window, __pyx_k_delay_window, sizeof(__pyx_k_delay_window), 0, 0, 1, 1},
  {&__pyx_n_s_dict_factory, __pyx_k_dict_factory, sizeof(__pyx_k_dict_factory), 0, 0, 1, 1},
  {&__pyx_n_s_discard, __pyx_k_discard, sizeof(__pyx_k_discard), 0, 0, 1, 1},
  {&__pyx_n_s_distance, __pyx_k_distance, sizeof(__pyx_k_distance), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
  {&__pyx_n_s_elapsed, __pyx_k_elapsed, sizeof(__pyx_k_elapsed), 0, 0, 1, 1},
  {&__pyx_n_s_enabled, __pyx_k_enabled, sizeof(__pyx_k_enabled), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_encode_message, __pyx_k_encode_message, sizeof(__pyx_k_encode_message), 0, 0, 1, 1},
  {&__pyx_n_s_encoder, __pyx_k_encoder, sizeof(__pyx_k_encoder), 0, 0, 1, 1},
  {&__pyx_n_s_ensure_core_connections, __pyx_k_ensure_core_connections, sizeof(__pyx_k_ensure_core_connections), 0, 0, 1, 1},
  {&__pyx_n_s_ensure_core_connections_2, __pyx_k_ensure_core_connections_2, sizeof(__pyx_k_ensure_core_connections_2), 0, 0, 1, 1},
  {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
  {&__pyx_n_s_errback, __pyx_k_errback, sizeof(__pyx_k_errback), 0, 0, 1, 1},
  {&__pyx_n_s_errback_2, __pyx_k_errback_2, sizeof(__pyx_k_errback_2), 0, 0, 1, 1},
  {&__pyx_n_s_errback_args, __pyx_k_errback_args, sizeof(__pyx_k_errback_args), 0, 0, 1, 1},
  {&__pyx_n_s_errback_kwargs, __pyx_k_errback_kwargs, sizeof(__pyx_k_errback_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_errbacks, __pyx_k_errbacks, sizeof(__pyx_k_errbacks), 0, 0, 1, 1},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_n_s_errors, __pyx_k_errors, sizeof(__pyx_k_errors), 0, 0, 1, 1},
  {&__pyx_n_s_errors_2, __pyx_k_errors_2, sizeof(__pyx_k_errors_2), 0, 0, 1, 1},
  {&__pyx_n_s_event, __pyx_k_event, sizeof(__pyx_k_event), 0, 0, 1, 1},
  {&__pyx_n_s_event_2, __pyx_k_event_2, sizeof(__pyx_k_event_2), 0, 0, 1, 1},
  {&__pyx_n_s_event_schedule_times, __pyx_k_event_schedule_times, sizeof(__pyx_k_event_schedule_times), 0, 0, 1, 1},
  {&__pyx_n_s_event_type, __pyx_k_event_type, sizeof(__pyx_k_event_type), 0, 0, 1, 1},
  {&__pyx_n_s_eventlet, __pyx_k_eventlet, sizeof(__pyx_k_eventlet), 0, 0, 1, 1},
  {&__pyx_kp_s_eventlet_patcher, __pyx_k_eventlet_patcher, sizeof(__pyx_k_eventlet_patcher), 0, 0, 1, 0},
  {&__pyx_n_s_evict_udt_class, __pyx_k_evict_udt_class, sizeof(__pyx_k_evict_udt_class), 0, 0, 1, 1},
  {&__pyx_n_s_exc, __pyx_k_exc, sizeof(__pyx_k_exc), 0, 0, 1, 1},
  {&__pyx_n_s_exc_info, __pyx_k_exc_info, sizeof(__pyx_k_exc_info), 0, 0, 1, 1},
  {&__pyx_n_s_exception, __pyx_k_exception, sizeof(__pyx_k_exception), 0, 0, 1, 1},
  {&__pyx_n_s_excluded_host, __pyx_k_excluded_host, sizeof(__pyx_k_excluded_host), 0, 0, 1, 1},
  {&__pyx_n_s_execute, __pyx_k_execute, sizeof(__pyx_k_execute), 0, 0, 1, 1},
  {&__pyx_n_s_execute_after_prepare, __pyx_k_execute_after_prepare, sizeof(__pyx_k_execute_after_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_execute_async, __pyx_k_execute_async, sizeof(__pyx_k_execute_async), 0, 0, 1, 1},
  {&__pyx_n_s_executor, __pyx_k_executor, sizeof(__pyx_k_executor), 0, 0, 1, 1},
  {&__pyx_n_s_executor_2, __pyx_k_executor_2, sizeof(__pyx_k_executor_2), 0, 0, 1, 1},
  {&__pyx_n_s_executor_threads, __pyx_k_executor_threads, sizeof(__pyx_k_executor_threads), 0, 0, 1, 1},
  {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
  {&__pyx_n_s_expect_host_to_be_down, __pyx_k_expect_host_to_be_down, sizeof(__pyx_k_expect_host_to_be_down), 0, 0, 1, 1},
  {&__pyx_n_s_expiring_weakref, __pyx_k_expiring_weakref, sizeof(__pyx_k_expiring_weakref), 0, 0, 1, 1},
  {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
  {&__pyx_n_s_factory, __pyx_k_factory, sizeof(__pyx_k_factory), 0, 0, 1, 1},
  {&__pyx_n_s_fail_on_error, __pyx_k_fail_on_error, sizeof(__pyx_k_fail_on_error), 0, 0, 1, 1},
  {&__pyx_n_s_fetch_size, __pyx_k_fetch_size, sizeof(__pyx_k_fetch_size), 0, 0, 1, 1},
  {&__pyx_n_s_field_names, __pyx_k_field_names, sizeof(__pyx_k_field_names), 0, 0, 1, 1},
  {&__pyx_n_s_final_exception, __pyx_k_final_exception, sizeof(__pyx_k_final_exception), 0, 0, 1, 1},
  {&__pyx_n_s_final_result, __pyx_k_final_result, sizeof(__pyx_k_final_result), 0, 0, 1, 1},
  {&__pyx_n_s_finalize_add, __pyx_k_finalize_add, sizeof(__pyx_k_finalize_add), 0, 0, 1, 1},
  {&__pyx_n_s_finished_future, __pyx_k_finished_future, sizeof(__pyx_k_finished_future), 0, 0, 1, 1},
  {&__pyx_n_s_fn, __pyx_k_fn, sizeof(__pyx_k_fn), 0, 0, 1, 1},
  {&__pyx_n_s_force_token_rebuild, __pyx_k_force_token_rebuild, sizeof(__pyx_k_force_token_rebuild), 0, 0, 1, 1},
  {&__pyx_n_s_found_hosts, __pyx_k_found_hosts, sizeof(__pyx_k_found_hosts), 0, 0, 1, 1},
  {&__pyx_n_s_from_message, __pyx_k_from_message, sizeof(__pyx_k_from_message), 0, 0, 1, 1},
  {&__pyx_n_s_function, __pyx_k_function, sizeof(__pyx_k_function), 0, 0, 1, 1},
  {&__pyx_n_s_function_changed, __pyx_k_function_changed, sizeof(__pyx_k_function_changed), 0, 0, 1, 1},
  {&__pyx_n_s_functions_query, __pyx_k_functions_query, sizeof(__pyx_k_functions_query), 0, 0, 1, 1},
  {&__pyx_n_s_functions_result, __pyx_k_functions_result, sizeof(__pyx_k_functions_result), 0, 0, 1, 1},
  {&__pyx_n_s_functions_success, __pyx_k_functions_success, sizeof(__pyx_k_functions_success), 0, 0, 1, 1},
  {&__pyx_n_s_functools, __pyx_k_functools, sizeof(__pyx_k_functools), 0, 0, 1, 1},
  {&__pyx_n_s_future, __pyx_k_future, sizeof(__pyx_k_future), 0, 0, 1, 1},
  {&__pyx_n_s_future_completed, __pyx_k_future_completed, sizeof(__pyx_k_future_completed), 0, 0, 1, 1},
  {&__pyx_n_s_future_completed_2, __pyx_k_future_completed_2, sizeof(__pyx_k_future_completed_2), 0, 0, 1, 1},
  {&__pyx_n_s_futures, __pyx_k_futures, sizeof(__pyx_k_futures), 0, 0, 1, 1},
  {&__pyx_n_s_futures_lock, __pyx_k_futures_lock, sizeof(__pyx_k_futures_lock), 0, 0, 1, 1},
  {&__pyx_n_s_futures_results, __pyx_k_futures_results, sizeof(__pyx_k_futures_results), 0, 0, 1, 1},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_getLogger, __pyx_k_getLogger, sizeof(__pyx_k_getLogger), 0, 0, 1, 1},
  {&__pyx_n_s_get_and_set_reconnection_handle, __pyx_k_get_and_set_reconnection_handle, sizeof(__pyx_k_get_and_set_reconnection_handle), 0, 0, 1, 1},
  {&__pyx_n_s_get_and_set_reconnection_handler, __pyx_k_get_and_set_reconnection_handler, sizeof(__pyx_k_get_and_set_reconnection_handler), 0, 0, 1, 1},
  {&__pyx_n_s_get_connection_holders, __pyx_k_get_connection_holders, sizeof(__pyx_k_get_connection_holders), 0, 0, 1, 1},
  {&__pyx_n_s_get_connections, __pyx_k_get_connections, sizeof(__pyx_k_get_connections), 0, 0, 1, 1},
  {&__pyx_n_s_get_core_connections_per_host, __pyx_k_get_core_connections_per_host, sizeof(__pyx_k_get_core_connections_per_host), 0, 0, 1, 1},
  {&__pyx_n_s_get_host, __pyx_k_get_host, sizeof(__pyx_k_get_host), 0, 0, 1, 1},
  {&__pyx_n_s_get_max_connections_per_host, __pyx_k_get_max_connections_per_host, sizeof(__pyx_k_get_max_connections_per_host), 0, 0, 1, 1},
  {&__pyx_n_s_get_max_requests_per_connection, __pyx_k_get_max_requests_per_connection, sizeof(__pyx_k_get_max_requests_per_connection), 0, 0, 1, 1},
  {&__pyx_n_s_get_min_requests_per_connection, __pyx_k_get_min_requests_per_connection, sizeof(__pyx_k_get_min_requests_per_connection), 0, 0, 1, 1},
  {&__pyx_n_s_get_pool_state, __pyx_k_get_pool_state, sizeof(__pyx_k_get_pool_state), 0, 0, 1, 1},
  {&__pyx_n_s_get_pools, __pyx_k_get_pools, sizeof(__pyx_k_get_pools), 0, 0, 1, 1},
  {&__pyx_n_s_get_query_trace, __pyx_k_get_query_trace, sizeof(__pyx_k_get_query_trace), 0, 0, 1, 1},
  {&__pyx_n_s_get_schema_mismatches, __pyx_k_get_schema_mismatches, sizeof(__pyx_k_get_schema_mismatches), 0, 0, 1, 1},
  {&__pyx_n_s_get_state, __pyx_k_get_state, sizeof(__pyx_k_get_state), 0, 0, 1, 1},
  {&__pyx_n_s_gevent, __pyx_k_gevent, sizeof(__pyx_k_gevent), 0, 0, 1, 1},
  {&__pyx_kp_s_gevent_monkey, __pyx_k_gevent_monkey, sizeof(__pyx_k_gevent_monkey), 0, 0, 1, 0},
  {&__pyx_n_s_gevent_socket, __pyx_k_gevent_socket, sizeof(__pyx_k_gevent_socket), 0, 0, 1, 1},
  {&__pyx_n_s_groupby, __pyx_k_groupby, sizeof(__pyx_k_groupby), 0, 0, 1, 1},
  {&__pyx_n_s_handle_results, __pyx_k_handle_results, sizeof(__pyx_k_handle_results), 0, 0, 1, 1},
  {&__pyx_n_s_handle_schema_change, __pyx_k_handle_schema_change, sizeof(__pyx_k_handle_schema_change), 0, 0, 1, 1},
  {&__pyx_n_s_handle_status_change, __pyx_k_handle_status_change, sizeof(__pyx_k_handle_status_change), 0, 0, 1, 1},
  {&__pyx_n_s_handle_topology_change, __pyx_k_handle_topology_change, sizeof(__pyx_k_handle_topology_change), 0, 0, 1, 1},
  {&__pyx_n_s_has_more_pages, __pyx_k_has_more_pages, sizeof(__pyx_k_has_more_pages), 0, 0, 1, 1},
  {&__pyx_n_s_have_future, __pyx_k_have_future, sizeof(__pyx_k_have_future), 0, 0, 1, 1},
  {&__pyx_n_s_hex, __pyx_k_hex, sizeof(__pyx_k_hex), 0, 0, 1, 1},
  {&__pyx_n_s_holders, __pyx_k_holders, sizeof(__pyx_k_holders), 0, 0, 1, 1},
  {&__pyx_n_s_host, __pyx_k_host, sizeof(__pyx_k_host), 0, 0, 1, 1},
  {&__pyx_n_s_host_addr, __pyx_k_host_addr, sizeof(__pyx_k_host_addr), 0, 0, 1, 1},
  {&__pyx_n_s_host_distance, __pyx_k_host_distance, sizeof(__pyx_k_host_distance), 0, 0, 1, 1},
  {&__pyx_n_s_host_errors, __pyx_k_host_errors, sizeof(__pyx_k_host_errors), 0, 0, 1, 1},
  {&__pyx_n_s_hosts, __pyx_k_hosts, sizeof(__pyx_k_hosts), 0, 0, 1, 1},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_idle_heartbeat, __pyx_k_idle_heartbeat, sizeof(__pyx_k_idle_heartbeat), 0, 0, 1, 1},
  {&__pyx_n_s_idle_heartbeat_interval, __pyx_k_idle_heartbeat_interval, sizeof(__pyx_k_idle_heartbeat_interval), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_initial_response, __pyx_k_initial_response, sizeof(__pyx_k_initial_response), 0, 0, 1, 1},
  {&__pyx_n_s_initialize_reactor, __pyx_k_initialize_reactor, sizeof(__pyx_k_initialize_reactor), 0, 0, 1, 1},
  {&__pyx_n_s_insert_task, __pyx_k_insert_task, sizeof(__pyx_k_insert_task), 0, 0, 1, 1},
  {&__pyx_n_s_is_closed, __pyx_k_is_closed, sizeof(__pyx_k_is_closed), 0, 0, 1, 1},
  {&__pyx_n_s_is_control_connection, __pyx_k_is_control_connection, sizeof(__pyx_k_is_control_connection), 0, 0, 1, 1},
  {&__pyx_n_s_is_currently_reconnecting, __pyx_k_is_currently_reconnecting, sizeof(__pyx_k_is_currently_reconnecting), 0, 0, 1, 1},
  {&__pyx_n_s_is_defunct, __pyx_k_is_defunct, sizeof(__pyx_k_is_defunct), 0, 0, 1, 1},
  {&__pyx_n_s_is_down, __pyx_k_is_down, sizeof(__pyx_k_is_down), 0, 0, 1, 1},
  {&__pyx_n_s_is_eventlet_monkey_patched, __pyx_k_is_eventlet_monkey_patched, sizeof(__pyx_k_is_eventlet_monkey_patched), 0, 0, 1, 1},
  {&__pyx_n_s_is_gevent_monkey_patched, __pyx_k_is_gevent_monkey_patched, sizeof(__pyx_k_is_gevent_monkey_patched), 0, 0, 1, 1},
  {&__pyx_n_s_is_host_addition, __pyx_k_is_host_addition, sizeof(__pyx_k_is_host_addition), 0, 0, 1, 1},
  {&__pyx_n_s_is_monkey_patched, __pyx_k_is_monkey_patched, sizeof(__pyx_k_is_monkey_patched), 0, 0, 1, 1},
  {&__pyx_n_s_is_set, __pyx_k_is_set, sizeof(__pyx_k_is_set), 0, 0, 1, 1},
  {&__pyx_n_s_is_setup, __pyx_k_is_setup, sizeof(__pyx_k_is_setup), 0, 0, 1, 1},
  {&__pyx_n_s_is_shutdown, __pyx_k_is_shutdown, sizeof(__pyx_k_is_shutdown), 0, 0, 1, 1},
  {&__pyx_n_s_is_shutdown_2, __pyx_k_is_shutdown_2, sizeof(__pyx_k_is_shutdown_2), 0, 0, 1, 1},
  {&__pyx_n_s_is_up, __pyx_k_is_up, sizeof(__pyx_k_is_up), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1},
  {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1},
  {&__pyx_n_s_itertools, __pyx_k_itertools, sizeof(__pyx_k_itertools), 0, 0, 1, 1},
  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
  {&__pyx_n_s_keyspace, __pyx_k_keyspace, sizeof(__pyx_k_keyspace), 0, 0, 1, 1},
  {&__pyx_n_s_keyspace_changed, __pyx_k_keyspace_changed, sizeof(__pyx_k_keyspace_changed), 0, 0, 1, 1},
  {&__pyx_kp_s_keyspace_is_required_to_refresh, __pyx_k_keyspace_is_required_to_refresh, sizeof(__pyx_k_keyspace_is_required_to_refresh), 0, 0, 1, 0},
  {&__pyx_n_s_keyspaces, __pyx_k_keyspaces, sizeof(__pyx_k_keyspaces), 0, 0, 1, 1},
  {&__pyx_n_s_kind, __pyx_k_kind, sizeof(__pyx_k_kind), 0, 0, 1, 1},
  {&__pyx_n_s_klass, __pyx_k_klass, sizeof(__pyx_k_klass), 0, 0, 1, 1},
  {&__pyx_n_s_ks_chunk, __pyx_k_ks_chunk, sizeof(__pyx_k_ks_chunk), 0, 0, 1, 1},
  {&__pyx_n_s_ks_meta, __pyx_k_ks_meta, sizeof(__pyx_k_ks_meta), 0, 0, 1, 1},
  {&__pyx_n_s_ks_query, __pyx_k_ks_query, sizeof(__pyx_k_ks_query), 0, 0, 1, 1},
  {&__pyx_n_s_ks_result, __pyx_k_ks_result, sizeof(__pyx_k_ks_result), 0, 0, 1, 1},
  {&__pyx_n_s_ks_statements, __pyx_k_ks_statements, sizeof(__pyx_k_ks_statements), 0, 0, 1, 1},
  {&__pyx_n_s_ks_success, __pyx_k_ks_success, sizeof(__pyx_k_ks_success), 0, 0, 1, 1},
  {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_kwargs_dict, __pyx_k_kwargs_dict, sizeof(__pyx_k_kwargs_dict), 0, 0, 1, 1},
  {&__pyx_n_s_last_error, __pyx_k_last_error, sizeof(__pyx_k_last_error), 0, 0, 1, 1},
  {&__pyx_n_s_listener, __pyx_k_listener, sizeof(__pyx_k_listener), 0, 0, 1, 1},
  {&__pyx_n_s_listener_lock, __pyx_k_listener_lock, sizeof(__pyx_k_listener_lock), 0, 0, 1, 1},
  {&__pyx_n_s_listeners, __pyx_k_listeners, sizeof(__pyx_k_listeners), 0, 0, 1, 1},
  {&__pyx_n_s_listeners_2, __pyx_k_listeners_2, sizeof(__pyx_k_listeners_2), 0, 0, 1, 1},
  {&__pyx_n_s_load_balancer, __pyx_k_load_balancer, sizeof(__pyx_k_load_balancer), 0, 0, 1, 1},
  {&__pyx_n_s_load_balancing_policy, __pyx_k_load_balancing_policy, sizeof(__pyx_k_load_balancing_policy), 0, 0, 1, 1},
  {&__pyx_kp_s_load_balancing_policy_should_not, __pyx_k_load_balancing_policy_should_not, sizeof(__pyx_k_load_balancing_policy_should_not), 0, 0, 1, 0},
  {&__pyx_n_s_local_address, __pyx_k_local_address, sizeof(__pyx_k_local_address), 0, 0, 1, 1},
  {&__pyx_n_s_local_query, __pyx_k_local_query, sizeof(__pyx_k_local_query), 0, 0, 1, 1},
  {&__pyx_n_s_local_result, __pyx_k_local_result, sizeof(__pyx_k_local_result), 0, 0, 1, 1},
  {&__pyx_n_s_local_row, __pyx_k_local_row, sizeof(__pyx_k_local_row), 0, 0, 1, 1},
  {&__pyx_n_s_local_rows, __pyx_k_local_rows, sizeof(__pyx_k_local_rows), 0, 0, 1, 1},
  {&__pyx_n_s_lock, __pyx_k_lock, sizeof(__pyx_k_lock), 0, 0, 1, 1},
  {&__pyx_n_s_lock_2, __pyx_k_lock_2, sizeof(__pyx_k_lock_2), 0, 0, 1, 1},
  {&__pyx_n_s_log, __pyx_k_log, sizeof(__pyx_k_log), 0, 0, 1, 1},
  {&__pyx_n_s_log_if_failed, __pyx_k_log_if_failed, sizeof(__pyx_k_log_if_failed), 0, 0, 1, 1},
  {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_make_connection_factory, __pyx_k_make_connection_factory, sizeof(__pyx_k_make_connection_factory), 0, 0, 1, 1},
  {&__pyx_n_s_make_connection_kwargs, __pyx_k_make_connection_kwargs, sizeof(__pyx_k_make_connection_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_make_query_plan, __pyx_k_make_query_plan, sizeof(__pyx_k_make_query_plan), 0, 0, 1, 1},
  {&__pyx_n_s_make_query_plan_2, __pyx_k_make_query_plan_2, sizeof(__pyx_k_make_query_plan_2), 0, 0, 1, 1},
  {&__pyx_n_s_mapping, __pyx_k_mapping, sizeof(__pyx_k_mapping), 0, 0, 1, 1},
  {&__pyx_n_s_max_connections, __pyx_k_max_connections, sizeof(__pyx_k_max_connections), 0, 0, 1, 1},
  {&__pyx_n_s_max_connections_per_host, __pyx_k_max_connections_per_host, sizeof(__pyx_k_max_connections_per_host), 0, 0, 1, 1},
  {&__pyx_n_s_max_requests, __pyx_k_max_requests, sizeof(__pyx_k_max_requests), 0, 0, 1, 1},
  {&__pyx_n_s_max_requests_per_connection, __pyx_k_max_requests_per_connection, sizeof(__pyx_k_max_requests_per_connection), 0, 0, 1, 1},
  {&__pyx_n_s_max_schema_agreement_wait, __pyx_k_max_schema_agreement_wait, sizeof(__pyx_k_max_schema_agreement_wait), 0, 0, 1, 1},
  {&__pyx_n_s_max_trace_wait, __pyx_k_max_trace_wait, sizeof(__pyx_k_max_trace_wait), 0, 0, 1, 1},
  {&__pyx_n_s_max_wait, __pyx_k_max_wait, sizeof(__pyx_k_max_wait), 0, 0, 1, 1},
  {&__pyx_n_s_max_workers, __pyx_k_max_workers, sizeof(__pyx_k_max_workers), 0, 0, 1, 1},
  {&__pyx_n_s_message, __pyx_k_message, sizeof(__pyx_k_message), 0, 0, 1, 1},
  {&__pyx_n_s_messages, __pyx_k_messages, sizeof(__pyx_k_messages), 0, 0, 1, 1},
  {&__pyx_n_s_meta_refresh_enabled, __pyx_k_meta_refresh_enabled, sizeof(__pyx_k_meta_refresh_enabled), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_metadata, __pyx_k_metadata, sizeof(__pyx_k_metadata), 0, 0, 1, 1},
  {&__pyx_n_s_method_name, __pyx_k_method_name, sizeof(__pyx_k_method_name), 0, 0, 1, 1},
  {&__pyx_n_s_metrics, __pyx_k_metrics, sizeof(__pyx_k_metrics), 0, 0, 1, 1},
  {&__pyx_n_s_metrics_2, __pyx_k_metrics_2, sizeof(__pyx_k_metrics_2), 0, 0, 1, 1},
  {&__pyx_n_s_metrics_enabled, __pyx_k_metrics_enabled, sizeof(__pyx_k_metrics_enabled), 0, 0, 1, 1},
  {&__pyx_n_s_min_requests, __pyx_k_min_requests, sizeof(__pyx_k_min_requests), 0, 0, 1, 1},
  {&__pyx_n_s_min_requests_per_connection, __pyx_k_min_requests_per_connection, sizeof(__pyx_k_min_requests_per_connection), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_modules, __pyx_k_modules, sizeof(__pyx_k_modules), 0, 0, 1, 1},
  {&__pyx_n_s_msg, __pyx_k_msg, sizeof(__pyx_k_msg), 0, 0, 1, 1},
  {&__pyx_n_s_murmur3, __pyx_k_murmur3, sizeof(__pyx_k_murmur3), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_named_tuple_factory, __pyx_k_named_tuple_factory, sizeof(__pyx_k_named_tuple_factory), 0, 0, 1, 1},
  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__pyx_n_s_new_authenticator, __pyx_k_new_authenticator, sizeof(__pyx_k_new_authenticator), 0, 0, 1, 1},
  {&__pyx_n_s_new_f, __pyx_k_new_f, sizeof(__pyx_k_new_f), 0, 0, 1, 1},
  {&__pyx_n_s_new_handler, __pyx_k_new_handler, sizeof(__pyx_k_new_handler), 0, 0, 1, 1},
  {&__pyx_n_s_new_pool, __pyx_k_new_pool, sizeof(__pyx_k_new_pool), 0, 0, 1, 1},
  {&__pyx_n_s_new_schedule, __pyx_k_new_schedule, sizeof(__pyx_k_new_schedule), 0, 0, 1, 1},
  {&__pyx_n_s_new_session, __pyx_k_new_session, sizeof(__pyx_k_new_session), 0, 0, 1, 1},
  {&__pyx_n_s_new_version, __pyx_k_new_version, sizeof(__pyx_k_new_version), 0, 0, 1, 1},
  {&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1},
  {&__pyx_n_s_next_2, __pyx_k_next_2, sizeof(__pyx_k_next_2), 0, 0, 1, 1},
  {&__pyx_n_s_next_delay, __pyx_k_next_delay, sizeof(__pyx_k_next_delay), 0, 0, 1, 1},
  {&__pyx_n_s_next_time, __pyx_k_next_time, sizeof(__pyx_k_next_time), 0, 0, 1, 1},
  {&__pyx_kp_s_no_result_yet, __pyx_k_no_result_yet, sizeof(__pyx_k_no_result_yet), 0, 0, 1, 0},
  {&__pyx_n_s_now, __pyx_k_now, sizeof(__pyx_k_now), 0, 0, 1, 1},
  {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
  {&__pyx_n_s_obj_weakref, __pyx_k_obj_weakref, sizeof(__pyx_k_obj_weakref), 0, 0, 1, 1},
  {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
  {&__pyx_n_s_old, __pyx_k_old, sizeof(__pyx_k_old), 0, 0, 1, 1},
  {&__pyx_n_s_old_host, __pyx_k_old_host, sizeof(__pyx_k_old_host), 0, 0, 1, 1},
  {&__pyx_n_s_old_reconnector, __pyx_k_old_reconnector, sizeof(__pyx_k_old_reconnector), 0, 0, 1, 1},
  {&__pyx_n_s_on_add, __pyx_k_on_add, sizeof(__pyx_k_on_add), 0, 0, 1, 1},
  {&__pyx_n_s_on_connection_error, __pyx_k_on_connection_error, sizeof(__pyx_k_on_connection_error), 0, 0, 1, 1},
  {&__pyx_n_s_on_down, __pyx_k_on_down, sizeof(__pyx_k_on_down), 0, 0, 1, 1},
  {&__pyx_n_s_on_exception, __pyx_k_on_exception, sizeof(__pyx_k_on_exception), 0, 0, 1, 1},
  {&__pyx_n_s_on_ignore, __pyx_k_on_ignore, sizeof(__pyx_k_on_ignore), 0, 0, 1, 1},
  {&__pyx_n_s_on_other_error, __pyx_k_on_other_error, sizeof(__pyx_k_on_other_error), 0, 0, 1, 1},
  {&__pyx_n_s_on_read_timeout, __pyx_k_on_read_timeout, sizeof(__pyx_k_on_read_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_on_reconnection, __pyx_k_on_reconnection, sizeof(__pyx_k_on_reconnection), 0, 0, 1, 1},
  {&__pyx_n_s_on_remove, __pyx_k_on_remove, sizeof(__pyx_k_on_remove), 0, 0, 1, 1},
  {&__pyx_n_s_on_retry, __pyx_k_on_retry, sizeof(__pyx_k_on_retry), 0, 0, 1, 1},
  {&__pyx_n_s_on_timeout, __pyx_k_on_timeout, sizeof(__pyx_k_on_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_on_unavailable, __pyx_k_on_unavailable, sizeof(__pyx_k_on_unavailable), 0, 0, 1, 1},
  {&__pyx_n_s_on_up, __pyx_k_on_up, sizeof(__pyx_k_on_up), 0, 0, 1, 1},
  {&__pyx_n_s_on_up_future_completed, __pyx_k_on_up_future_completed, sizeof(__pyx_k_on_up_future_completed), 0, 0, 1, 1},
  {&__pyx_n_s_on_write_timeout, __pyx_k_on_write_timeout, sizeof(__pyx_k_on_write_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_paging_state, __pyx_k_paging_state, sizeof(__pyx_k_paging_state), 0, 0, 1, 1},
  {&__pyx_n_s_paging_state_2, __pyx_k_paging_state_2, sizeof(__pyx_k_paging_state_2), 0, 0, 1, 1},
  {&__pyx_n_s_parameters, __pyx_k_parameters, sizeof(__pyx_k_parameters), 0, 0, 1, 1},
  {&__pyx_n_s_partial, __pyx_k_partial, sizeof(__pyx_k_partial), 0, 0, 1, 1},
  {&__pyx_n_s_partitioner, __pyx_k_partitioner, sizeof(__pyx_k_partitioner), 0, 0, 1, 1},
  {&__pyx_n_s_patcher, __pyx_k_patcher, sizeof(__pyx_k_patcher), 0, 0, 1, 1},
  {&__pyx_n_s_peer, __pyx_k_peer, sizeof(__pyx_k_peer), 0, 0, 1, 1},
  {&__pyx_n_s_peers_query, __pyx_k_peers_query, sizeof(__pyx_k_peers_query), 0, 0, 1, 1},
  {&__pyx_n_s_peers_result, __pyx_k_peers_result, sizeof(__pyx_k_peers_result), 0, 0, 1, 1},
  {&__pyx_n_s_pk_indexes, __pyx_k_pk_indexes, sizeof(__pyx_k_pk_indexes), 0, 0, 1, 1},
  {&__pyx_n_s_platform, __pyx_k_platform, sizeof(__pyx_k_platform), 0, 0, 1, 1},
  {&__pyx_n_s_pool, __pyx_k_pool, sizeof(__pyx_k_pool), 0, 0, 1, 1},
  {&__pyx_n_s_pool_finished_setting_keyspace, __pyx_k_pool_finished_setting_keyspace, sizeof(__pyx_k_pool_finished_setting_keyspace), 0, 0, 1, 1},
  {&__pyx_n_s_pools, __pyx_k_pools, sizeof(__pyx_k_pools), 0, 0, 1, 1},
  {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
  {&__pyx_n_s_populate, __pyx_k_populate, sizeof(__pyx_k_populate), 0, 0, 1, 1},
  {&__pyx_n_s_port, __pyx_k_port, sizeof(__pyx_k_port), 0, 0, 1, 1},
  {&__pyx_n_s_preloaded_results, __pyx_k_preloaded_results, sizeof(__pyx_k_preloaded_results), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_prepare_2, __pyx_k_prepare_2, sizeof(__pyx_k_prepare_2), 0, 0, 1, 1},
  {&__pyx_n_s_prepare_all_queries, __pyx_k_prepare_all_queries, sizeof(__pyx_k_prepare_all_queries), 0, 0, 1, 1},
  {&__pyx_n_s_prepare_message, __pyx_k_prepare_message, sizeof(__pyx_k_prepare_message), 0, 0, 1, 1},
  {&__pyx_n_s_prepare_on_all_hosts, __pyx_k_prepare_on_all_hosts, sizeof(__pyx_k_prepare_on_all_hosts), 0, 0, 1, 1},
  {&__pyx_n_s_prepare_on_all_sessions, __pyx_k_prepare_on_all_sessions, sizeof(__pyx_k_prepare_on_all_sessions), 0, 0, 1, 1},
  {&__pyx_n_s_prepared_keyspace, __pyx_k_prepared_keyspace, sizeof(__pyx_k_prepared_keyspace), 0, 0, 1, 1},
  {&__pyx_n_s_prepared_statement, __pyx_k_prepared_statement, sizeof(__pyx_k_prepared_statement), 0, 0, 1, 1},
  {&__pyx_n_s_prepared_statement_lock, __pyx_k_prepared_statement_lock, sizeof(__pyx_k_prepared_statement_lock), 0, 0, 1, 1},
  {&__pyx_n_s_prepared_statements, __pyx_k_prepared_statements, sizeof(__pyx_k_prepared_statements), 0, 0, 1, 1},
  {&__pyx_n_s_previous, __pyx_k_previous, sizeof(__pyx_k_previous), 0, 0, 1, 1},
  {&__pyx_n_s_previous_version, __pyx_k_previous_version, sizeof(__pyx_k_previous_version), 0, 0, 1, 1},
  {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1},
  {&__pyx_n_s_protect_name, __pyx_k_protect_name, sizeof(__pyx_k_protect_name), 0, 0, 1, 1},
  {&__pyx_n_s_protocol_downgrade, __pyx_k_protocol_downgrade, sizeof(__pyx_k_protocol_downgrade), 0, 0, 1, 1},
  {&__pyx_n_s_protocol_handler, __pyx_k_protocol_handler, sizeof(__pyx_k_protocol_handler), 0, 0, 1, 1},
  {&__pyx_n_s_protocol_version, __pyx_k_protocol_version, sizeof(__pyx_k_protocol_version), 0, 0, 1, 1},
  {&__pyx_n_s_protocol_version_2, __pyx_k_protocol_version_2, sizeof(__pyx_k_protocol_version_2), 0, 0, 1, 1},
  {&__pyx_n_s_proxy, __pyx_k_proxy, sizeof(__pyx_k_proxy), 0, 0, 1, 1},
  {&__pyx_n_s_put_nowait, __pyx_k_put_nowait, sizeof(__pyx_k_put_nowait), 0, 0, 1, 1},
  {&__pyx_n_s_python_implementation, __pyx_k_python_implementation, sizeof(__pyx_k_python_implementation), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_queries, __pyx_k_queries, sizeof(__pyx_k_queries), 0, 0, 1, 1},
  {&__pyx_n_s_query, __pyx_k_query, sizeof(__pyx_k_query), 0, 0, 1, 1},
  {&__pyx_n_s_query_2, __pyx_k_query_2, sizeof(__pyx_k_query_2), 0, 0, 1, 1},
  {&__pyx_n_s_query_id, __pyx_k_query_id, sizeof(__pyx_k_query_id), 0, 0, 1, 1},
  {&__pyx_n_s_query_plan, __pyx_k_query_plan, sizeof(__pyx_k_query_plan), 0, 0, 1, 1},
  {&__pyx_n_s_query_retries, __pyx_k_query_retries, sizeof(__pyx_k_query_retries), 0, 0, 1, 1},
  {&__pyx_n_s_query_string, __pyx_k_query_string, sizeof(__pyx_k_query_string), 0, 0, 1, 1},
  {&__pyx_n_s_query_trace, __pyx_k_query_trace, sizeof(__pyx_k_query_trace), 0, 0, 1, 1},
  {&__pyx_n_s_queue, __pyx_k_queue, sizeof(__pyx_k_queue), 0, 0, 1, 1},
  {&__pyx_n_s_queue_2, __pyx_k_queue_2, sizeof(__pyx_k_queue_2), 0, 0, 1, 1},
  {&__pyx_n_s_rack, __pyx_k_rack, sizeof(__pyx_k_rack), 0, 0, 1, 1},
  {&__pyx_n_s_random, __pyx_k_random, sizeof(__pyx_k_random), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_rebuild_schema, __pyx_k_rebuild_schema, sizeof(__pyx_k_rebuild_schema), 0, 0, 1, 1},
  {&__pyx_n_s_rebuild_token_map, __pyx_k_rebuild_token_map, sizeof(__pyx_k_rebuild_token_map), 0, 0, 1, 1},
  {&__pyx_n_s_reconnect, __pyx_k_reconnect, sizeof(__pyx_k_reconnect), 0, 0, 1, 1},
  {&__pyx_n_s_reconnect_2, __pyx_k_reconnect_2, sizeof(__pyx_k_reconnect_2), 0, 0, 1, 1},
  {&__pyx_n_s_reconnect_internal, __pyx_k_reconnect_internal, sizeof(__pyx_k_reconnect_internal), 0, 0, 1, 1},
  {&__pyx_n_s_reconnection_handler, __pyx_k_reconnection_handler, sizeof(__pyx_k_reconnection_handler), 0, 0, 1, 1},
  {&__pyx_n_s_reconnection_lock, __pyx_k_reconnection_lock, sizeof(__pyx_k_reconnection_lock), 0, 0, 1, 1},
  {&__pyx_n_s_reconnection_policy, __pyx_k_reconnection_policy, sizeof(__pyx_k_reconnection_policy), 0, 0, 1, 1},
  {&__pyx_kp_s_reconnection_policy_should_not_b, __pyx_k_reconnection_policy_should_not_b, sizeof(__pyx_k_reconnection_policy_should_not_b), 0, 0, 1, 0},
  {&__pyx_n_s_reconnector, __pyx_k_reconnector, sizeof(__pyx_k_reconnector), 0, 0, 1, 1},
  {&__pyx_n_s_ref, __pyx_k_ref, sizeof(__pyx_k_ref), 0, 0, 1, 1},
  {&__pyx_n_s_refresh_keyspace_metadata, __pyx_k_refresh_keyspace_metadata, sizeof(__pyx_k_refresh_keyspace_metadata), 0, 0, 1, 1},
  {&__pyx_n_s_refresh_node_list_and_token_map, __pyx_k_refresh_node_list_and_token_map, sizeof(__pyx_k_refresh_node_list_and_token_map), 0, 0, 1, 1},
  {&__pyx_n_s_refresh_node_list_and_token_map_2, __pyx_k_refresh_node_list_and_token_map_2, sizeof(__pyx_k_refresh_node_list_and_token_map_2), 0, 0, 1, 1},
  {&__pyx_n_s_refresh_nodes, __pyx_k_refresh_nodes, sizeof(__pyx_k_refresh_nodes), 0, 0, 1, 1},
  {&__pyx_n_s_refresh_schema, __pyx_k_refresh_schema, sizeof(__pyx_k_refresh_schema), 0, 0, 1, 1},
  {&__pyx_n_s_refresh_schema_2, __pyx_k_refresh_schema_2, sizeof(__pyx_k_refresh_schema_2), 0, 0, 1, 1},
  {&__pyx_n_s_refresh_schema_and_set_result, __pyx_k_refresh_schema_and_set_result, sizeof(__pyx_k_refresh_schema_and_set_result), 0, 0, 1, 1},
  {&__pyx_kp_s_refresh_schema_is_deprecated_Use, __pyx_k_refresh_schema_is_deprecated_Use, sizeof(__pyx_k_refresh_schema_is_deprecated_Use), 0, 0, 1, 0},
  {&__pyx_n_s_refresh_schema_metadata, __pyx_k_refresh_schema_metadata, sizeof(__pyx_k_refresh_schema_metadata), 0, 0, 1, 1},
  {&__pyx_n_s_refresh_table_metadata, __pyx_k_refresh_table_metadata, sizeof(__pyx_k_refresh_table_metadata), 0, 0, 1, 1},
  {&__pyx_n_s_refresh_user_aggregate_metadata, __pyx_k_refresh_user_aggregate_metadata, sizeof(__pyx_k_refresh_user_aggregate_metadata), 0, 0, 1, 1},
  {&__pyx_n_s_refresh_user_function_metadata, __pyx_k_refresh_user_function_metadata, sizeof(__pyx_k_refresh_user_function_metadata), 0, 0, 1, 1},
  {&__pyx_n_s_refresh_user_type_metadata, __pyx_k_refresh_user_type_metadata, sizeof(__pyx_k_refresh_user_type_metadata), 0, 0, 1, 1},
  {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1},
  {&__pyx_n_s_register_listener, __pyx_k_register_listener, sizeof(__pyx_k_register_listener), 0, 0, 1, 1},
  {&__pyx_n_s_register_timeout, __pyx_k_register_timeout, sizeof(__pyx_k_register_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_register_user_type, __pyx_k_register_user_type, sizeof(__pyx_k_register_user_type), 0, 0, 1, 1},
  {&__pyx_n_s_register_watchers, __pyx_k_register_watchers, sizeof(__pyx_k_register_watchers), 0, 0, 1, 1},
  {&__pyx_n_s_remaining_callbacks, __pyx_k_remaining_callbacks, sizeof(__pyx_k_remaining_callbacks), 0, 0, 1, 1},
  {&__pyx_n_s_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 0, 0, 1, 1},
  {&__pyx_n_s_remove_host, __pyx_k_remove_host, sizeof(__pyx_k_remove_host), 0, 0, 1, 1},
  {&__pyx_n_s_remove_pool, __pyx_k_remove_pool, sizeof(__pyx_k_remove_pool), 0, 0, 1, 1},
  {&__pyx_n_s_repr, __pyx_k_repr, sizeof(__pyx_k_repr), 0, 0, 1, 1},
  {&__pyx_n_s_reprepare, __pyx_k_reprepare, sizeof(__pyx_k_reprepare), 0, 0, 1, 1},
  {&__pyx_n_s_req_id, __pyx_k_req_id, sizeof(__pyx_k_req_id), 0, 0, 1, 1},
  {&__pyx_n_s_req_id_2, __pyx_k_req_id_2, sizeof(__pyx_k_req_id_2), 0, 0, 1, 1},
  {&__pyx_n_s_request_id, __pyx_k_request_id, sizeof(__pyx_k_request_id), 0, 0, 1, 1},
  {&__pyx_n_s_request_timer, __pyx_k_request_timer, sizeof(__pyx_k_request_timer), 0, 0, 1, 1},
  {&__pyx_n_s_response, __pyx_k_response, sizeof(__pyx_k_response), 0, 0, 1, 1},
  {&__pyx_n_s_response_future, __pyx_k_response_future, sizeof(__pyx_k_response_future), 0, 0, 1, 1},
  {&__pyx_n_s_responses, __pyx_k_responses, sizeof(__pyx_k_responses), 0, 0, 1, 1},
  {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
  {&__pyx_n_s_results, __pyx_k_results, sizeof(__pyx_k_results), 0, 0, 1, 1},
  {&__pyx_n_s_retry, __pyx_k_retry, sizeof(__pyx_k_retry), 0, 0, 1, 1},
  {&__pyx_n_s_retry_2, __pyx_k_retry_2, sizeof(__pyx_k_retry_2), 0, 0, 1, 1},
  {&__pyx_n_s_retry_num, __pyx_k_retry_num, sizeof(__pyx_k_retry_num), 0, 0, 1, 1},
  {&__pyx_n_s_retry_policy, __pyx_k_retry_policy, sizeof(__pyx_k_retry_policy), 0, 0, 1, 1},
  {&__pyx_n_s_retry_task, __pyx_k_retry_task, sizeof(__pyx_k_retry_task), 0, 0, 1, 1},
  {&__pyx_n_s_retry_type, __pyx_k_retry_type, sizeof(__pyx_k_retry_type), 0, 0, 1, 1},
  {&__pyx_n_s_return_connection, __pyx_k_return_connection, sizeof(__pyx_k_return_connection), 0, 0, 1, 1},
  {&__pyx_n_s_reuse_connection, __pyx_k_reuse_connection, sizeof(__pyx_k_reuse_connection), 0, 0, 1, 1},
  {&__pyx_n_s_row, __pyx_k_row, sizeof(__pyx_k_row), 0, 0, 1, 1},
  {&__pyx_n_s_row_factory, __pyx_k_row_factory, sizeof(__pyx_k_row_factory), 0, 0, 1, 1},
  {&__pyx_n_s_rpc_address, __pyx_k_rpc_address, sizeof(__pyx_k_rpc_address), 0, 0, 1, 1},
  {&__pyx_n_s_run, __pyx_k_run, sizeof(__pyx_k_run), 0, 0, 1, 1},
  {&__pyx_n_s_run_add_or_renew_pool, __pyx_k_run_add_or_renew_pool, sizeof(__pyx_k_run_add_or_renew_pool), 0, 0, 1, 1},
  {&__pyx_n_s_run_at, __pyx_k_run_at, sizeof(__pyx_k_run_at), 0, 0, 1, 1},
  {&__pyx_n_s_run_in_executor, __pyx_k_run_in_executor, sizeof(__pyx_k_run_in_executor), 0, 0, 1, 1},
  {&__pyx_n_s_run_in_executor_locals_new_f, __pyx_k_run_in_executor_locals_new_f, sizeof(__pyx_k_run_in_executor_locals_new_f), 0, 0, 1, 1},
  {&__pyx_n_s_run_now, __pyx_k_run_now, sizeof(__pyx_k_run_now), 0, 0, 1, 1},
  {&__pyx_kp_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 0},
  {&__pyx_kp_s_s_2, __pyx_k_s_2, sizeof(__pyx_k_s_2), 0, 0, 1, 0},
  {&__pyx_n_s_s_3, __pyx_k_s_3, sizeof(__pyx_k_s_3), 0, 0, 1, 1},
  {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
  {&__pyx_n_s_schedule, __pyx_k_schedule, sizeof(__pyx_k_schedule), 0, 0, 1, 1},
  {&__pyx_n_s_schedule_unique, __pyx_k_schedule_unique, sizeof(__pyx_k_schedule_unique), 0, 0, 1, 1},
  {&__pyx_n_s_scheduled_tasks, __pyx_k_scheduled_tasks, sizeof(__pyx_k_scheduled_tasks), 0, 0, 1, 1},
  {&__pyx_n_s_scheduler, __pyx_k_scheduler, sizeof(__pyx_k_scheduler), 0, 0, 1, 1},
  {&__pyx_n_s_schema_agreement_lock, __pyx_k_schema_agreement_lock, sizeof(__pyx_k_schema_agreement_lock), 0, 0, 1, 1},
  {&__pyx_n_s_schema_agreement_wait, __pyx_k_schema_agreement_wait, sizeof(__pyx_k_schema_agreement_wait), 0, 0, 1, 1},
  {&__pyx_n_s_schema_change, __pyx_k_schema_change, sizeof(__pyx_k_schema_change), 0, 0, 1, 1},
  {&__pyx_n_s_schema_event_refresh_window, __pyx_k_schema_event_refresh_window, sizeof(__pyx_k_schema_event_refresh_window), 0, 0, 1, 1},
  {&__pyx_n_s_schema_event_refresh_window_2, __pyx_k_schema_event_refresh_window_2, sizeof(__pyx_k_schema_event_refresh_window_2), 0, 0, 1, 1},
  {&__pyx_n_s_schema_mismatches, __pyx_k_schema_mismatches, sizeof(__pyx_k_schema_mismatches), 0, 0, 1, 1},
  {&__pyx_n_s_schema_ver, __pyx_k_schema_ver, sizeof(__pyx_k_schema_ver), 0, 0, 1, 1},
  {&__pyx_n_s_schema_version, __pyx_k_schema_version, sizeof(__pyx_k_schema_version), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_self_weakref, __pyx_k_self_weakref, sizeof(__pyx_k_self_weakref), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_send_msg, __pyx_k_send_msg, sizeof(__pyx_k_send_msg), 0, 0, 1, 1},
  {&__pyx_n_s_send_request, __pyx_k_send_request, sizeof(__pyx_k_send_request), 0, 0, 1, 1},
  {&__pyx_n_s_serial_consistency_level, __pyx_k_serial_consistency_level, sizeof(__pyx_k_serial_consistency_level), 0, 0, 1, 1},
  {&__pyx_n_s_session, __pyx_k_session, sizeof(__pyx_k_session), 0, 0, 1, 1},
  {&__pyx_n_s_sessions, __pyx_k_sessions, sizeof(__pyx_k_sessions), 0, 0, 1, 1},
  {&__pyx_n_s_set, __pyx_k_set, sizeof(__pyx_k_set), 0, 0, 1, 1},
  {&__pyx_n_s_set_core_connections_per_host, __pyx_k_set_core_connections_per_host, sizeof(__pyx_k_set_core_connections_per_host), 0, 0, 1, 1},
  {&__pyx_n_s_set_down, __pyx_k_set_down, sizeof(__pyx_k_set_down), 0, 0, 1, 1},
  {&__pyx_n_s_set_final_exception, __pyx_k_set_final_exception, sizeof(__pyx_k_set_final_exception), 0, 0, 1, 1},
  {&__pyx_n_s_set_final_result, __pyx_k_set_final_result, sizeof(__pyx_k_set_final_result), 0, 0, 1, 1},
  {&__pyx_n_s_set_keyspace, __pyx_k_set_keyspace, sizeof(__pyx_k_set_keyspace), 0, 0, 1, 1},
  {&__pyx_n_s_set_keyspace_blocking, __pyx_k_set_keyspace_blocking, sizeof(__pyx_k_set_keyspace_blocking), 0, 0, 1, 1},
  {&__pyx_n_s_set_keyspace_completed, __pyx_k_set_keyspace_completed, sizeof(__pyx_k_set_keyspace_completed), 0, 0, 1, 1},
  {&__pyx_n_s_set_keyspace_for_all_conns, __pyx_k_set_keyspace_for_all_conns, sizeof(__pyx_k_set_keyspace_for_all_conns), 0, 0, 1, 1},
  {&__pyx_n_s_set_keyspace_for_all_pools, __pyx_k_set_keyspace_for_all_pools, sizeof(__pyx_k_set_keyspace_for_all_pools), 0, 0, 1, 1},
  {&__pyx_n_s_set_location_info, __pyx_k_set_location_info, sizeof(__pyx_k_set_location_info), 0, 0, 1, 1},
  {&__pyx_n_s_set_max_connections_per_host, __pyx_k_set_max_connections_per_host, sizeof(__pyx_k_set_max_connections_per_host), 0, 0, 1, 1},
  {&__pyx_n_s_set_max_requests_per_connection, __pyx_k_set_max_requests_per_connection, sizeof(__pyx_k_set_max_requests_per_connection), 0, 0, 1, 1},
  {&__pyx_n_s_set_meta_refresh_enabled, __pyx_k_set_meta_refresh_enabled, sizeof(__pyx_k_set_meta_refresh_enabled), 0, 0, 1, 1},
  {&__pyx_n_s_set_min_requests_per_connection, __pyx_k_set_min_requests_per_connection, sizeof(__pyx_k_set_min_requests_per_connection), 0, 0, 1, 1},
  {&__pyx_n_s_set_new_connection, __pyx_k_set_new_connection, sizeof(__pyx_k_set_new_connection), 0, 0, 1, 1},
  {&__pyx_n_s_set_result, __pyx_k_set_result, sizeof(__pyx_k_set_result), 0, 0, 1, 1},
  {&__pyx_n_s_set_up, __pyx_k_set_up, sizeof(__pyx_k_set_up), 0, 0, 1, 1},
  {&__pyx_n_s_setdefault, __pyx_k_setdefault, sizeof(__pyx_k_setdefault), 0, 0, 1, 1},
  {&__pyx_n_s_setter, __pyx_k_setter, sizeof(__pyx_k_setter), 0, 0, 1, 1},
  {&__pyx_n_s_shared_results, __pyx_k_shared_results, sizeof(__pyx_k_shared_results), 0, 0, 1, 1},
  {&__pyx_n_s_should_rebuild_token_map, __pyx_k_should_rebuild_token_map, sizeof(__pyx_k_should_rebuild_token_map), 0, 0, 1, 1},
  {&__pyx_n_s_shutdown, __pyx_k_shutdown, sizeof(__pyx_k_shutdown), 0, 0, 1, 1},
  {&__pyx_n_s_shutdown_cluster, __pyx_k_shutdown_cluster, sizeof(__pyx_k_shutdown_cluster), 0, 0, 1, 1},
  {&__pyx_n_s_signal, __pyx_k_signal, sizeof(__pyx_k_signal), 0, 0, 1, 1},
  {&__pyx_n_s_signal_connection_failure, __pyx_k_signal_connection_failure, sizeof(__pyx_k_signal_connection_failure), 0, 0, 1, 1},
  {&__pyx_n_s_signal_error, __pyx_k_signal_error, sizeof(__pyx_k_signal_error), 0, 0, 1, 1},
  {&__pyx_n_s_signature, __pyx_k_signature, sizeof(__pyx_k_signature), 0, 0, 1, 1},
  {&__pyx_n_s_six, __pyx_k_six, sizeof(__pyx_k_six), 0, 0, 1, 1},
  {&__pyx_n_s_six_moves, __pyx_k_six_moves, sizeof(__pyx_k_six_moves), 0, 0, 1, 1},
  {&__pyx_n_s_sleep, __pyx_k_sleep, sizeof(__pyx_k_sleep), 0, 0, 1, 1},
  {&__pyx_n_s_socket, __pyx_k_socket, sizeof(__pyx_k_socket), 0, 0, 1, 1},
  {&__pyx_n_s_sockopts, __pyx_k_sockopts, sizeof(__pyx_k_sockopts), 0, 0, 1, 1},
  {&__pyx_n_s_ssl_options, __pyx_k_ssl_options, sizeof(__pyx_k_ssl_options), 0, 0, 1, 1},
  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  {&__pyx_n_s_start_fetching_next_page, __pyx_k_start_fetching_next_page, sizeof(__pyx_k_start_fetching_next_page), 0, 0, 1, 1},
  {&__pyx_n_s_start_reconnector, __pyx_k_start_reconnector, sizeof(__pyx_k_start_reconnector), 0, 0, 1, 1},
  {&__pyx_n_s_start_time, __pyx_k_start_time, sizeof(__pyx_k_start_time), 0, 0, 1, 1},
  {&__pyx_n_s_start_timer, __pyx_k_start_timer, sizeof(__pyx_k_start_timer), 0, 0, 1, 1},
  {&__pyx_n_s_startup_version, __pyx_k_startup_version, sizeof(__pyx_k_startup_version), 0, 0, 1, 1},
  {&__pyx_n_s_statements, __pyx_k_statements, sizeof(__pyx_k_statements), 0, 0, 1, 1},
  {&__pyx_n_s_statements_and_parameters, __pyx_k_statements_and_parameters, sizeof(__pyx_k_statements_and_parameters), 0, 0, 1, 1},
  {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1},
  {&__pyx_n_s_status_change, __pyx_k_status_change, sizeof(__pyx_k_status_change), 0, 0, 1, 1},
  {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
  {&__pyx_n_s_stop_scheduler, __pyx_k_stop_scheduler, sizeof(__pyx_k_stop_scheduler), 0, 0, 1, 1},
  {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1},
  {&__pyx_n_s_string_types, __pyx_k_string_types, sizeof(__pyx_k_string_types), 0, 0, 1, 1},
  {&__pyx_n_s_submit, __pyx_k_submit, sizeof(__pyx_k_submit), 0, 0, 1, 1},
  {&__pyx_n_s_submit_2, __pyx_k_submit_2, sizeof(__pyx_k_submit_2), 0, 0, 1, 1},
  {&__pyx_n_s_submit_schema_refresh, __pyx_k_submit_schema_refresh, sizeof(__pyx_k_submit_schema_refresh), 0, 0, 1, 1},
  {&__pyx_kp_s_submit_schema_refresh_is_depreca, __pyx_k_submit_schema_refresh_is_depreca, sizeof(__pyx_k_submit_schema_refresh_is_depreca), 0, 0, 1, 0},
  {&__pyx_n_s_success, __pyx_k_success, sizeof(__pyx_k_success), 0, 0, 1, 1},
  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
  {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
  {&__pyx_n_s_table, __pyx_k_table, sizeof(__pyx_k_table), 0, 0, 1, 1},
  {&__pyx_n_s_table_changed, __pyx_k_table_changed, sizeof(__pyx_k_table_changed), 0, 0, 1, 1},
  {&__pyx_kp_s_table_usertype_function_aggrega, __pyx_k_table_usertype_function_aggrega, sizeof(__pyx_k_table_usertype_function_aggrega), 0, 0, 1, 0},
  {&__pyx_n_s_target, __pyx_k_target, sizeof(__pyx_k_target), 0, 0, 1, 1},
  {&__pyx_n_s_task, __pyx_k_task, sizeof(__pyx_k_task), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_text_type, __pyx_k_text_type, sizeof(__pyx_k_text_type), 0, 0, 1, 1},
  {&__pyx_n_s_this_time, __pyx_k_this_time, sizeof(__pyx_k_this_time), 0, 0, 1, 1},
  {&__pyx_n_s_thread, __pyx_k_thread, sizeof(__pyx_k_thread), 0, 0, 1, 1},
  {&__pyx_n_s_threading, __pyx_k_threading, sizeof(__pyx_k_threading), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
  {&__pyx_n_s_time_2, __pyx_k_time_2, sizeof(__pyx_k_time_2), 0, 0, 1, 1},
  {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_timeout_2, __pyx_k_timeout_2, sizeof(__pyx_k_timeout_2), 0, 0, 1, 1},
  {&__pyx_n_s_timer, __pyx_k_timer, sizeof(__pyx_k_timer), 0, 0, 1, 1},
  {&__pyx_n_s_timestamp, __pyx_k_timestamp, sizeof(__pyx_k_timestamp), 0, 0, 1, 1},
  {&__pyx_n_s_to_exception, __pyx_k_to_exception, sizeof(__pyx_k_to_exception), 0, 0, 1, 1},
  {&__pyx_n_s_token_map, __pyx_k_token_map, sizeof(__pyx_k_token_map), 0, 0, 1, 1},
  {&__pyx_n_s_tokens, __pyx_k_tokens, sizeof(__pyx_k_tokens), 0, 0, 1, 1},
  {&__pyx_n_s_topology_change, __pyx_k_topology_change, sizeof(__pyx_k_topology_change), 0, 0, 1, 1},
  {&__pyx_n_s_topology_event_refresh_window, __pyx_k_topology_event_refresh_window, sizeof(__pyx_k_topology_event_refresh_window), 0, 0, 1, 1},
  {&__pyx_n_s_topology_event_refresh_window_2, __pyx_k_topology_event_refresh_window_2, sizeof(__pyx_k_topology_event_refresh_window_2), 0, 0, 1, 1},
  {&__pyx_n_s_total_timeout, __pyx_k_total_timeout, sizeof(__pyx_k_total_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_trace, __pyx_k_trace, sizeof(__pyx_k_trace), 0, 0, 1, 1},
  {&__pyx_n_s_trace_id, __pyx_k_trace_id, sizeof(__pyx_k_trace_id), 0, 0, 1, 1},
  {&__pyx_n_s_tracing, __pyx_k_tracing, sizeof(__pyx_k_tracing), 0, 0, 1, 1},
  {&__pyx_n_s_trigger_success, __pyx_k_trigger_success, sizeof(__pyx_k_trigger_success), 0, 0, 1, 1},
  {&__pyx_n_s_triggers_query, __pyx_k_triggers_query, sizeof(__pyx_k_triggers_query), 0, 0, 1, 1},
  {&__pyx_n_s_triggers_result, __pyx_k_triggers_result, sizeof(__pyx_k_triggers_result), 0, 0, 1, 1},
  {&__pyx_n_s_triggers_success, __pyx_k_triggers_success, sizeof(__pyx_k_triggers_success), 0, 0, 1, 1},
  {&__pyx_n_s_try_connect, __pyx_k_try_connect, sizeof(__pyx_k_try_connect), 0, 0, 1, 1},
  {&__pyx_n_s_try_reconnect, __pyx_k_try_reconnect, sizeof(__pyx_k_try_reconnect), 0, 0, 1, 1},
  {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
  {&__pyx_n_s_type_map, __pyx_k_type_map, sizeof(__pyx_k_type_map), 0, 0, 1, 1},
  {&__pyx_n_s_type_meta, __pyx_k_type_meta, sizeof(__pyx_k_type_meta), 0, 0, 1, 1},
  {&__pyx_n_s_type_signature, __pyx_k_type_signature, sizeof(__pyx_k_type_signature), 0, 0, 1, 1},
  {&__pyx_n_s_types_query, __pyx_k_types_query, sizeof(__pyx_k_types_query), 0, 0, 1, 1},
  {&__pyx_n_s_types_result, __pyx_k_types_result, sizeof(__pyx_k_types_result), 0, 0, 1, 1},
  {&__pyx_n_s_types_success, __pyx_k_types_success, sizeof(__pyx_k_types_success), 0, 0, 1, 1},
  {&__pyx_n_s_udt_name, __pyx_k_udt_name, sizeof(__pyx_k_udt_name), 0, 0, 1, 1},
  {&__pyx_n_s_unregister_listener, __pyx_k_unregister_listener, sizeof(__pyx_k_unregister_listener), 0, 0, 1, 1},
  {&__pyx_n_s_update_created_pools, __pyx_k_update_created_pools, sizeof(__pyx_k_update_created_pools), 0, 0, 1, 1},
  {&__pyx_n_s_update_custom_payload, __pyx_k_update_custom_payload, sizeof(__pyx_k_update_custom_payload), 0, 0, 1, 1},
  {&__pyx_n_s_update_location_info, __pyx_k_update_location_info, sizeof(__pyx_k_update_location_info), 0, 0, 1, 1},
  {&__pyx_n_s_use_client_timestamp, __pyx_k_use_client_timestamp, sizeof(__pyx_k_use_client_timestamp), 0, 0, 1, 1},
  {&__pyx_n_s_user_type, __pyx_k_user_type, sizeof(__pyx_k_user_type), 0, 0, 1, 1},
  {&__pyx_n_s_user_type_map, __pyx_k_user_type_map, sizeof(__pyx_k_user_type_map), 0, 0, 1, 1},
  {&__pyx_n_s_user_type_registered, __pyx_k_user_type_registered, sizeof(__pyx_k_user_type_registered), 0, 0, 1, 1},
  {&__pyx_n_s_user_types, __pyx_k_user_types, sizeof(__pyx_k_user_types), 0, 0, 1, 1},
  {&__pyx_n_s_user_types_2, __pyx_k_user_types_2, sizeof(__pyx_k_user_types_2), 0, 0, 1, 1},
  {&__pyx_n_s_usertype, __pyx_k_usertype, sizeof(__pyx_k_usertype), 0, 0, 1, 1},
  {&__pyx_n_s_usertype_changed, __pyx_k_usertype_changed, sizeof(__pyx_k_usertype_changed), 0, 0, 1, 1},
  {&__pyx_n_s_utf8, __pyx_k_utf8, sizeof(__pyx_k_utf8), 0, 0, 1, 1},
  {&__pyx_kp_s_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 1, 0},
  {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1},
  {&__pyx_n_s_validate_refresh_schema, __pyx_k_validate_refresh_schema, sizeof(__pyx_k_validate_refresh_schema), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
  {&__pyx_n_s_versions, __pyx_k_versions, sizeof(__pyx_k_versions), 0, 0, 1, 1},
  {&__pyx_n_s_wait, __pyx_k_wait, sizeof(__pyx_k_wait), 0, 0, 1, 1},
  {&__pyx_n_s_wait_for_response, __pyx_k_wait_for_response, sizeof(__pyx_k_wait_for_response), 0, 0, 1, 1},
  {&__pyx_n_s_wait_for_responses, __pyx_k_wait_for_responses, sizeof(__pyx_k_wait_for_responses), 0, 0, 1, 1},
  {&__pyx_n_s_wait_for_schema_agreement, __pyx_k_wait_for_schema_agreement, sizeof(__pyx_k_wait_for_schema_agreement), 0, 0, 1, 1},
  {&__pyx_n_s_wait_time, __pyx_k_wait_time, sizeof(__pyx_k_wait_time), 0, 0, 1, 1},
  {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1},
  {&__pyx_n_s_warning, __pyx_k_warning, sizeof(__pyx_k_warning), 0, 0, 1, 1},
  {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1},
  {&__pyx_n_s_warnings_2, __pyx_k_warnings_2, sizeof(__pyx_k_warnings_2), 0, 0, 1, 1},
  {&__pyx_kp_s_warnings_cannot_be_retrieved_bef, __pyx_k_warnings_cannot_be_retrieved_bef, sizeof(__pyx_k_warnings_cannot_be_retrieved_bef), 0, 0, 1, 0},
  {&__pyx_n_s_watch_callback, __pyx_k_watch_callback, sizeof(__pyx_k_watch_callback), 0, 0, 1, 1},
  {&__pyx_n_s_weakref, __pyx_k_weakref, sizeof(__pyx_k_weakref), 0, 0, 1, 1},
  {&__pyx_n_s_where_clause, __pyx_k_where_clause, sizeof(__pyx_k_where_clause), 0, 0, 1, 1},
  {&__pyx_n_s_wraps, __pyx_k_wraps, sizeof(__pyx_k_wraps), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_all = __Pyx_GetBuiltinName(__pyx_n_s_all); if (!__pyx_builtin_all) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_any = __Pyx_GetBuiltinName(__pyx_n_s_any); if (!__pyx_builtin_any) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_sum = __Pyx_GetBuiltinName(__pyx_n_s_sum); if (!__pyx_builtin_sum) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_DeprecationWarning = __Pyx_GetBuiltinName(__pyx_n_s_DeprecationWarning); if (!__pyx_builtin_DeprecationWarning) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ReferenceError = __Pyx_GetBuiltinName(__pyx_n_s_ReferenceError); if (!__pyx_builtin_ReferenceError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "cassandra/cluster.py":81
 *         return False
 *     import eventlet.patcher
 *     return eventlet.patcher.is_monkey_patched('socket')             # <<<<<<<<<<<<<<
 * 
 * def _is_gevent_monkey_patched():
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_n_s_socket); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "cassandra/cluster.py":146
 *     exc = future.exception()
 *     if exc:
 *         log.debug("Failed to run task on executor", exc_info=exc)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_run_task_on_executor); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "cassandra/cluster.py":163
 *             future.add_done_callback(_future_completed)
 *         except Exception:
 *             log.exception("Failed to submit task to executor")             # <<<<<<<<<<<<<<
 * 
 *     return new_f
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_submit_task_to_executo); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "cassandra/cluster.py":155
 * 
 *     @wraps(f)
 *     def new_f(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 * 
 *         if self.is_shutdown:
 */
  __pyx_tuple__4 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_future); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);
  __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_new_f, 155, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":305
 *         except AttributeError:
 *             if self.protocol_version > 1:
 *                 raise TypeError("auth_provider must implement the cassandra.auth.AuthProvider "             # <<<<<<<<<<<<<<
 *                                 "interface when protocol_version >= 2")
 *             elif not callable(value):
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_auth_provider_must_implement_the); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "cassandra/cluster.py":308
 *                                 "interface when protocol_version >= 2")
 *             elif not callable(value):
 *                 raise TypeError("auth_provider must be callable when protocol_version == 1")             # <<<<<<<<<<<<<<
 *             self._auth_provider_callable = value
 * 
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_auth_provider_must_be_callable_w); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "cassandra/cluster.py":526
 *         if contact_points is not None:
 *             if isinstance(contact_points, six.string_types):
 *                 raise TypeError("contact_points should not be a string, it should be a sequence (e.g. list) of strings")             # <<<<<<<<<<<<<<
 * 
 *             self.contact_points = contact_points
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_contact_points_should_not_be_a_s); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "cassandra/cluster.py":537
 *         if load_balancing_policy is not None:
 *             if isinstance(load_balancing_policy, type):
 *                 raise TypeError("load_balancing_policy should not be a class, it should be an instance of that class")             # <<<<<<<<<<<<<<
 * 
 *             self.load_balancing_policy = load_balancing_policy
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_load_balancing_policy_should_not); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "cassandra/cluster.py":545
 *         if reconnection_policy is not None:
 *             if isinstance(reconnection_policy, type):
 *                 raise TypeError("reconnection_policy should not be a class, it should be an instance of that class")             # <<<<<<<<<<<<<<
 * 
 *             self.reconnection_policy = reconnection_policy
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_reconnection_policy_should_not_b); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "cassandra/cluster.py":551
 *         if default_retry_policy is not None:
 *             if isinstance(default_retry_policy, type):
 *                 raise TypeError("default_retry_policy should not be a class, it should be an instance of that class")             # <<<<<<<<<<<<<<
 * 
 *             self.default_retry_policy = default_retry_policy
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_default_retry_policy_should_not); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "cassandra/cluster.py":557
 *         if conviction_policy_factory is not None:
 *             if not callable(conviction_policy_factory):
 *                 raise ValueError("conviction_policy_factory must be callable")             # <<<<<<<<<<<<<<
 *             self.conviction_policy_factory = conviction_policy_factory
 * 
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_conviction_policy_factory_must_b); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "cassandra/cluster.py":690
 *         """
 *         if self.protocol_version >= 3:
 *             raise UnsupportedOperation(             # <<<<<<<<<<<<<<
 *                 "Cluster.set_min_requests_per_connection() only has an effect "
 *                 "when using protocol_version 1 or 2.")
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Cluster_set_min_requests_per_con); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "cassandra/cluster.py":707
 *         """
 *         if self.protocol_version >= 3:
 *             raise UnsupportedOperation(             # <<<<<<<<<<<<<<
 *                 "Cluster.set_max_requests_per_connection() only has an effect "
 *                 "when using protocol_version 1 or 2.")
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Cluster_set_max_requests_per_con); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "cassandra/cluster.py":741
 *         """
 *         if self.protocol_version >= 3:
 *             raise UnsupportedOperation(             # <<<<<<<<<<<<<<
 *                 "Cluster.set_core_connections_per_host() only has an effect "
 *                 "when using protocol_version 1 or 2.")
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Cluster_set_core_connections_per); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "cassandra/cluster.py":774
 *         """
 *         if self.protocol_version >= 3:
 *             raise UnsupportedOperation(             # <<<<<<<<<<<<<<
 *                 "Cluster.set_max_connections_per_host() only has an effect "
 *                 "when using protocol_version 1 or 2.")
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Cluster_set_max_connections_per); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "cassandra/cluster.py":822
 *         with self._lock:
 *             if self.is_shutdown:
 *                 raise Exception("Cluster is already shut down")             # <<<<<<<<<<<<<<
 * 
 *             if not self._is_setup:
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Cluster_is_already_shut_down); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "cassandra/cluster.py":841
 *                 try:
 *                     self.control_connection.connect()
 *                     log.debug("Control connection created")             # <<<<<<<<<<<<<<
 *                 except Exception:
 *                     log.exception("Control connection failed to connect, "
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Control_connection_created); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "cassandra/cluster.py":843
 *                     log.debug("Control connection created")
 *                 except Exception:
 *                     log.exception("Control connection failed to connect, "             # <<<<<<<<<<<<<<
 *                                   "shutting down Cluster:")
 *                     self.shutdown()
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Control_connection_failed_to_con); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "cassandra/cluster.py":820
 *         operations on the ``Session``.
 *         """
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self.is_shutdown:
 *                 raise Exception("Cluster is already shut down")
 */
  __pyx_tuple__20 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "cassandra/cluster.py":874
 *         Once shutdown, a Cluster should not be used for any purpose.
 *         """
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self.is_shutdown:
 *                 return
 */
  __pyx_tuple__21 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);
  __pyx_tuple__22 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "cassandra/cluster.py":909
 * 
 *     def _on_up_future_completed(self, host, futures, results, lock, finished_future):
 *         with lock:             # <<<<<<<<<<<<<<
 *             futures.discard(finished_future)
 * 
 */
  __pyx_tuple__23 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);
  __pyx_tuple__24 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "cassandra/cluster.py":938
 *                 listener.on_up(host)
 *         finally:
 *             with host.lock:             # <<<<<<<<<<<<<<
 *                 host._currently_handling_node_up = False
 * 
 */
  __pyx_tuple__25 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);
  __pyx_tuple__26 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);
  __pyx_tuple__27 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "cassandra/cluster.py":953
 * 
 *         log.debug("Waiting to acquire lock for handling up status of node %s", host)
 *         with host.lock:             # <<<<<<<<<<<<<<
 *             if host._currently_handling_node_up:
 *                 log.debug("Another thread is already handling up status of node %s", host)
 */
  __pyx_tuple__28 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);
  __pyx_tuple__29 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "cassandra/cluster.py":970
 *             log.info("Host %s may be up; will prepare queries and open connection pool", host)
 * 
 *             reconnector = host.get_and_set_reconnection_handler(None)             # <<<<<<<<<<<<<<
 *             if reconnector:
 *                 log.debug("Now that host %s is up, cancelling the reconnection handler", host)
 */
  __pyx_tuple__30 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "cassandra/cluster.py":1009
 *         else:
 *             if not have_future:
 *                 with host.lock:             # <<<<<<<<<<<<<<
 *                     host._currently_handling_node_up = False
 * 
 */
  __pyx_tuple__31 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "cassandra/cluster.py":1004
 *             self._cleanup_failed_on_up_handling(host)
 * 
 *             with host.lock:             # <<<<<<<<<<<<<<
 *                 host._currently_handling_node_up = False
 *             raise
 */
  __pyx_tuple__32 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "cassandra/cluster.py":1047
 *             return
 * 
 *         with host.lock:             # <<<<<<<<<<<<<<
 *             if (not host.is_up and not expect_host_to_be_down) or host.is_currently_reconnecting():
 *                 return
 */
  __pyx_tuple__33 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);
  __pyx_tuple__34 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "cassandra/cluster.py":1090
 * 
 *         def future_completed(future):
 *             with futures_lock:             # <<<<<<<<<<<<<<
 *                 futures.discard(future)
 * 
 */
  __pyx_tuple__35 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);
  __pyx_tuple__36 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "cassandra/cluster.py":1089
 *         futures = set()
 * 
 *         def future_completed(future):             # <<<<<<<<<<<<<<
 *             with futures_lock:
 *                 futures.discard(future)
 */
  __pyx_tuple__37 = PyTuple_Pack(3, __pyx_n_s_future, __pyx_n_s_exc, __pyx_n_s_f); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);
  __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_future_completed_2, 1089, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1183
 *         marked up, or marked down.
 *         """
 *         with self._listener_lock:             # <<<<<<<<<<<<<<
 *             self._listeners.add(listener)
 * 
 */
  __pyx_tuple__39 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "cassandra/cluster.py":1188
 *     def unregister_listener(self, listener):
 *         """ Removes a registered listener. """
 *         with self._listener_lock:             # <<<<<<<<<<<<<<
 *             self._listeners.remove(listener)
 * 
 */
  __pyx_tuple__40 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "cassandra/cluster.py":1193
 *     @property
 *     def listeners(self):
 *         with self._listener_lock:             # <<<<<<<<<<<<<<
 *             return self._listeners.copy()
 * 
 */
  __pyx_tuple__41 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);
  __pyx_tuple__42 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "cassandra/cluster.py":1208
 *         if any((table, usertype, function, aggregate)):
 *             if not keyspace:
 *                 raise ValueError("keyspace is required to refresh specific sub-entity {table, usertype, function, aggregate}")             # <<<<<<<<<<<<<<
 *             if sum(1 for e in (table, usertype, function) if e) > 1:
 *                 raise ValueError("{table, usertype, function, aggregate} are mutually exclusive")
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_keyspace_is_required_to_refresh); if (unlikely(!__pyx_tuple__43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "cassandra/cluster.py":1210
 *                 raise ValueError("keyspace is required to refresh specific sub-entity {table, usertype, function, aggregate}")
 *             if sum(1 for e in (table, usertype, function) if e) > 1:
 *                 raise ValueError("{table, usertype, function, aggregate} are mutually exclusive")             # <<<<<<<<<<<<<<
 * 
 *     def refresh_schema(self, keyspace=None, table=None, usertype=None, function=None, aggregate=None, max_schema_agreement_wait=None):
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_table_usertype_function_aggrega); if (unlikely(!__pyx_tuple__44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "cassandra/cluster.py":1248
 *         if not self.control_connection.refresh_schema(keyspace, table, usertype, function,
 *                                                       aggregate, max_schema_agreement_wait):
 *             raise Exception("Schema was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def submit_schema_refresh(self, keyspace=None, table=None, usertype=None, function=None, aggregate=None):
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_Schema_was_not_refreshed_See_log); if (unlikely(!__pyx_tuple__45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "cassandra/cluster.py":1280
 *         """
 *         if not self.control_connection.refresh_schema(schema_agreement_wait=max_schema_agreement_wait):
 *             raise Exception("Schema metadata was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def refresh_keyspace_metadata(self, keyspace, max_schema_agreement_wait=None):
 */
  __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_Schema_metadata_was_not_refreshe); if (unlikely(!__pyx_tuple__46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "cassandra/cluster.py":1290
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, schema_agreement_wait=max_schema_agreement_wait):
 *             raise Exception("Keyspace metadata was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def refresh_table_metadata(self, keyspace, table, max_schema_agreement_wait=None):
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_Keyspace_metadata_was_not_refres); if (unlikely(!__pyx_tuple__47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "cassandra/cluster.py":1300
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, table, schema_agreement_wait=max_schema_agreement_wait):
 *             raise Exception("Table metadata was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def refresh_user_type_metadata(self, keyspace, user_type, max_schema_agreement_wait=None):
 */
  __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_s_Table_metadata_was_not_refreshed); if (unlikely(!__pyx_tuple__48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "cassandra/cluster.py":1309
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, usertype=user_type, schema_agreement_wait=max_schema_agreement_wait):
 *             raise Exception("User Type metadata was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def refresh_user_function_metadata(self, keyspace, function, max_schema_agreement_wait=None):
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_s_User_Type_metadata_was_not_refre); if (unlikely(!__pyx_tuple__49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "cassandra/cluster.py":1320
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, function=function, schema_agreement_wait=max_schema_agreement_wait):
 *             raise Exception("User Function metadata was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def refresh_user_aggregate_metadata(self, keyspace, aggregate, max_schema_agreement_wait=None):
 */
  __pyx_tuple__50 = PyTuple_Pack(1, __pyx_kp_s_User_Function_metadata_was_not_r); if (unlikely(!__pyx_tuple__50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "cassandra/cluster.py":1331
 *         """
 *         if not self.control_connection.refresh_schema(keyspace, aggregate=aggregate, schema_agreement_wait=max_schema_agreement_wait):
 *             raise Exception("User Aggregate metadata was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def refresh_nodes(self):
 */
  __pyx_tuple__51 = PyTuple_Pack(1, __pyx_kp_s_User_Aggregate_metadata_was_not); if (unlikely(!__pyx_tuple__51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "cassandra/cluster.py":1340
 *         """
 *         if not self.control_connection.refresh_node_list_and_token_map():
 *             raise Exception("Node list was not refreshed. See log for details.")             # <<<<<<<<<<<<<<
 * 
 *     def set_meta_refresh_enabled(self, enabled):
 */
  __pyx_tuple__52 = PyTuple_Pack(1, __pyx_kp_s_Node_list_was_not_refreshed_See); if (unlikely(!__pyx_tuple__52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);

  /* "cassandra/cluster.py":1400
 * 
 *     def prepare_on_all_sessions(self, query_id, prepared_statement, excluded_host):
 *         with self._prepared_statement_lock:             # <<<<<<<<<<<<<<
 *             self._prepared_statements[query_id] = prepared_statement
 *         for session in self.sessions:
 */
  __pyx_tuple__53 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);

  /* "cassandra/cluster.py":1599
 *         """
 *         if trace and not isinstance(query, Statement):
 *             raise TypeError(             # <<<<<<<<<<<<<<
 *                 "The query argument must be an instance of a subclass of "
 *                 "cassandra.query.Statement when trace=True")
 */
  __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_s_The_query_argument_must_be_an_in); if (unlikely(!__pyx_tuple__54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);

  /* "cassandra/cluster.py":1611
 *                     query.trace = future.get_query_trace(self.max_trace_wait)
 *                 except Exception:
 *                     log.exception("Unable to fetch query trace:")             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
  __pyx_tuple__55 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_fetch_query_trace); if (unlikely(!__pyx_tuple__55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);
  __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_fetch_query_trace); if (unlikely(!__pyx_tuple__56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);

  /* "cassandra/cluster.py":1693
 *             query_string = query.query_string
 *             if six.PY2 and isinstance(query_string, six.text_type):
 *                 query_string = query_string.encode('utf-8')             # <<<<<<<<<<<<<<
 *             if parameters:
 *                 query_string = bind_params(query_string, parameters, self.encoder)
 */
  __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "cassandra/cluster.py":1707
 *         elif isinstance(query, BatchStatement):
 *             if self._protocol_version < 2:
 *                 raise UnsupportedOperation(             # <<<<<<<<<<<<<<
 *                     "BatchStatement execution is only supported with protocol version "
 *                     "2 or higher (supported in Cassandra 2.0 and higher).  Consider "
 */
  __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_s_BatchStatement_execution_is_only); if (unlikely(!__pyx_tuple__58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);

  /* "cassandra/cluster.py":1760
 *             query_id, column_metadata, pk_indexes = future.result()
 *         except Exception:
 *             log.exception("Error preparing query:")             # <<<<<<<<<<<<<<
 *             raise
 * 
 */
  __pyx_tuple__59 = PyTuple_Pack(1, __pyx_kp_s_Error_preparing_query); if (unlikely(!__pyx_tuple__59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "cassandra/cluster.py":1772
 *             self.cluster.prepare_on_all_sessions(query_id, prepared_statement, host)
 *         except Exception:
 *             log.exception("Error preparing query on all hosts:")             # <<<<<<<<<<<<<<
 * 
 *         return prepared_statement
 */
  __pyx_tuple__60 = PyTuple_Pack(1, __pyx_kp_s_Error_preparing_query_on_all_hos); if (unlikely(!__pyx_tuple__60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);

  /* "cassandra/cluster.py":1814
 *         for any purpose after being shutdown.
 *         """
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self.is_shutdown:
 *                 return
 */
  __pyx_tuple__61 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);
  __pyx_tuple__62 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);

  /* "cassandra/cluster.py":1831
 *             return None
 * 
 *         def run_add_or_renew_pool():             # <<<<<<<<<<<<<<
 *             try:
 *                 if self._protocol_version >= 3:
 */
  __pyx_tuple__63 = PyTuple_Pack(4, __pyx_n_s_new_pool, __pyx_n_s_auth_exc, __pyx_n_s_conn_exc, __pyx_n_s_previous); if (unlikely(!__pyx_tuple__63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);
  __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_run_add_or_renew_pool, 1831, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1930
 *             return
 * 
 *         def pool_finished_setting_keyspace(pool, host_errors):             # <<<<<<<<<<<<<<
 *             remaining_callbacks.remove(pool)
 *             if host_errors:
 */
  __pyx_tuple__65 = PyTuple_Pack(2, __pyx_n_s_pool, __pyx_n_s_host_errors); if (unlikely(!__pyx_tuple__65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);
  __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_pool_finished_setting_keyspace, 1930, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1959
 *                 'User type %s does not exist in keyspace %s' % (user_type, keyspace))
 * 
 *         def encode(val):             # <<<<<<<<<<<<<<
 *             return '{ %s }' % ' , '.join('%s : %s' % (
 *                 field_name,
 */
  __pyx_tuple__68 = PyTuple_Pack(3, __pyx_n_s_val, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);
  __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_encode, 1959, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2097
 *         Replace existing connection (if there is one) and close it.
 *         """
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             old = self._connection
 *             self._connection = conn
 */
  __pyx_tuple__70 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__70);
  __Pyx_GIVEREF(__pyx_tuple__70);

  /* "cassandra/cluster.py":2178
 * 
 *     def _reconnect(self):
 *         log.debug("[control connection] Attempting to reconnect")             # <<<<<<<<<<<<<<
 *         try:
 *             self._set_new_connection(self._reconnect_internal())
 */
  __pyx_tuple__71 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Attempting_t); if (unlikely(!__pyx_tuple__71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);

  /* "cassandra/cluster.py":2185
 *             schedule = self.cluster.reconnection_policy.new_schedule()
 * 
 *             with self._reconnection_lock:             # <<<<<<<<<<<<<<
 * 
 *                 # cancel existing reconnection attempts
 */
  __pyx_tuple__72 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);

  /* "cassandra/cluster.py":2200
 *                 self._reconnection_handler.start()
 *         except Exception:
 *             log.debug("[control connection] error reconnecting", exc_info=True)             # <<<<<<<<<<<<<<
 *             raise
 * 
 */
  __pyx_tuple__73 = PyTuple_Pack(1, __pyx_kp_s_control_connection_error_reconn); if (unlikely(!__pyx_tuple__73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);

  /* "cassandra/cluster.py":2209
 *         this ControlConnection.
 *         """
 *         with self._reconnection_lock:             # <<<<<<<<<<<<<<
 *             old = self._reconnection_handler
 *             self._reconnection_handler = new_handler
 */
  __pyx_tuple__74 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__74);
  __Pyx_GIVEREF(__pyx_tuple__74);
  __pyx_tuple__75 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);

  /* "cassandra/cluster.py":2224
 *     def shutdown(self):
 *         # stop trying to reconnect (if we are)
 *         with self._reconnection_lock:             # <<<<<<<<<<<<<<
 *             if self._reconnection_handler:
 *                 self._reconnection_handler.cancel()
 */
  __pyx_tuple__76 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__76);
  __Pyx_GIVEREF(__pyx_tuple__76);

  /* "cassandra/cluster.py":2234
 *                 self._is_shutdown = True
 * 
 *             log.debug("Shutting down control connection")             # <<<<<<<<<<<<<<
 *             if self._connection:
 *                 self._connection.close()
 */
  __pyx_tuple__77 = PyTuple_Pack(1, __pyx_kp_s_Shutting_down_control_connection); if (unlikely(!__pyx_tuple__77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);

  /* "cassandra/cluster.py":2228
 *                 self._reconnection_handler.cancel()
 * 
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self._is_shutdown:
 *                 return
 */
  __pyx_tuple__78 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__78);
  __Pyx_GIVEREF(__pyx_tuple__78);
  __pyx_tuple__79 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__79);
  __Pyx_GIVEREF(__pyx_tuple__79);

  /* "cassandra/cluster.py":2242
 *                        aggregate=None, schema_agreement_wait=None):
 *         if not self._meta_refresh_enabled:
 *             log.debug("[control connection] Skipping schema refresh because meta refresh is disabled")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_tuple__80 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Skipping_sch); if (unlikely(!__pyx_tuple__80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__80);
  __Pyx_GIVEREF(__pyx_tuple__80);

  /* "cassandra/cluster.py":2252
 *             pass  # our weak reference to the Cluster is no good
 *         except Exception:
 *             log.debug("[control connection] Error refreshing schema", exc_info=True)             # <<<<<<<<<<<<<<
 *             self._signal_error()
 *         return False
 */
  __pyx_tuple__81 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Error_refres); if (unlikely(!__pyx_tuple__81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__81);
  __Pyx_GIVEREF(__pyx_tuple__81);

  /* "cassandra/cluster.py":2267
 *                                                 wait_time=schema_agreement_wait)
 *         if not agreed:
 *             log.debug("Skipping schema refresh due to lack of schema agreement")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_tuple__82 = PyTuple_Pack(1, __pyx_kp_s_Skipping_schema_refresh_due_to_l); if (unlikely(!__pyx_tuple__82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__82);
  __Pyx_GIVEREF(__pyx_tuple__82);

  /* "cassandra/cluster.py":2272
 *         cl = ConsistencyLevel.ONE
 *         if table:
 *             def _handle_results(success, result):             # <<<<<<<<<<<<<<
 *                 if success:
 *                     return dict_factory(*result.results) if result else {}
 */
  __pyx_tuple__83 = PyTuple_Pack(2, __pyx_n_s_success, __pyx_n_s_result); if (unlikely(!__pyx_tuple__83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__83);
  __Pyx_GIVEREF(__pyx_tuple__83);
  __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_handle_results, 2272, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2370
 *             else:
 *                 if isinstance(triggers_result, InvalidRequest):
 *                     log.debug("[control connection] triggers table not found")             # <<<<<<<<<<<<<<
 *                     triggers_result = {}
 *                 elif isinstance(triggers_result, Unauthorized):
 */
  __pyx_tuple__86 = PyTuple_Pack(1, __pyx_kp_s_control_connection_triggers_tab); if (unlikely(!__pyx_tuple__86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__86);
  __Pyx_GIVEREF(__pyx_tuple__86);

  /* "cassandra/cluster.py":2373
 *                     triggers_result = {}
 *                 elif isinstance(triggers_result, Unauthorized):
 *                     log.warning("[control connection] this version of Cassandra does not allow access to schema_triggers metadata with authorization enabled (CASSANDRA-7967); "             # <<<<<<<<<<<<<<
 *                                 "The driver will operate normally, but will not reflect triggers in the local metadata model, or schema strings.")
 *                     triggers_result = {}
 */
  __pyx_tuple__87 = PyTuple_Pack(1, __pyx_kp_s_control_connection_this_version); if (unlikely(!__pyx_tuple__87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__87);
  __Pyx_GIVEREF(__pyx_tuple__87);

  /* "cassandra/cluster.py":2384
 *             else:
 *                 if isinstance(types_result, InvalidRequest):
 *                     log.debug("[control connection] user types table not found")             # <<<<<<<<<<<<<<
 *                     types_result = {}
 *                 else:
 */
  __pyx_tuple__88 = PyTuple_Pack(1, __pyx_kp_s_control_connection_user_types_t); if (unlikely(!__pyx_tuple__88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__88);
  __Pyx_GIVEREF(__pyx_tuple__88);

  /* "cassandra/cluster.py":2394
 *             else:
 *                 if isinstance(functions_result, InvalidRequest):
 *                     log.debug("[control connection] user functions table not found")             # <<<<<<<<<<<<<<
 *                     functions_result = {}
 *                 else:
 */
  __pyx_tuple__89 = PyTuple_Pack(1, __pyx_kp_s_control_connection_user_functio); if (unlikely(!__pyx_tuple__89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__89);
  __Pyx_GIVEREF(__pyx_tuple__89);

  /* "cassandra/cluster.py":2404
 *             else:
 *                 if isinstance(aggregates_result, InvalidRequest):
 *                     log.debug("[control connection] user aggregates table not found")             # <<<<<<<<<<<<<<
 *                     aggregates_result = {}
 *                 else:
 */
  __pyx_tuple__90 = PyTuple_Pack(1, __pyx_kp_s_control_connection_user_aggrega); if (unlikely(!__pyx_tuple__90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__90);
  __Pyx_GIVEREF(__pyx_tuple__90);

  /* "cassandra/cluster.py":2409
 *                     raise aggregates_result
 * 
 *             log.debug("[control connection] Fetched schema, rebuilding metadata")             # <<<<<<<<<<<<<<
 *             self._cluster.metadata.rebuild_schema(ks_result, types_result, functions_result,
 *                                                   aggregates_result, cf_result, col_result, triggers_result)
 */
  __pyx_tuple__91 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Fetched_sche); if (unlikely(!__pyx_tuple__91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);

  /* "cassandra/cluster.py":2416
 *     def refresh_node_list_and_token_map(self, force_token_rebuild=False):
 *         if not self._meta_refresh_enabled:
 *             log.debug("[control connection] Skipping node list refresh because meta refresh is disabled")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_tuple__92 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Skipping_nod); if (unlikely(!__pyx_tuple__92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__92);
  __Pyx_GIVEREF(__pyx_tuple__92);

  /* "cassandra/cluster.py":2426
 *             pass  # our weak reference to the Cluster is no good
 *         except Exception:
 *             log.debug("[control connection] Error refreshing node list and token map", exc_info=True)             # <<<<<<<<<<<<<<
 *             self._signal_error()
 *         return False
 */
  __pyx_tuple__93 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Error_refres_2); if (unlikely(!__pyx_tuple__93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__93);
  __Pyx_GIVEREF(__pyx_tuple__93);

  /* "cassandra/cluster.py":2434
 * 
 *         if preloaded_results:
 *             log.debug("[control connection] Refreshing node list and token map using preloaded results")             # <<<<<<<<<<<<<<
 *             peers_result = preloaded_results[0]
 *             local_result = preloaded_results[1]
 */
  __pyx_tuple__94 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Refreshing_n); if (unlikely(!__pyx_tuple__94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__94);
  __Pyx_GIVEREF(__pyx_tuple__94);

  /* "cassandra/cluster.py":2438
 *             local_result = preloaded_results[1]
 *         else:
 *             log.debug("[control connection] Refreshing node list and token map")             # <<<<<<<<<<<<<<
 *             cl = ConsistencyLevel.ONE
 *             peers_query = QueryMessage(query=self._SELECT_PEERS, consistency_level=cl)
 */
  __pyx_tuple__95 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Refreshing_n_2); if (unlikely(!__pyx_tuple__95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__95);
  __Pyx_GIVEREF(__pyx_tuple__95);

  /* "cassandra/cluster.py":2458
 *             host = self._cluster.metadata.get_host(connection.host)
 *             if host:
 *                 datacenter = local_row.get("data_center")             # <<<<<<<<<<<<<<
 *                 rack = local_row.get("rack")
 *                 self._update_location_info(host, datacenter, rack)
 */
  __pyx_tuple__96 = PyTuple_Pack(1, __pyx_n_s_data_center); if (unlikely(!__pyx_tuple__96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);

  /* "cassandra/cluster.py":2459
 *             if host:
 *                 datacenter = local_row.get("data_center")
 *                 rack = local_row.get("rack")             # <<<<<<<<<<<<<<
 *                 self._update_location_info(host, datacenter, rack)
 * 
 */
  __pyx_tuple__97 = PyTuple_Pack(1, __pyx_n_s_rack); if (unlikely(!__pyx_tuple__97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__97);
  __Pyx_GIVEREF(__pyx_tuple__97);

  /* "cassandra/cluster.py":2462
 *                 self._update_location_info(host, datacenter, rack)
 * 
 *             partitioner = local_row.get("partitioner")             # <<<<<<<<<<<<<<
 *             tokens = local_row.get("tokens")
 *             if partitioner and tokens:
 */
  __pyx_tuple__98 = PyTuple_Pack(1, __pyx_n_s_partitioner); if (unlikely(!__pyx_tuple__98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__98);
  __Pyx_GIVEREF(__pyx_tuple__98);

  /* "cassandra/cluster.py":2463
 * 
 *             partitioner = local_row.get("partitioner")
 *             tokens = local_row.get("tokens")             # <<<<<<<<<<<<<<
 *             if partitioner and tokens:
 *                 token_map[host] = tokens
 */
  __pyx_tuple__99 = PyTuple_Pack(1, __pyx_n_s_tokens); if (unlikely(!__pyx_tuple__99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);

  /* "cassandra/cluster.py":2473
 *         found_hosts = set()
 *         for row in peers_result:
 *             addr = row.get("rpc_address")             # <<<<<<<<<<<<<<
 * 
 *             if not addr or addr in ["0.0.0.0", "::"]:
 */
  __pyx_tuple__100 = PyTuple_Pack(1, __pyx_n_s_rpc_address); if (unlikely(!__pyx_tuple__100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__100);
  __Pyx_GIVEREF(__pyx_tuple__100);

  /* "cassandra/cluster.py":2476
 * 
 *             if not addr or addr in ["0.0.0.0", "::"]:
 *                 addr = row.get("peer")             # <<<<<<<<<<<<<<
 * 
 *             tokens = row.get("tokens")
 */
  __pyx_tuple__102 = PyTuple_Pack(1, __pyx_n_s_peer); if (unlikely(!__pyx_tuple__102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__102);
  __Pyx_GIVEREF(__pyx_tuple__102);

  /* "cassandra/cluster.py":2478
 *                 addr = row.get("peer")
 * 
 *             tokens = row.get("tokens")             # <<<<<<<<<<<<<<
 *             if not tokens:
 *                 log.warning("Excluding host (%s) with no tokens in system.peers table of %s." % (addr, connection.host))
 */
  __pyx_tuple__103 = PyTuple_Pack(1, __pyx_n_s_tokens); if (unlikely(!__pyx_tuple__103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);

  /* "cassandra/cluster.py":2486
 * 
 *             host = self._cluster.metadata.get_host(addr)
 *             datacenter = row.get("data_center")             # <<<<<<<<<<<<<<
 *             rack = row.get("rack")
 *             if host is None:
 */
  __pyx_tuple__104 = PyTuple_Pack(1, __pyx_n_s_data_center); if (unlikely(!__pyx_tuple__104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__104);
  __Pyx_GIVEREF(__pyx_tuple__104);

  /* "cassandra/cluster.py":2487
 *             host = self._cluster.metadata.get_host(addr)
 *             datacenter = row.get("data_center")
 *             rack = row.get("rack")             # <<<<<<<<<<<<<<
 *             if host is None:
 *                 log.debug("[control connection] Found new host to connect to: %s", addr)
 */
  __pyx_tuple__105 = PyTuple_Pack(1, __pyx_n_s_rack); if (unlikely(!__pyx_tuple__105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__105);
  __Pyx_GIVEREF(__pyx_tuple__105);

  /* "cassandra/cluster.py":2505
 *                     self._cluster.remove_host(old_host)
 * 
 *         log.debug("[control connection] Finished fetching ring info")             # <<<<<<<<<<<<<<
 *         if partitioner and should_rebuild_token_map:
 *             log.debug("[control connection] Rebuilding token map due to topology changes")
 */
  __pyx_tuple__106 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Finished_fet); if (unlikely(!__pyx_tuple__106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__106);
  __Pyx_GIVEREF(__pyx_tuple__106);

  /* "cassandra/cluster.py":2507
 *         log.debug("[control connection] Finished fetching ring info")
 *         if partitioner and should_rebuild_token_map:
 *             log.debug("[control connection] Rebuilding token map due to topology changes")             # <<<<<<<<<<<<<<
 *             self._cluster.metadata.rebuild_token_map(partitioner, token_map)
 * 
 */
  __pyx_tuple__107 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Rebuilding_t); if (unlikely(!__pyx_tuple__107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__107);
  __Pyx_GIVEREF(__pyx_tuple__107);

  /* "cassandra/cluster.py":2552
 *         host = self._cluster.metadata.get_host(addr)
 *         if change_type == "UP":
 *             delay = 1 + self._delay_for_event_type('status_change', 0.5)  # randomness to avoid thundering herd problem on events             # <<<<<<<<<<<<<<
 *             if host is None:
 *                 # this is the first time we've seen the node
 */
  __pyx_tuple__108 = PyTuple_Pack(2, __pyx_n_s_status_change, __pyx_float_0_5); if (unlikely(!__pyx_tuple__108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__108);
  __Pyx_GIVEREF(__pyx_tuple__108);

  /* "cassandra/cluster.py":2570
 *         if self._schema_event_refresh_window < 0:
 *             return
 *         keyspace = event.get('keyspace')             # <<<<<<<<<<<<<<
 *         table = event.get('table')
 *         usertype = event.get('type')
 */
  __pyx_tuple__109 = PyTuple_Pack(1, __pyx_n_s_keyspace); if (unlikely(!__pyx_tuple__109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__109);
  __Pyx_GIVEREF(__pyx_tuple__109);

  /* "cassandra/cluster.py":2571
 *             return
 *         keyspace = event.get('keyspace')
 *         table = event.get('table')             # <<<<<<<<<<<<<<
 *         usertype = event.get('type')
 *         function = event.get('function')
 */
  __pyx_tuple__110 = PyTuple_Pack(1, __pyx_n_s_table); if (unlikely(!__pyx_tuple__110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__110);
  __Pyx_GIVEREF(__pyx_tuple__110);

  /* "cassandra/cluster.py":2572
 *         keyspace = event.get('keyspace')
 *         table = event.get('table')
 *         usertype = event.get('type')             # <<<<<<<<<<<<<<
 *         function = event.get('function')
 *         aggregate = event.get('aggregate')
 */
  __pyx_tuple__111 = PyTuple_Pack(1, __pyx_n_s_type); if (unlikely(!__pyx_tuple__111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__111);
  __Pyx_GIVEREF(__pyx_tuple__111);

  /* "cassandra/cluster.py":2573
 *         table = event.get('table')
 *         usertype = event.get('type')
 *         function = event.get('function')             # <<<<<<<<<<<<<<
 *         aggregate = event.get('aggregate')
 *         delay = self._delay_for_event_type('schema_change', self._schema_event_refresh_window)
 */
  __pyx_tuple__112 = PyTuple_Pack(1, __pyx_n_s_function); if (unlikely(!__pyx_tuple__112)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__112);
  __Pyx_GIVEREF(__pyx_tuple__112);

  /* "cassandra/cluster.py":2574
 *         usertype = event.get('type')
 *         function = event.get('function')
 *         aggregate = event.get('aggregate')             # <<<<<<<<<<<<<<
 *         delay = self._delay_for_event_type('schema_change', self._schema_event_refresh_window)
 *         self._cluster.scheduler.schedule_unique(delay, self.refresh_schema, keyspace, table, usertype, function, aggregate)
 */
  __pyx_tuple__113 = PyTuple_Pack(1, __pyx_n_s_aggregate); if (unlikely(!__pyx_tuple__113)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__113);
  __Pyx_GIVEREF(__pyx_tuple__113);

  /* "cassandra/cluster.py":2596
 * 
 *             if preloaded_results:
 *                 log.debug("[control connection] Attempting to use preloaded results for schema agreement")             # <<<<<<<<<<<<<<
 * 
 *                 peers_result = preloaded_results[0]
 */
  __pyx_tuple__114 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Attempting_t_2); if (unlikely(!__pyx_tuple__114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__114);
  __Pyx_GIVEREF(__pyx_tuple__114);

  /* "cassandra/cluster.py":2604
 *                     return True
 * 
 *             log.debug("[control connection] Waiting for schema agreement")             # <<<<<<<<<<<<<<
 *             start = self._time.time()
 *             elapsed = 0
 */
  __pyx_tuple__115 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Waiting_for); if (unlikely(!__pyx_tuple__115)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__115);
  __Pyx_GIVEREF(__pyx_tuple__115);

  /* "cassandra/cluster.py":2623
 *                 except ConnectionShutdown:
 *                     if self._is_shutdown:
 *                         log.debug("[control connection] Aborting wait for schema match due to shutdown")             # <<<<<<<<<<<<<<
 *                         return None
 *                     else:
 */
  __pyx_tuple__116 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Aborting_wai); if (unlikely(!__pyx_tuple__116)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__116);
  __Pyx_GIVEREF(__pyx_tuple__116);

  /* "cassandra/cluster.py":2632
 *                     return True
 * 
 *                 log.debug("[control connection] Schemas mismatched, trying again")             # <<<<<<<<<<<<<<
 *                 self._time.sleep(0.2)
 *                 elapsed = self._time.time() - start
 */
  __pyx_tuple__117 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Schemas_mism); if (unlikely(!__pyx_tuple__117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__117);
  __Pyx_GIVEREF(__pyx_tuple__117);

  /* "cassandra/cluster.py":2633
 * 
 *                 log.debug("[control connection] Schemas mismatched, trying again")
 *                 self._time.sleep(0.2)             # <<<<<<<<<<<<<<
 *                 elapsed = self._time.time() - start
 * 
 */
  __pyx_tuple__118 = PyTuple_Pack(1, __pyx_float_0_2); if (unlikely(!__pyx_tuple__118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__118);
  __Pyx_GIVEREF(__pyx_tuple__118);

  /* "cassandra/cluster.py":2588
 *         # a lock is just a simple way to cut down on the number of schema queries
 *         # we'll make.
 *         with self._schema_agreement_lock:             # <<<<<<<<<<<<<<
 *             if self._is_shutdown:
 *                 return
 */
  __pyx_tuple__119 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__119)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__119);
  __Pyx_GIVEREF(__pyx_tuple__119);
  __pyx_tuple__120 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__120);
  __Pyx_GIVEREF(__pyx_tuple__120);

  /* "cassandra/cluster.py":2646
 *         if local_result.results:
 *             local_row = dict_factory(*local_result.results)[0]
 *             if local_row.get("schema_version"):             # <<<<<<<<<<<<<<
 *                 versions[local_row.get("schema_version")].add(local_address)
 * 
 */
  __pyx_tuple__121 = PyTuple_Pack(1, __pyx_n_s_schema_version); if (unlikely(!__pyx_tuple__121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__121);
  __Pyx_GIVEREF(__pyx_tuple__121);

  /* "cassandra/cluster.py":2647
 *             local_row = dict_factory(*local_result.results)[0]
 *             if local_row.get("schema_version"):
 *                 versions[local_row.get("schema_version")].add(local_address)             # <<<<<<<<<<<<<<
 * 
 *         for row in peers_result:
 */
  __pyx_tuple__122 = PyTuple_Pack(1, __pyx_n_s_schema_version); if (unlikely(!__pyx_tuple__122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__122);
  __Pyx_GIVEREF(__pyx_tuple__122);

  /* "cassandra/cluster.py":2650
 * 
 *         for row in peers_result:
 *             schema_ver = row.get('schema_version')             # <<<<<<<<<<<<<<
 *             if not schema_ver:
 *                 continue
 */
  __pyx_tuple__123 = PyTuple_Pack(1, __pyx_n_s_schema_version); if (unlikely(!__pyx_tuple__123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__123);
  __Pyx_GIVEREF(__pyx_tuple__123);

  /* "cassandra/cluster.py":2654
 *                 continue
 * 
 *             addr = row.get("rpc_address")             # <<<<<<<<<<<<<<
 *             if not addr or addr in ["0.0.0.0", "::"]:
 *                 addr = row.get("peer")
 */
  __pyx_tuple__124 = PyTuple_Pack(1, __pyx_n_s_rpc_address); if (unlikely(!__pyx_tuple__124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__124);
  __Pyx_GIVEREF(__pyx_tuple__124);

  /* "cassandra/cluster.py":2656
 *             addr = row.get("rpc_address")
 *             if not addr or addr in ["0.0.0.0", "::"]:
 *                 addr = row.get("peer")             # <<<<<<<<<<<<<<
 * 
 *             peer = self._cluster.metadata.get_host(addr)
 */
  __pyx_tuple__125 = PyTuple_Pack(1, __pyx_n_s_peer); if (unlikely(!__pyx_tuple__125)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__125);
  __Pyx_GIVEREF(__pyx_tuple__125);

  /* "cassandra/cluster.py":2663
 * 
 *         if len(versions) == 1:
 *             log.debug("[control connection] Schemas match")             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __pyx_tuple__126 = PyTuple_Pack(1, __pyx_kp_s_control_connection_Schemas_matc); if (unlikely(!__pyx_tuple__126)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__126);
  __Pyx_GIVEREF(__pyx_tuple__126);

  /* "cassandra/cluster.py":2669
 * 
 *     def _signal_error(self):
 *         with self._lock:             # <<<<<<<<<<<<<<
 *             if self._is_shutdown:
 *                 return
 */
  __pyx_tuple__127 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__127);
  __Pyx_GIVEREF(__pyx_tuple__127);
  __pyx_tuple__128 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__128);
  __Pyx_GIVEREF(__pyx_tuple__128);

  /* "cassandra/cluster.py":2752
 *     def shutdown(self):
 *         try:
 *             log.debug("Shutting down Cluster Scheduler")             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             # this can happen on interpreter shutdown
 */
  __pyx_tuple__129 = PyTuple_Pack(1, __pyx_kp_s_Shutting_down_Cluster_Scheduler); if (unlikely(!__pyx_tuple__129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__129);
  __Pyx_GIVEREF(__pyx_tuple__129);

  /* "cassandra/cluster.py":2757
 *             pass
 *         self.is_shutdown = True
 *         self._queue.put_nowait((0, None))             # <<<<<<<<<<<<<<
 * 
 *     def schedule(self, delay, fn, *args):
 */
  __pyx_tuple__130 = PyTuple_Pack(2, __pyx_int_0, Py_None); if (unlikely(!__pyx_tuple__130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__130);
  __Pyx_GIVEREF(__pyx_tuple__130);
  __pyx_tuple__131 = PyTuple_Pack(1, __pyx_tuple__130); if (unlikely(!__pyx_tuple__131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__131);
  __Pyx_GIVEREF(__pyx_tuple__131);

  /* "cassandra/cluster.py":2786
 *                     run_at, task = self._queue.get(block=True, timeout=None)
 *                     if self.is_shutdown:
 *                         log.debug("Not executing scheduled task due to Scheduler shutdown")             # <<<<<<<<<<<<<<
 *                         return
 *                     if run_at <= time.time():
 */
  __pyx_tuple__132 = PyTuple_Pack(1, __pyx_kp_s_Not_executing_scheduled_task_due); if (unlikely(!__pyx_tuple__132)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__132);
  __Pyx_GIVEREF(__pyx_tuple__132);

  /* "cassandra/cluster.py":2799
 *                 pass
 * 
 *             time.sleep(0.1)             # <<<<<<<<<<<<<<
 * 
 *     def _log_if_failed(self, future):
 */
  __pyx_tuple__133 = PyTuple_Pack(1, __pyx_float_0_1); if (unlikely(!__pyx_tuple__133)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__133);
  __Pyx_GIVEREF(__pyx_tuple__133);

  /* "cassandra/cluster.py":2804
 *         exc = future.exception()
 *         if exc:
 *             log.warning(             # <<<<<<<<<<<<<<
 *                 "An internally scheduled tasked failed with an unhandled exception:",
 *                 exc_info=exc)
 */
  __pyx_tuple__134 = PyTuple_Pack(1, __pyx_kp_s_An_internally_scheduled_tasked_f); if (unlikely(!__pyx_tuple__134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__134);
  __Pyx_GIVEREF(__pyx_tuple__134);

  /* "cassandra/cluster.py":2820
 *                       "Keyspace: %s; Table: %s, Type: %s, Function: %s", keyspace, table, usertype, function, aggregate)
 *     except Exception:
 *         log.exception("Exception refreshing schema in response to schema change:")             # <<<<<<<<<<<<<<
 *         response_future.session.submit(
 *             control_conn.refresh_schema, keyspace, table, usertype, function, aggregate)
 */
  __pyx_tuple__135 = PyTuple_Pack(1, __pyx_kp_s_Exception_refreshing_schema_in_r); if (unlikely(!__pyx_tuple__135)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__135);
  __Pyx_GIVEREF(__pyx_tuple__135);

  /* "cassandra/cluster.py":2824
 *             control_conn.refresh_schema, keyspace, table, usertype, function, aggregate)
 *     finally:
 *         response_future._set_final_result(None)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__136 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__136)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__136);
  __Pyx_GIVEREF(__pyx_tuple__136);
  __pyx_tuple__137 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__137);
  __Pyx_GIVEREF(__pyx_tuple__137);

  /* "cassandra/cluster.py":2926
 *         pool = self.session._pools.get(host)
 *         if not pool:
 *             self._errors[host] = ConnectionException("Host has been marked down or removed")             # <<<<<<<<<<<<<<
 *             return None
 *         elif pool.is_shutdown:
 */
  __pyx_tuple__138 = PyTuple_Pack(1, __pyx_kp_s_Host_has_been_marked_down_or_rem); if (unlikely(!__pyx_tuple__138)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__138);
  __Pyx_GIVEREF(__pyx_tuple__138);

  /* "cassandra/cluster.py":2929
 *             return None
 *         elif pool.is_shutdown:
 *             self._errors[host] = ConnectionException("Pool is shutdown")             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __pyx_tuple__139 = PyTuple_Pack(1, __pyx_kp_s_Pool_is_shutdown); if (unlikely(!__pyx_tuple__139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__139);
  __Pyx_GIVEREF(__pyx_tuple__139);

  /* "cassandra/cluster.py":2981
 *         # TODO: When timers are introduced, just make this wait
 *         if not self._event.is_set():
 *             raise Exception("warnings cannot be retrieved before ResponseFuture is finalized")             # <<<<<<<<<<<<<<
 *         return self._warnings
 * 
 */
  __pyx_tuple__140 = PyTuple_Pack(1, __pyx_kp_s_warnings_cannot_be_retrieved_bef); if (unlikely(!__pyx_tuple__140)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__140);
  __Pyx_GIVEREF(__pyx_tuple__140);

  /* "cassandra/cluster.py":2999
 *         # TODO: When timers are introduced, just make this wait
 *         if not self._event.is_set():
 *             raise Exception("custom_payload cannot be retrieved before ResponseFuture is finalized")             # <<<<<<<<<<<<<<
 *         return self._custom_payload
 * 
 */
  __pyx_tuple__141 = PyTuple_Pack(1, __pyx_kp_s_custom_payload_cannot_be_retriev); if (unlikely(!__pyx_tuple__141)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__141);
  __Pyx_GIVEREF(__pyx_tuple__141);

  /* "cassandra/cluster.py":3063
 *                         refresh_schema_and_set_result,
 *                         response.results['keyspace'],
 *                         response.results.get('table'),             # <<<<<<<<<<<<<<
 *                         response.results.get('type'),
 *                         response.results.get('function'),
 */
  __pyx_tuple__142 = PyTuple_Pack(1, __pyx_n_s_table); if (unlikely(!__pyx_tuple__142)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__142);
  __Pyx_GIVEREF(__pyx_tuple__142);

  /* "cassandra/cluster.py":3064
 *                         response.results['keyspace'],
 *                         response.results.get('table'),
 *                         response.results.get('type'),             # <<<<<<<<<<<<<<
 *                         response.results.get('function'),
 *                         response.results.get('aggregate'),
 */
  __pyx_tuple__143 = PyTuple_Pack(1, __pyx_n_s_type); if (unlikely(!__pyx_tuple__143)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__143);
  __Pyx_GIVEREF(__pyx_tuple__143);

  /* "cassandra/cluster.py":3065
 *                         response.results.get('table'),
 *                         response.results.get('type'),
 *                         response.results.get('function'),             # <<<<<<<<<<<<<<
 *                         response.results.get('aggregate'),
 *                         self.session.cluster.control_connection,
 */
  __pyx_tuple__144 = PyTuple_Pack(1, __pyx_n_s_function); if (unlikely(!__pyx_tuple__144)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__144);
  __Pyx_GIVEREF(__pyx_tuple__144);

  /* "cassandra/cluster.py":3066
 *                         response.results.get('type'),
 *                         response.results.get('function'),
 *                         response.results.get('aggregate'),             # <<<<<<<<<<<<<<
 *                         self.session.cluster.control_connection,
 *                         self)
 */
  __pyx_tuple__145 = PyTuple_Pack(1, __pyx_n_s_aggregate); if (unlikely(!__pyx_tuple__145)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__145);
  __Pyx_GIVEREF(__pyx_tuple__145);

  /* "cassandra/cluster.py":3125
 *                         if not self.prepared_statement:
 *                             log.error("Tried to execute unknown prepared statement: id=%s",
 *                                       query_id.encode('hex'))             # <<<<<<<<<<<<<<
 *                             self._set_final_exception(response)
 *                             return
 */
  __pyx_tuple__146 = PyTuple_Pack(1, __pyx_n_s_hex); if (unlikely(!__pyx_tuple__146)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__146);
  __Pyx_GIVEREF(__pyx_tuple__146);

  /* "cassandra/cluster.py":3165
 *                     if self._metrics is not None:
 *                         self._metrics.on_ignore()
 *                     self._set_final_result(None)             # <<<<<<<<<<<<<<
 *             elif isinstance(response, ConnectionException):
 *                 if self._metrics is not None:
 */
  __pyx_tuple__147 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__147)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__147);
  __Pyx_GIVEREF(__pyx_tuple__147);

  /* "cassandra/cluster.py":3185
 *         except Exception as exc:
 *             # almost certainly caused by a bug, but we need to set something here
 *             log.exception("Unexpected exception while handling result in ResponseFuture:")             # <<<<<<<<<<<<<<
 *             self._set_final_exception(exc)
 * 
 */
  __pyx_tuple__148 = PyTuple_Pack(1, __pyx_kp_s_Unexpected_exception_while_handl); if (unlikely(!__pyx_tuple__148)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__148);
  __Pyx_GIVEREF(__pyx_tuple__148);

  /* "cassandra/cluster.py":3190
 *     def _set_keyspace_completed(self, errors):
 *         if not errors:
 *             self._set_final_result(None)             # <<<<<<<<<<<<<<
 *         else:
 *             self._set_final_exception(ConnectionException(
 */
  __pyx_tuple__149 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__149)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__149);
  __Pyx_GIVEREF(__pyx_tuple__149);

  /* "cassandra/cluster.py":3239
 *             self._metrics.request_timer.addValue(time.time() - self._start_time)
 * 
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             self._final_result = response
 * 
 */
  __pyx_tuple__150 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__150)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__150);
  __Pyx_GIVEREF(__pyx_tuple__150);

  /* "cassandra/cluster.py":3254
 *             self._metrics.request_timer.addValue(time.time() - self._start_time)
 * 
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             self._final_exception = response
 *         self._event.set()
 */
  __pyx_tuple__151 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__151)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__151);
  __Pyx_GIVEREF(__pyx_tuple__151);

  /* "cassandra/cluster.py":3397
 *         """
 *         run_now = False
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             if self._final_result is not _NOT_SET:
 *                 run_now = True
 */
  __pyx_tuple__152 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__152)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__152);
  __Pyx_GIVEREF(__pyx_tuple__152);

  /* "cassandra/cluster.py":3413
 *         """
 *         run_now = False
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             if self._final_exception:
 *                 run_now = True
 */
  __pyx_tuple__153 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__153)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__153);
  __Pyx_GIVEREF(__pyx_tuple__153);

  /* "cassandra/cluster.py":3451
 * 
 *     def clear_callbacks(self):
 *         with self._callback_lock:             # <<<<<<<<<<<<<<
 *             self._callback = []
 *             self._errback = []
 */
  __pyx_tuple__154 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__154)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__154);
  __Pyx_GIVEREF(__pyx_tuple__154);

  /* "cassandra/cluster.py":77
 * 
 * 
 * def _is_eventlet_monkey_patched():             # <<<<<<<<<<<<<<
 *     if 'eventlet.patcher' not in sys.modules:
 *         return False
 */
  __pyx_tuple__155 = PyTuple_Pack(1, __pyx_n_s_eventlet); if (unlikely(!__pyx_tuple__155)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__155);
  __Pyx_GIVEREF(__pyx_tuple__155);
  __pyx_codeobj__156 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__155, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_is_eventlet_monkey_patched, 77, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__156)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":83
 *     return eventlet.patcher.is_monkey_patched('socket')
 * 
 * def _is_gevent_monkey_patched():             # <<<<<<<<<<<<<<
 *     if 'gevent.monkey' not in sys.modules:
 *         return False
 */
  __pyx_tuple__157 = PyTuple_Pack(1, __pyx_n_s_gevent); if (unlikely(!__pyx_tuple__157)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__157);
  __Pyx_GIVEREF(__pyx_tuple__157);
  __pyx_codeobj__158 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_is_gevent_monkey_patched, 83, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__158)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":106
 * # thread.
 * # See http://bugs.python.org/issue10923
 * "".encode('utf8')             # <<<<<<<<<<<<<<
 * 
 * log = logging.getLogger(__name__)
 */
  __pyx_tuple__160 = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple__160)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__160);
  __Pyx_GIVEREF(__pyx_tuple__160);

  /* "cassandra/cluster.py":137
 *     """
 * 
 *     def __init__(self, message, errors):             # <<<<<<<<<<<<<<
 *         Exception.__init__(self, message, errors)
 *         self.errors = errors
 */
  __pyx_tuple__161 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_message, __pyx_n_s_errors); if (unlikely(!__pyx_tuple__161)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__161);
  __Pyx_GIVEREF(__pyx_tuple__161);
  __pyx_codeobj__162 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__161, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_init, 137, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__162)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":142
 * 
 * 
 * def _future_completed(future):             # <<<<<<<<<<<<<<
 *     """ Helper for run_in_executor() """
 *     exc = future.exception()
 */
  __pyx_tuple__163 = PyTuple_Pack(2, __pyx_n_s_future, __pyx_n_s_exc); if (unlikely(!__pyx_tuple__163)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__163);
  __Pyx_GIVEREF(__pyx_tuple__163);
  __pyx_codeobj__164 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__163, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_future_completed, 142, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__164)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":149
 * 
 * 
 * def run_in_executor(f):             # <<<<<<<<<<<<<<
 *     """
 *     A decorator to run the given method in the ThreadPoolExecutor.
 */
  __pyx_tuple__165 = PyTuple_Pack(3, __pyx_n_s_f, __pyx_n_s_new_f, __pyx_n_s_new_f); if (unlikely(!__pyx_tuple__165)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__165);
  __Pyx_GIVEREF(__pyx_tuple__165);
  __pyx_codeobj__166 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__165, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_run_in_executor, 149, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__166)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":168
 * 
 * 
 * def _shutdown_cluster(cluster):             # <<<<<<<<<<<<<<
 *     if cluster and not cluster.is_shutdown:
 *         cluster.shutdown()
 */
  __pyx_tuple__167 = PyTuple_Pack(1, __pyx_n_s_cluster); if (unlikely(!__pyx_tuple__167)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__167);
  __Pyx_GIVEREF(__pyx_tuple__167);
  __pyx_codeobj__168 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__167, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_shutdown_cluster, 168, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__168)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":176
 * import platform
 * if platform.python_implementation() == 'CPython':
 *     def default_lbp_factory():             # <<<<<<<<<<<<<<
 *         if murmur3 is not None:
 *             return TokenAwarePolicy(DCAwareRoundRobinPolicy())
 */
  __pyx_codeobj__169 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_default_lbp_factory, 176, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__169)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":181
 *         return DCAwareRoundRobinPolicy()
 * else:
 *     def default_lbp_factory():             # <<<<<<<<<<<<<<
 *         return DCAwareRoundRobinPolicy()
 * 
 */
  __pyx_codeobj__170 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_default_lbp_factory, 181, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__170)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":281
 * 
 *     @property
 *     def auth_provider(self):             # <<<<<<<<<<<<<<
 *         """
 *         When :attr:`~.Cluster.protocol_version` is 2 or higher, this should
 */
  __pyx_tuple__171 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__171)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__171);
  __Pyx_GIVEREF(__pyx_tuple__171);
  __pyx_codeobj__172 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__171, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_auth_provider_2, 281, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__172)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":296
 * 
 *     @auth_provider.setter  # noqa
 *     def auth_provider(self, value):             # <<<<<<<<<<<<<<
 *         if not value:
 *             self._auth_provider = value
 */
  __pyx_tuple__173 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__173)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__173);
  __Pyx_GIVEREF(__pyx_tuple__173);
  __pyx_codeobj__174 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__173, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_auth_provider_2, 296, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__174)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":328
 *     """
 * 
 *     reconnection_policy = ExponentialReconnectionPolicy(1.0, 600.0)             # <<<<<<<<<<<<<<
 *     """
 *     An instance of :class:`.policies.ReconnectionPolicy`. Defaults to an instance
 */
  __pyx_tuple__175 = PyTuple_Pack(2, __pyx_float_1_0, __pyx_float_600_0); if (unlikely(!__pyx_tuple__175)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__175);
  __Pyx_GIVEREF(__pyx_tuple__175);

  /* "cassandra/cluster.py":498
 *     _listener_lock = None
 * 
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *                  contact_points=["127.0.0.1"],
 *                  port=9042,
 */
  __pyx_tuple__176 = PyTuple_Pack(23, __pyx_n_s_self, __pyx_n_s_contact_points, __pyx_n_s_port, __pyx_n_s_compression, __pyx_n_s_auth_provider_2, __pyx_n_s_load_balancing_policy, __pyx_n_s_reconnection_policy, __pyx_n_s_default_retry_policy, __pyx_n_s_conviction_policy_factory, __pyx_n_s_metrics_enabled, __pyx_n_s_connection_class, __pyx_n_s_ssl_options, __pyx_n_s_sockopts, __pyx_n_s_cql_version, __pyx_n_s_protocol_version, __pyx_n_s_executor_threads, __pyx_n_s_max_schema_agreement_wait, __pyx_n_s_control_connection_timeout, __pyx_n_s_idle_heartbeat_interval, __pyx_n_s_schema_event_refresh_window, __pyx_n_s_topology_event_refresh_window, __pyx_n_s_connect_timeout, __pyx_n_s_Metrics); if (unlikely(!__pyx_tuple__176)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__176);
  __Pyx_GIVEREF(__pyx_tuple__176);
  __pyx_codeobj__177 = (PyObject*)__Pyx_PyCode_New(22, 0, 23, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__176, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_init, 498, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__177)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":620
 *             self.schema_event_refresh_window, self.topology_event_refresh_window)
 * 
 *     def register_user_type(self, keyspace, user_type, klass):             # <<<<<<<<<<<<<<
 *         """
 *         Registers a class to use to represent a particular user-defined type.
 */
  __pyx_tuple__178 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_keyspace, __pyx_n_s_user_type, __pyx_n_s_klass, __pyx_n_s_session); if (unlikely(!__pyx_tuple__178)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__178);
  __Pyx_GIVEREF(__pyx_tuple__178);
  __pyx_codeobj__179 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__178, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_register_user_type, 620, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__179)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":678
 *         UserType.evict_udt_class(keyspace, user_type)
 * 
 *     def get_min_requests_per_connection(self, host_distance):             # <<<<<<<<<<<<<<
 *         return self._min_requests_per_connection[host_distance]
 * 
 */
  __pyx_tuple__180 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_host_distance); if (unlikely(!__pyx_tuple__180)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__180);
  __Pyx_GIVEREF(__pyx_tuple__180);
  __pyx_codeobj__181 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__180, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_get_min_requests_per_connection, 678, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__181)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":681
 *         return self._min_requests_per_connection[host_distance]
 * 
 *     def set_min_requests_per_connection(self, host_distance, min_requests):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a threshold for concurrent requests per connection, below which
 */
  __pyx_tuple__182 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_host_distance, __pyx_n_s_min_requests); if (unlikely(!__pyx_tuple__182)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__182);
  __Pyx_GIVEREF(__pyx_tuple__182);
  __pyx_codeobj__183 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__182, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_set_min_requests_per_connection, 681, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__183)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":695
 *         self._min_requests_per_connection[host_distance] = min_requests
 * 
 *     def get_max_requests_per_connection(self, host_distance):             # <<<<<<<<<<<<<<
 *         return self._max_requests_per_connection[host_distance]
 * 
 */
  __pyx_tuple__184 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_host_distance); if (unlikely(!__pyx_tuple__184)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__184);
  __Pyx_GIVEREF(__pyx_tuple__184);
  __pyx_codeobj__185 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__184, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_get_max_requests_per_connection, 695, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__185)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":698
 *         return self._max_requests_per_connection[host_distance]
 * 
 *     def set_max_requests_per_connection(self, host_distance, max_requests):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a threshold for concurrent requests per connection, above which new
 */
  __pyx_tuple__186 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_host_distance, __pyx_n_s_max_requests); if (unlikely(!__pyx_tuple__186)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__186);
  __Pyx_GIVEREF(__pyx_tuple__186);
  __pyx_codeobj__187 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__186, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_set_max_requests_per_connection, 698, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__187)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":712
 *         self._max_requests_per_connection[host_distance] = max_requests
 * 
 *     def get_core_connections_per_host(self, host_distance):             # <<<<<<<<<<<<<<
 *         """
 *         Gets the minimum number of connections per Session that will be opened
 */
  __pyx_tuple__188 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_host_distance); if (unlikely(!__pyx_tuple__188)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__188);
  __Pyx_GIVEREF(__pyx_tuple__188);
  __pyx_codeobj__189 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__188, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_get_core_connections_per_host, 712, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__189)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":724
 *         return self._core_connections_per_host[host_distance]
 * 
 *     def set_core_connections_per_host(self, host_distance, core_connections):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the minimum number of connections per Session that will be opened
 */
  __pyx_tuple__190 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_host_distance, __pyx_n_s_core_connections, __pyx_n_s_old); if (unlikely(!__pyx_tuple__190)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__190);
  __Pyx_GIVEREF(__pyx_tuple__190);
  __pyx_codeobj__191 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__190, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_set_core_connections_per_host, 724, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__191)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":749
 *             self._ensure_core_connections()
 * 
 *     def get_max_connections_per_host(self, host_distance):             # <<<<<<<<<<<<<<
 *         """
 *         Gets the maximum number of connections per Session that will be opened
 */
  __pyx_tuple__192 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_host_distance); if (unlikely(!__pyx_tuple__192)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__192);
  __Pyx_GIVEREF(__pyx_tuple__192);
  __pyx_codeobj__193 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__192, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_get_max_connections_per_host, 749, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__193)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":761
 *         return self._max_connections_per_host[host_distance]
 * 
 *     def set_max_connections_per_host(self, host_distance, max_connections):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the maximum number of connections per Session that will be opened
 */
  __pyx_tuple__194 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_host_distance, __pyx_n_s_max_connections); if (unlikely(!__pyx_tuple__194)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__194);
  __Pyx_GIVEREF(__pyx_tuple__194);
  __pyx_codeobj__195 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__194, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_set_max_connections_per_host, 761, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__195)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":779
 *         self._max_connections_per_host[host_distance] = max_connections
 * 
 *     def connection_factory(self, address, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Called to create a new connection with proper configuration.
 */
  __pyx_tuple__196 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_address, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__196)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__196);
  __Pyx_GIVEREF(__pyx_tuple__196);
  __pyx_codeobj__197 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__196, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_connection_factory, 779, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__197)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":787
 *         return self.connection_class.factory(address, self.connect_timeout, *args, **kwargs)
 * 
 *     def _make_connection_factory(self, host, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         kwargs = self._make_connection_kwargs(host.address, kwargs)
 *         return partial(self.connection_class.factory, host.address, self.connect_timeout, *args, **kwargs)
 */
  __pyx_tuple__198 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__198)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__198);
  __Pyx_GIVEREF(__pyx_tuple__198);
  __pyx_codeobj__199 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__198, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_make_connection_factory, 787, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__199)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":791
 *         return partial(self.connection_class.factory, host.address, self.connect_timeout, *args, **kwargs)
 * 
 *     def _make_connection_kwargs(self, address, kwargs_dict):             # <<<<<<<<<<<<<<
 *         if self._auth_provider_callable:
 *             kwargs_dict.setdefault('authenticator', self._auth_provider_callable(address))
 */
  __pyx_tuple__200 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_address, __pyx_n_s_kwargs_dict); if (unlikely(!__pyx_tuple__200)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__200);
  __Pyx_GIVEREF(__pyx_tuple__200);
  __pyx_codeobj__201 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__200, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_make_connection_kwargs, 791, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__201)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":805
 *         return kwargs_dict
 * 
 *     def protocol_downgrade(self, host_addr, previous_version):             # <<<<<<<<<<<<<<
 *         new_version = previous_version - 1
 *         if new_version < self.protocol_version:
 */
  __pyx_tuple__202 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_host_addr, __pyx_n_s_previous_version, __pyx_n_s_new_version); if (unlikely(!__pyx_tuple__202)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__202);
  __Pyx_GIVEREF(__pyx_tuple__202);
  __pyx_codeobj__203 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__202, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_protocol_downgrade, 805, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__203)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":814
 *                 raise Exception("Cannot downgrade protocol version (%d) below minimum supported version: %d" % (new_version, MIN_SUPPORTED_VERSION))
 * 
 *     def connect(self, keyspace=None):             # <<<<<<<<<<<<<<
 *         """
 *         Creates and returns a new :class:`~.Session` object.  If `keyspace`
 */
  __pyx_tuple__204 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_keyspace, __pyx_n_s_address, __pyx_n_s_host, __pyx_n_s_new, __pyx_n_s_listener, __pyx_n_s_session); if (unlikely(!__pyx_tuple__204)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__204);
  __Pyx_GIVEREF(__pyx_tuple__204);
  __pyx_codeobj__205 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__204, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_connect, 814, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__205)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__206 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__206)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__206);
  __Pyx_GIVEREF(__pyx_tuple__206);

  /* "cassandra/cluster.py":859
 *         return session
 * 
 *     def get_connection_holders(self):             # <<<<<<<<<<<<<<
 *         holders = []
 *         for s in self.sessions:
 */
  __pyx_tuple__207 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_holders, __pyx_n_s_s_3); if (unlikely(!__pyx_tuple__207)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__207);
  __Pyx_GIVEREF(__pyx_tuple__207);
  __pyx_codeobj__208 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__207, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_get_connection_holders, 859, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__208)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":866
 *         return holders
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         """
 *         Closes all sessions and connection associated with this Cluster.
 */
  __pyx_tuple__209 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_session); if (unlikely(!__pyx_tuple__209)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__209);
  __Pyx_GIVEREF(__pyx_tuple__209);
  __pyx_codeobj__210 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__209, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_shutdown, 866, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__210)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":892
 *         self.executor.shutdown()
 * 
 *     def _new_session(self):             # <<<<<<<<<<<<<<
 *         session = Session(self, self.metadata.all_hosts())
 *         for keyspace, type_map in six.iteritems(self._user_types):
 */
  __pyx_tuple__211 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_session, __pyx_n_s_keyspace, __pyx_n_s_type_map, __pyx_n_s_udt_name, __pyx_n_s_klass); if (unlikely(!__pyx_tuple__211)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__211);
  __Pyx_GIVEREF(__pyx_tuple__211);
  __pyx_codeobj__212 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__211, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_new_session, 892, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__212)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":900
 *         return session
 * 
 *     def _cleanup_failed_on_up_handling(self, host):             # <<<<<<<<<<<<<<
 *         self.load_balancing_policy.on_down(host)
 *         self.control_connection.on_down(host)
 */
  __pyx_tuple__213 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_session); if (unlikely(!__pyx_tuple__213)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__213);
  __Pyx_GIVEREF(__pyx_tuple__213);
  __pyx_codeobj__214 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__213, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_cleanup_failed_on_up_handling, 900, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__214)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":908
 *         self._start_reconnector(host, is_host_addition=False)
 * 
 *     def _on_up_future_completed(self, host, futures, results, lock, finished_future):             # <<<<<<<<<<<<<<
 *         with lock:
 *             futures.discard(finished_future)
 */
  __pyx_tuple__215 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_futures, __pyx_n_s_results, __pyx_n_s_lock_2, __pyx_n_s_finished_future, __pyx_n_s_exc, __pyx_n_s_listener, __pyx_n_s_session, __pyx_n_s_f); if (unlikely(!__pyx_tuple__215)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__215);
  __Pyx_GIVEREF(__pyx_tuple__215);
  __pyx_codeobj__216 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__215, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_on_up_future_completed, 908, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__216)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":945
 *             session.update_created_pools()
 * 
 *     def on_up(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Intended for internal use only.
 */
  __pyx_tuple__217 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_have_future, __pyx_n_s_futures, __pyx_n_s_reconnector, __pyx_n_s_session, __pyx_n_s_futures_lock, __pyx_n_s_futures_results, __pyx_n_s_callback, __pyx_n_s_future); if (unlikely(!__pyx_tuple__217)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__217);
  __Pyx_GIVEREF(__pyx_tuple__217);
  __pyx_codeobj__218 = (PyObject*)__Pyx_PyCode_New(2, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__217, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_on_up, 945, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__218)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1015
 *         return futures
 * 
 *     def _start_reconnector(self, host, is_host_addition):             # <<<<<<<<<<<<<<
 *         if self.load_balancing_policy.distance(host) == HostDistance.IGNORED:
 *             return
 */
  __pyx_tuple__219 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_is_host_addition, __pyx_n_s_schedule, __pyx_n_s_conn_factory, __pyx_n_s_reconnector, __pyx_n_s_old_reconnector); if (unlikely(!__pyx_tuple__219)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__219);
  __Pyx_GIVEREF(__pyx_tuple__219);
  __pyx_codeobj__220 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__219, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_start_reconnector, 1015, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__220)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1040
 * 
 *     @run_in_executor
 *     def on_down(self, host, is_host_addition, expect_host_to_be_down=False):             # <<<<<<<<<<<<<<
 *         """
 *         Intended for internal use only.
 */
  __pyx_tuple__221 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_is_host_addition, __pyx_n_s_expect_host_to_be_down, __pyx_n_s_session, __pyx_n_s_listener); if (unlikely(!__pyx_tuple__221)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__221);
  __Pyx_GIVEREF(__pyx_tuple__221);
  __pyx_codeobj__222 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__221, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_on_down, 1040, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__222)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__223 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__223)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__223);
  __Pyx_GIVEREF(__pyx_tuple__223);

  /* "cassandra/cluster.py":1065
 *         self._start_reconnector(host, is_host_addition)
 * 
 *     def on_add(self, host, refresh_nodes=True):             # <<<<<<<<<<<<<<
 *         if self.is_shutdown:
 *             return
 */
  __pyx_tuple__224 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_refresh_nodes, __pyx_n_s_distance, __pyx_n_s_futures_lock, __pyx_n_s_futures_results, __pyx_n_s_futures, __pyx_n_s_future_completed_2, __pyx_n_s_future_completed_2, __pyx_n_s_have_future, __pyx_n_s_session, __pyx_n_s_future); if (unlikely(!__pyx_tuple__224)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__224);
  __Pyx_GIVEREF(__pyx_tuple__224);
  __pyx_codeobj__225 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__224, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_on_add, 1065, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__225)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__226 = PyTuple_Pack(1, ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__226)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__226);
  __Pyx_GIVEREF(__pyx_tuple__226);

  /* "cassandra/cluster.py":1124
 *             self._finalize_add(host)
 * 
 *     def _finalize_add(self, host):             # <<<<<<<<<<<<<<
 *         # mark the host as up and notify all listeners
 *         host.set_up()
 */
  __pyx_tuple__227 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_listener, __pyx_n_s_session); if (unlikely(!__pyx_tuple__227)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__227);
  __Pyx_GIVEREF(__pyx_tuple__227);
  __pyx_codeobj__228 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__227, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_finalize_add, 1124, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__228)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1134
 *             session.update_created_pools()
 * 
 *     def on_remove(self, host):             # <<<<<<<<<<<<<<
 *         if self.is_shutdown:
 *             return
 */
  __pyx_tuple__229 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_session, __pyx_n_s_listener); if (unlikely(!__pyx_tuple__229)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__229);
  __Pyx_GIVEREF(__pyx_tuple__229);
  __pyx_codeobj__230 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__229, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_on_remove, 1134, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__230)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1147
 *         self.control_connection.on_remove(host)
 * 
 *     def signal_connection_failure(self, host, connection_exc, is_host_addition, expect_host_to_be_down=False):             # <<<<<<<<<<<<<<
 *         is_down = host.signal_connection_failure(connection_exc)
 *         if is_down:
 */
  __pyx_tuple__231 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_connection_exc, __pyx_n_s_is_host_addition, __pyx_n_s_expect_host_to_be_down, __pyx_n_s_is_down); if (unlikely(!__pyx_tuple__231)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__231);
  __Pyx_GIVEREF(__pyx_tuple__231);
  __pyx_codeobj__232 = (PyObject*)__Pyx_PyCode_New(5, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__231, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_signal_connection_failure, 1147, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__232)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__233 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__233)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__233);
  __Pyx_GIVEREF(__pyx_tuple__233);

  /* "cassandra/cluster.py":1153
 *         return is_down
 * 
 *     def add_host(self, address, datacenter=None, rack=None, signal=True, refresh_nodes=True):             # <<<<<<<<<<<<<<
 *         """
 *         Called when adding initial contact points and when the control
 */
  __pyx_tuple__234 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_address, __pyx_n_s_datacenter, __pyx_n_s_rack, __pyx_n_s_signal, __pyx_n_s_refresh_nodes, __pyx_n_s_host, __pyx_n_s_new); if (unlikely(!__pyx_tuple__234)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__234);
  __Pyx_GIVEREF(__pyx_tuple__234);
  __pyx_codeobj__235 = (PyObject*)__Pyx_PyCode_New(6, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__234, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_add_host, 1153, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__235)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__236 = PyTuple_Pack(4, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_True), ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__236)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__236);
  __Pyx_GIVEREF(__pyx_tuple__236);

  /* "cassandra/cluster.py":1168
 *         return host, new
 * 
 *     def remove_host(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Called when the control connection observes that a node has left the
 */
  __pyx_tuple__237 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_host); if (unlikely(!__pyx_tuple__237)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__237);
  __Pyx_GIVEREF(__pyx_tuple__237);
  __pyx_codeobj__238 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__237, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_remove_host, 1168, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__238)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1177
 *             self.on_remove(host)
 * 
 *     def register_listener(self, listener):             # <<<<<<<<<<<<<<
 *         """
 *         Adds a :class:`cassandra.policies.HostStateListener` subclass instance to
 */
  __pyx_tuple__239 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_listener); if (unlikely(!__pyx_tuple__239)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__239);
  __Pyx_GIVEREF(__pyx_tuple__239);
  __pyx_codeobj__240 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__239, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_register_listener, 1177, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__240)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1186
 *             self._listeners.add(listener)
 * 
 *     def unregister_listener(self, listener):             # <<<<<<<<<<<<<<
 *         """ Removes a registered listener. """
 *         with self._listener_lock:
 */
  __pyx_tuple__241 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_listener); if (unlikely(!__pyx_tuple__241)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__241);
  __Pyx_GIVEREF(__pyx_tuple__241);
  __pyx_codeobj__242 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__241, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_unregister_listener, 1186, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__242)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1192
 * 
 *     @property
 *     def listeners(self):             # <<<<<<<<<<<<<<
 *         with self._listener_lock:
 *             return self._listeners.copy()
 */
  __pyx_tuple__243 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__243)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__243);
  __Pyx_GIVEREF(__pyx_tuple__243);
  __pyx_codeobj__244 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__243, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_listeners_2, 1192, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__244)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1196
 *             return self._listeners.copy()
 * 
 *     def _ensure_core_connections(self):             # <<<<<<<<<<<<<<
 *         """
 *         If any host has fewer than the configured number of core connections
 */
  __pyx_tuple__245 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_session, __pyx_n_s_pool); if (unlikely(!__pyx_tuple__245)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__245);
  __Pyx_GIVEREF(__pyx_tuple__245);
  __pyx_codeobj__246 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__245, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_ensure_core_connections, 1196, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__246)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1205
 *                 pool.ensure_core_connections()
 * 
 *     def _validate_refresh_schema(self, keyspace, table, usertype, function, aggregate):             # <<<<<<<<<<<<<<
 *         if any((table, usertype, function, aggregate)):
 *             if not keyspace:
 */
  __pyx_tuple__247 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_keyspace, __pyx_n_s_table, __pyx_n_s_usertype, __pyx_n_s_function, __pyx_n_s_aggregate, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__247)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__247);
  __Pyx_GIVEREF(__pyx_tuple__247);
  __pyx_codeobj__248 = (PyObject*)__Pyx_PyCode_New(6, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__247, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_validate_refresh_schema, 1205, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__248)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1212
 *                 raise ValueError("{table, usertype, function, aggregate} are mutually exclusive")
 * 
 *     def refresh_schema(self, keyspace=None, table=None, usertype=None, function=None, aggregate=None, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         .. deprecated:: 2.6.0
 */
  __pyx_tuple__249 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_keyspace, __pyx_n_s_table, __pyx_n_s_usertype, __pyx_n_s_function, __pyx_n_s_aggregate, __pyx_n_s_max_schema_agreement_wait, __pyx_n_s_msg); if (unlikely(!__pyx_tuple__249)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__249);
  __Pyx_GIVEREF(__pyx_tuple__249);
  __pyx_codeobj__250 = (PyObject*)__Pyx_PyCode_New(7, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__249, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_refresh_schema, 1212, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__250)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__251 = PyTuple_Pack(6, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__251)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__251);
  __Pyx_GIVEREF(__pyx_tuple__251);

  /* "cassandra/cluster.py":1250
 *             raise Exception("Schema was not refreshed. See log for details.")
 * 
 *     def submit_schema_refresh(self, keyspace=None, table=None, usertype=None, function=None, aggregate=None):             # <<<<<<<<<<<<<<
 *         """
 *         .. deprecated:: 2.6.0
 */
  __pyx_tuple__252 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_keyspace, __pyx_n_s_table, __pyx_n_s_usertype, __pyx_n_s_function, __pyx_n_s_aggregate, __pyx_n_s_msg); if (unlikely(!__pyx_tuple__252)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__252);
  __Pyx_GIVEREF(__pyx_tuple__252);
  __pyx_codeobj__253 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__252, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_submit_schema_refresh, 1250, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__253)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__254 = PyTuple_Pack(5, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__254)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__254);
  __Pyx_GIVEREF(__pyx_tuple__254);

  /* "cassandra/cluster.py":1266
 *             self.control_connection.refresh_schema, keyspace, table, usertype, function, aggregate)
 * 
 *     def refresh_schema_metadata(self, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh all schema metadata.
 */
  __pyx_tuple__255 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_max_schema_agreement_wait); if (unlikely(!__pyx_tuple__255)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__255);
  __Pyx_GIVEREF(__pyx_tuple__255);
  __pyx_codeobj__256 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__255, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_refresh_schema_metadata, 1266, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__256)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__257 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__257)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__257);
  __Pyx_GIVEREF(__pyx_tuple__257);

  /* "cassandra/cluster.py":1282
 *             raise Exception("Schema metadata was not refreshed. See log for details.")
 * 
 *     def refresh_keyspace_metadata(self, keyspace, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh keyspace metadata. This applies to keyspace-level information such as replication
 */
  __pyx_tuple__258 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_keyspace, __pyx_n_s_max_schema_agreement_wait); if (unlikely(!__pyx_tuple__258)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__258);
  __Pyx_GIVEREF(__pyx_tuple__258);
  __pyx_codeobj__259 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__258, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_refresh_keyspace_metadata, 1282, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__259)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__260 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__260)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__260);
  __Pyx_GIVEREF(__pyx_tuple__260);

  /* "cassandra/cluster.py":1292
 *             raise Exception("Keyspace metadata was not refreshed. See log for details.")
 * 
 *     def refresh_table_metadata(self, keyspace, table, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh table metadata. This applies to a table, and any triggers or indexes attached
 */
  __pyx_tuple__261 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_keyspace, __pyx_n_s_table, __pyx_n_s_max_schema_agreement_wait); if (unlikely(!__pyx_tuple__261)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__261);
  __Pyx_GIVEREF(__pyx_tuple__261);
  __pyx_codeobj__262 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__261, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_refresh_table_metadata, 1292, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__262)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__263 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__263)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__263);
  __Pyx_GIVEREF(__pyx_tuple__263);

  /* "cassandra/cluster.py":1302
 *             raise Exception("Table metadata was not refreshed. See log for details.")
 * 
 *     def refresh_user_type_metadata(self, keyspace, user_type, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh user defined type metadata.
 */
  __pyx_tuple__264 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_keyspace, __pyx_n_s_user_type, __pyx_n_s_max_schema_agreement_wait); if (unlikely(!__pyx_tuple__264)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__264);
  __Pyx_GIVEREF(__pyx_tuple__264);
  __pyx_codeobj__265 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__264, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_refresh_user_type_metadata, 1302, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__265)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__266 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__266)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__266);
  __Pyx_GIVEREF(__pyx_tuple__266);

  /* "cassandra/cluster.py":1311
 *             raise Exception("User Type metadata was not refreshed. See log for details.")
 * 
 *     def refresh_user_function_metadata(self, keyspace, function, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh user defined function metadata.
 */
  __pyx_tuple__267 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_keyspace, __pyx_n_s_function, __pyx_n_s_max_schema_agreement_wait); if (unlikely(!__pyx_tuple__267)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__267);
  __Pyx_GIVEREF(__pyx_tuple__267);
  __pyx_codeobj__268 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__267, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_refresh_user_function_metadata, 1311, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__268)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__269 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__269)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__269);
  __Pyx_GIVEREF(__pyx_tuple__269);

  /* "cassandra/cluster.py":1322
 *             raise Exception("User Function metadata was not refreshed. See log for details.")
 * 
 *     def refresh_user_aggregate_metadata(self, keyspace, aggregate, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh user defined aggregate metadata.
 */
  __pyx_tuple__270 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_keyspace, __pyx_n_s_aggregate, __pyx_n_s_max_schema_agreement_wait); if (unlikely(!__pyx_tuple__270)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__270);
  __Pyx_GIVEREF(__pyx_tuple__270);
  __pyx_codeobj__271 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__270, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_refresh_user_aggregate_metadata, 1322, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__271)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__272 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__272)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__272);
  __Pyx_GIVEREF(__pyx_tuple__272);

  /* "cassandra/cluster.py":1333
 *             raise Exception("User Aggregate metadata was not refreshed. See log for details.")
 * 
 *     def refresh_nodes(self):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh the node list and token metadata
 */
  __pyx_tuple__273 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__273)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__273);
  __Pyx_GIVEREF(__pyx_tuple__273);
  __pyx_codeobj__274 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__273, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_refresh_nodes, 1333, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__274)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1342
 *             raise Exception("Node list was not refreshed. See log for details.")
 * 
 *     def set_meta_refresh_enabled(self, enabled):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a flag to enable (True) or disable (False) all metadata refresh queries.
 */
  __pyx_tuple__275 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_enabled); if (unlikely(!__pyx_tuple__275)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__275);
  __Pyx_GIVEREF(__pyx_tuple__275);
  __pyx_codeobj__276 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__275, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_set_meta_refresh_enabled, 1342, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__276)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1354
 *         self.control_connection.set_meta_refresh_enabled(bool(enabled))
 * 
 *     def _prepare_all_queries(self, host):             # <<<<<<<<<<<<<<
 *         if not self._prepared_statements:
 *             return
 */
  __pyx_tuple__277 = PyTuple_Pack(15, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_connection, __pyx_n_s_statements, __pyx_n_s_keyspace, __pyx_n_s_ks_statements, __pyx_n_s_chunks, __pyx_n_s_i, __pyx_n_s_ks_chunk, __pyx_n_s_messages, __pyx_n_s_responses, __pyx_n_s_response, __pyx_n_s_timeout, __pyx_n_s_exc, __pyx_n_s_s_3); if (unlikely(!__pyx_tuple__277)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__277);
  __Pyx_GIVEREF(__pyx_tuple__277);
  __pyx_codeobj__278 = (PyObject*)__Pyx_PyCode_New(2, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__277, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_prepare_all_queries, 1354, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__278)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1399
 *                 connection.close()
 * 
 *     def prepare_on_all_sessions(self, query_id, prepared_statement, excluded_host):             # <<<<<<<<<<<<<<
 *         with self._prepared_statement_lock:
 *             self._prepared_statements[query_id] = prepared_statement
 */
  __pyx_tuple__279 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_query_id, __pyx_n_s_prepared_statement, __pyx_n_s_excluded_host, __pyx_n_s_session); if (unlikely(!__pyx_tuple__279)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__279);
  __Pyx_GIVEREF(__pyx_tuple__279);
  __pyx_codeobj__280 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__279, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_prepare_on_all_sessions, 1399, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__280)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1543
 *     _metrics = None
 * 
 *     def __init__(self, cluster, hosts):             # <<<<<<<<<<<<<<
 *         self.cluster = cluster
 *         self.hosts = hosts
 */
  __pyx_tuple__281 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_cluster, __pyx_n_s_hosts, __pyx_n_s_futures, __pyx_n_s_host, __pyx_n_s_future); if (unlikely(!__pyx_tuple__281)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__281);
  __Pyx_GIVEREF(__pyx_tuple__281);
  __pyx_codeobj__282 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__281, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_init, 1543, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__282)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1565
 *             future.result()
 * 
 *     def execute(self, query, parameters=None, timeout=_NOT_SET, trace=False, custom_payload=None):             # <<<<<<<<<<<<<<
 *         """
 *         Execute the given query and synchronously wait for the response.
 */
  __pyx_tuple__283 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_query, __pyx_n_s_parameters, __pyx_n_s_timeout, __pyx_n_s_trace, __pyx_n_s_custom_payload, __pyx_n_s_future, __pyx_n_s_result); if (unlikely(!__pyx_tuple__283)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__283);
  __Pyx_GIVEREF(__pyx_tuple__283);
  __pyx_codeobj__284 = (PyObject*)__Pyx_PyCode_New(6, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_execute, 1565, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__284)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1615
 *         return result
 * 
 *     def execute_async(self, query, parameters=None, trace=False, custom_payload=None, timeout=_NOT_SET):             # <<<<<<<<<<<<<<
 *         """
 *         Execute the given query and return a :class:`~.ResponseFuture` object
 */
  __pyx_tuple__285 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_query, __pyx_n_s_parameters, __pyx_n_s_trace, __pyx_n_s_custom_payload, __pyx_n_s_timeout, __pyx_n_s_future); if (unlikely(!__pyx_tuple__285)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__285);
  __Pyx_GIVEREF(__pyx_tuple__285);
  __pyx_codeobj__286 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__285, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_execute_async, 1615, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__286)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1668
 *         return future
 * 
 *     def _create_response_future(self, query, parameters, trace, custom_payload, timeout):             # <<<<<<<<<<<<<<
 *         """ Returns the ResponseFuture before calling send_request() on it """
 * 
 */
  __pyx_tuple__287 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_query, __pyx_n_s_parameters, __pyx_n_s_trace, __pyx_n_s_custom_payload, __pyx_n_s_timeout, __pyx_n_s_prepared_statement, __pyx_n_s_cl, __pyx_n_s_fetch_size, __pyx_n_s_timestamp, __pyx_n_s_query_string, __pyx_n_s_message); if (unlikely(!__pyx_tuple__287)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__287);
  __Pyx_GIVEREF(__pyx_tuple__287);
  __pyx_codeobj__288 = (PyObject*)__Pyx_PyCode_New(6, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__287, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_create_response_future, 1668, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__288)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1725
 *             prepared_statement=prepared_statement)
 * 
 *     def prepare(self, query, custom_payload=None):             # <<<<<<<<<<<<<<
 *         """
 *         Prepares a query string, returning a :class:`~cassandra.query.PreparedStatement`
 */
  __pyx_tuple__289 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_query, __pyx_n_s_custom_payload, __pyx_n_s_message, __pyx_n_s_future, __pyx_n_s_query_id, __pyx_n_s_column_metadata, __pyx_n_s_pk_indexes, __pyx_n_s_prepared_statement, __pyx_n_s_host); if (unlikely(!__pyx_tuple__289)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__289);
  __Pyx_GIVEREF(__pyx_tuple__289);
  __pyx_codeobj__290 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_prepare_2, 1725, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__290)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__291 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__291)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__291);
  __Pyx_GIVEREF(__pyx_tuple__291);

  /* "cassandra/cluster.py":1776
 *         return prepared_statement
 * 
 *     def prepare_on_all_hosts(self, query, excluded_host):             # <<<<<<<<<<<<<<
 *         """
 *         Prepare the given query on all hosts, excluding ``excluded_host``.
 */
  __pyx_tuple__292 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_query, __pyx_n_s_excluded_host, __pyx_n_s_futures, __pyx_n_s_host, __pyx_n_s_future, __pyx_n_s_request_id); if (unlikely(!__pyx_tuple__292)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__292);
  __Pyx_GIVEREF(__pyx_tuple__292);
  __pyx_codeobj__293 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__292, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_prepare_on_all_hosts, 1776, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__293)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1809
 *                 log.exception("Error preparing query for host %s:", host)
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         """
 *         Close all connections.  ``Session`` instances should not be used
 */
  __pyx_tuple__294 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pool); if (unlikely(!__pyx_tuple__294)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__294);
  __Pyx_GIVEREF(__pyx_tuple__294);
  __pyx_codeobj__295 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_shutdown, 1809, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__295)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1823
 *             pool.shutdown()
 * 
 *     def add_or_renew_pool(self, host, is_host_addition):             # <<<<<<<<<<<<<<
 *         """
 *         For internal use only.
 */
  __pyx_tuple__296 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_is_host_addition, __pyx_n_s_distance, __pyx_n_s_run_add_or_renew_pool, __pyx_n_s_run_add_or_renew_pool); if (unlikely(!__pyx_tuple__296)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__296);
  __Pyx_GIVEREF(__pyx_tuple__296);
  __pyx_codeobj__297 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__296, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_add_or_renew_pool, 1823, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__297)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1860
 *         return self.submit(run_add_or_renew_pool)
 * 
 *     def remove_pool(self, host):             # <<<<<<<<<<<<<<
 *         pool = self._pools.pop(host, None)
 *         if pool:
 */
  __pyx_tuple__298 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_pool); if (unlikely(!__pyx_tuple__298)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__298);
  __Pyx_GIVEREF(__pyx_tuple__298);
  __pyx_codeobj__299 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__298, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_remove_pool, 1860, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__299)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1868
 *             return None
 * 
 *     def update_created_pools(self):             # <<<<<<<<<<<<<<
 *         """
 *         When the set of live nodes change, the loadbalancer will change its
 */
  __pyx_tuple__300 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_distance, __pyx_n_s_pool); if (unlikely(!__pyx_tuple__300)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__300);
  __Pyx_GIVEREF(__pyx_tuple__300);
  __pyx_codeobj__301 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__300, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_update_created_pools, 1868, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__301)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1894
 *                     pool.host_distance = distance
 * 
 *     def on_down(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the parent Cluster instance when a node is marked down.
 */
  __pyx_tuple__302 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_future); if (unlikely(!__pyx_tuple__302)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__302);
  __Pyx_GIVEREF(__pyx_tuple__302);
  __pyx_codeobj__303 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__302, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_on_down, 1894, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__303)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1903
 *             future.add_done_callback(lambda f: self.update_created_pools())
 * 
 *     def on_remove(self, host):             # <<<<<<<<<<<<<<
 *         """ Internal """
 *         self.on_down(host)
 */
  __pyx_tuple__304 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_host); if (unlikely(!__pyx_tuple__304)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__304);
  __Pyx_GIVEREF(__pyx_tuple__304);
  __pyx_codeobj__305 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__304, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_on_remove, 1903, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__305)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1907
 *         self.on_down(host)
 * 
 *     def set_keyspace(self, keyspace):             # <<<<<<<<<<<<<<
 *         """
 *         Set the default keyspace for all queries made through this Session.
 */
  __pyx_tuple__306 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_keyspace); if (unlikely(!__pyx_tuple__306)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__306);
  __Pyx_GIVEREF(__pyx_tuple__306);
  __pyx_codeobj__307 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__306, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_set_keyspace, 1907, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__307)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1914
 *         self.execute('USE %s' % (protect_name(keyspace),))
 * 
 *     def _set_keyspace_for_all_pools(self, keyspace, callback):             # <<<<<<<<<<<<<<
 *         """
 *         Asynchronously sets the keyspace on all pools.  When all
 */
  __pyx_tuple__308 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_keyspace, __pyx_n_s_callback, __pyx_n_s_remaining_callbacks, __pyx_n_s_errors, __pyx_n_s_pool_finished_setting_keyspace, __pyx_n_s_pool_finished_setting_keyspace, __pyx_n_s_pool); if (unlikely(!__pyx_tuple__308)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__308);
  __Pyx_GIVEREF(__pyx_tuple__308);
  __pyx_codeobj__309 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__308, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_set_keyspace_for_all_pools, 1914, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__309)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1941
 *             pool._set_keyspace_for_all_conns(keyspace, pool_finished_setting_keyspace)
 * 
 *     def user_type_registered(self, keyspace, user_type, klass):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the parent Cluster instance when the user registers a new
 */
  __pyx_tuple__310 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_keyspace, __pyx_n_s_user_type, __pyx_n_s_klass, __pyx_n_s_ks_meta, __pyx_n_s_type_meta, __pyx_n_s_encode, __pyx_n_s_encode); if (unlikely(!__pyx_tuple__310)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__310);
  __Pyx_GIVEREF(__pyx_tuple__310);
  __pyx_codeobj__311 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__310, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_user_type_registered, 1941, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__311)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1967
 *         self.encoder.mapping[klass] = encode
 * 
 *     def submit(self, fn, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """ Internal """
 *         if not self.is_shutdown:
 */
  __pyx_tuple__312 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_fn, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__312)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__312);
  __Pyx_GIVEREF(__pyx_tuple__312);
  __pyx_codeobj__313 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__312, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_submit, 1967, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__313)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1972
 *             return self.cluster.executor.submit(fn, *args, **kwargs)
 * 
 *     def get_pool_state(self):             # <<<<<<<<<<<<<<
 *         return dict((host, pool.get_state()) for host, pool in self._pools.items())
 * 
 */
  __pyx_tuple__314 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__314)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__314);
  __Pyx_GIVEREF(__pyx_tuple__314);
  __pyx_codeobj__315 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__314, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_get_pool_state, 1972, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__315)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1975
 *         return dict((host, pool.get_state()) for host, pool in self._pools.items())
 * 
 *     def get_pools(self):             # <<<<<<<<<<<<<<
 *         return self._pools.values()
 * 
 */
  __pyx_tuple__316 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__316)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__316);
  __Pyx_GIVEREF(__pyx_tuple__316);
  __pyx_codeobj__317 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__316, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_get_pools, 1975, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__317)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1993
 *     """
 * 
 *     def __init__(self, control_connection, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         _ReconnectionHandler.__init__(self, *args, **kwargs)
 *         self.control_connection = weakref.proxy(control_connection)
 */
  __pyx_tuple__318 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_control_connection, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__318)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__318);
  __Pyx_GIVEREF(__pyx_tuple__318);
  __pyx_codeobj__319 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__318, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_init, 1993, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__319)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1997
 *         self.control_connection = weakref.proxy(control_connection)
 * 
 *     def try_reconnect(self):             # <<<<<<<<<<<<<<
 *         # we'll either get back a new Connection or a NoHostAvailable
 *         return self.control_connection._reconnect_internal()
 */
  __pyx_tuple__320 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__320)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__320);
  __Pyx_GIVEREF(__pyx_tuple__320);
  __pyx_codeobj__321 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__320, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_try_reconnect, 1997, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__321)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2001
 *         return self.control_connection._reconnect_internal()
 * 
 *     def on_reconnection(self, connection):             # <<<<<<<<<<<<<<
 *         self.control_connection._set_new_connection(connection)
 * 
 */
  __pyx_tuple__322 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_connection); if (unlikely(!__pyx_tuple__322)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__322);
  __Pyx_GIVEREF(__pyx_tuple__322);
  __pyx_codeobj__323 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__322, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_on_reconnection, 2001, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__323)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2004
 *         self.control_connection._set_new_connection(connection)
 * 
 *     def on_exception(self, exc, next_delay):             # <<<<<<<<<<<<<<
 *         # TODO only overridden to add logging, so add logging
 *         if isinstance(exc, AuthenticationFailed):
 */
  __pyx_tuple__324 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_exc, __pyx_n_s_next_delay); if (unlikely(!__pyx_tuple__324)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__324);
  __Pyx_GIVEREF(__pyx_tuple__324);
  __pyx_codeobj__325 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__324, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_on_exception, 2004, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__325)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2013
 * 
 * 
 * def _watch_callback(obj_weakref, method_name, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     """
 *     A callback handler for the ControlConnection that tolerates
 */
  __pyx_tuple__326 = PyTuple_Pack(5, __pyx_n_s_obj_weakref, __pyx_n_s_method_name, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__326)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__326);
  __Pyx_GIVEREF(__pyx_tuple__326);
  __pyx_codeobj__327 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__326, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_watch_callback, 2013, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__327)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2024
 * 
 * 
 * def _clear_watcher(conn, expiring_weakref):             # <<<<<<<<<<<<<<
 *     """
 *     Called when the ControlConnection object is about to be finalized.
 */
  __pyx_tuple__328 = PyTuple_Pack(2, __pyx_n_s_conn, __pyx_n_s_expiring_weakref); if (unlikely(!__pyx_tuple__328)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__328);
  __Pyx_GIVEREF(__pyx_tuple__328);
  __pyx_codeobj__329 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__328, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_clear_watcher, 2024, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__329)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2066
 *     _time = time
 * 
 *     def __init__(self, cluster, timeout,             # <<<<<<<<<<<<<<
 *                  schema_event_refresh_window,
 *                  topology_event_refresh_window):
 */
  __pyx_tuple__330 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_cluster, __pyx_n_s_timeout, __pyx_n_s_schema_event_refresh_window, __pyx_n_s_topology_event_refresh_window); if (unlikely(!__pyx_tuple__330)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__330);
  __Pyx_GIVEREF(__pyx_tuple__330);
  __pyx_codeobj__331 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__330, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_init, 2066, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__331)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2086
 *         self._event_schedule_times = {}
 * 
 *     def connect(self):             # <<<<<<<<<<<<<<
 *         if self._is_shutdown:
 *             return
 */
  __pyx_tuple__332 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__332)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__332);
  __Pyx_GIVEREF(__pyx_tuple__332);
  __pyx_codeobj__333 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__332, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_connect, 2086, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__333)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2093
 *         self._set_new_connection(self._reconnect_internal())
 * 
 *     def _set_new_connection(self, conn):             # <<<<<<<<<<<<<<
 *         """
 *         Replace existing connection (if there is one) and close it.
 */
  __pyx_tuple__334 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_conn, __pyx_n_s_old); if (unlikely(!__pyx_tuple__334)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__334);
  __Pyx_GIVEREF(__pyx_tuple__334);
  __pyx_codeobj__335 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__334, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_set_new_connection, 2093, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__335)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2105
 *             old.close()
 * 
 *     def _reconnect_internal(self):             # <<<<<<<<<<<<<<
 *         """
 *         Tries to connect to each host in the query plan until one succeeds
 */
  __pyx_tuple__336 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_errors, __pyx_n_s_host, __pyx_n_s_exc); if (unlikely(!__pyx_tuple__336)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__336);
  __Pyx_GIVEREF(__pyx_tuple__336);
  __pyx_codeobj__337 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__336, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_reconnect_internal, 2105, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__337)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2128
 *         raise NoHostAvailable("Unable to connect to any servers", errors)
 * 
 *     def _try_connect(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Creates a new Connection, registers for pushed events, and refreshes
 */
  __pyx_tuple__338 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_connection, __pyx_n_s_e, __pyx_n_s_self_weakref, __pyx_n_s_peers_query, __pyx_n_s_local_query, __pyx_n_s_shared_results); if (unlikely(!__pyx_tuple__338)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__338);
  __Pyx_GIVEREF(__pyx_tuple__338);
  __pyx_codeobj__339 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__338, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_try_connect, 2128, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__339)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2171
 *         return connection
 * 
 *     def reconnect(self):             # <<<<<<<<<<<<<<
 *         if self._is_shutdown:
 *             return
 */
  __pyx_tuple__340 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__340)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__340);
  __Pyx_GIVEREF(__pyx_tuple__340);
  __pyx_codeobj__341 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__340, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_reconnect_2, 2171, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__341)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2177
 *         self._submit(self._reconnect)
 * 
 *     def _reconnect(self):             # <<<<<<<<<<<<<<
 *         log.debug("[control connection] Attempting to reconnect")
 *         try:
 */
  __pyx_tuple__342 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_schedule); if (unlikely(!__pyx_tuple__342)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__342);
  __Pyx_GIVEREF(__pyx_tuple__342);
  __pyx_codeobj__343 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__342, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_reconnect, 2177, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__343)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2203
 *             raise
 * 
 *     def _get_and_set_reconnection_handler(self, new_handler):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the _ControlReconnectionHandler when a new connection
 */
  __pyx_tuple__344 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_new_handler, __pyx_n_s_old); if (unlikely(!__pyx_tuple__344)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__344);
  __Pyx_GIVEREF(__pyx_tuple__344);
  __pyx_codeobj__345 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__344, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_get_and_set_reconnection_handle, 2203, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__345)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2214
 *             return old
 * 
 *     def _submit(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         try:
 *             if not self._cluster.is_shutdown:
 */
  __pyx_tuple__346 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__346)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__346);
  __Pyx_GIVEREF(__pyx_tuple__346);
  __pyx_codeobj__347 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__346, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_submit_2, 2214, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__347)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2222
 *         return None
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         # stop trying to reconnect (if we are)
 *         with self._reconnection_lock:
 */
  __pyx_tuple__348 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__348)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__348);
  __Pyx_GIVEREF(__pyx_tuple__348);
  __pyx_codeobj__349 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__348, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_shutdown, 2222, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__349)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2239
 *                 del self._connection
 * 
 *     def refresh_schema(self, keyspace=None, table=None, usertype=None, function=None,             # <<<<<<<<<<<<<<
 *                        aggregate=None, schema_agreement_wait=None):
 *         if not self._meta_refresh_enabled:
 */
  __pyx_tuple__350 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_keyspace, __pyx_n_s_table, __pyx_n_s_usertype, __pyx_n_s_function, __pyx_n_s_aggregate, __pyx_n_s_schema_agreement_wait); if (unlikely(!__pyx_tuple__350)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__350);
  __Pyx_GIVEREF(__pyx_tuple__350);
  __pyx_codeobj__351 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__350, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_refresh_schema, 2239, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__351)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__352 = PyTuple_Pack(6, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__352)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__352);
  __Pyx_GIVEREF(__pyx_tuple__352);

  /* "cassandra/cluster.py":2256
 *         return False
 * 
 *     def _refresh_schema(self, connection, keyspace=None, table=None, usertype=None, function=None,             # <<<<<<<<<<<<<<
 *                         aggregate=None, preloaded_results=None, schema_agreement_wait=None):
 *         if self._cluster.is_shutdown:
 */
  __pyx_tuple__353 = PyTuple_Pack(42, __pyx_n_s_self, __pyx_n_s_connection, __pyx_n_s_keyspace, __pyx_n_s_table, __pyx_n_s_usertype, __pyx_n_s_function, __pyx_n_s_aggregate, __pyx_n_s_preloaded_results, __pyx_n_s_schema_agreement_wait, __pyx_n_s_agreed, __pyx_n_s_cl, __pyx_n_s_handle_results, __pyx_n_s_handle_results, __pyx_n_s_where_clause, __pyx_n_s_cf_query, __pyx_n_s_col_query, __pyx_n_s_triggers_query, __pyx_n_s_cf_success, __pyx_n_s_cf_result, __pyx_n_s_col_success, __pyx_n_s_col_result, __pyx_n_s_triggers_success, __pyx_n_s_triggers_result, __pyx_n_s_types_query, __pyx_n_s_types_result, __pyx_n_s_functions_query, __pyx_n_s_functions_result, __pyx_n_s_aggregates_query, __pyx_n_s_aggregates_result, __pyx_n_s_ks_query, __pyx_n_s_ks_result, __pyx_n_s_queries, __pyx_n_s_responses, __pyx_n_s_ks_success, __pyx_n_s_types_success, __pyx_n_s_functions_success, __pyx_n_s_aggregates_success, __pyx_n_s_trigger_success, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__353)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__353);
  __Pyx_GIVEREF(__pyx_tuple__353);
  __pyx_codeobj__354 = (PyObject*)__Pyx_PyCode_New(9, 0, 42, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__353, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_refresh_schema_2, 2256, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__354)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__355 = PyTuple_Pack(7, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__355)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__355);
  __Pyx_GIVEREF(__pyx_tuple__355);

  /* "cassandra/cluster.py":2414
 *         return True
 * 
 *     def refresh_node_list_and_token_map(self, force_token_rebuild=False):             # <<<<<<<<<<<<<<
 *         if not self._meta_refresh_enabled:
 *             log.debug("[control connection] Skipping node list refresh because meta refresh is disabled")
 */
  __pyx_tuple__356 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_force_token_rebuild); if (unlikely(!__pyx_tuple__356)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__356);
  __Pyx_GIVEREF(__pyx_tuple__356);
  __pyx_codeobj__357 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__356, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_refresh_node_list_and_token_map, 2414, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__357)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__358 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__358)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__358);
  __Pyx_GIVEREF(__pyx_tuple__358);

  /* "cassandra/cluster.py":2430
 *         return False
 * 
 *     def _refresh_node_list_and_token_map(self, connection, preloaded_results=None,             # <<<<<<<<<<<<<<
 *                                          force_token_rebuild=False):
 * 
 */
  __pyx_tuple__360 = PyTuple_Pack(24, __pyx_n_s_self, __pyx_n_s_connection, __pyx_n_s_preloaded_results, __pyx_n_s_force_token_rebuild, __pyx_n_s_peers_result, __pyx_n_s_local_result, __pyx_n_s_cl, __pyx_n_s_peers_query, __pyx_n_s_local_query, __pyx_n_s_partitioner, __pyx_n_s_token_map, __pyx_n_s_local_rows, __pyx_n_s_local_row, __pyx_n_s_cluster_name, __pyx_n_s_host, __pyx_n_s_datacenter, __pyx_n_s_rack, __pyx_n_s_tokens, __pyx_n_s_should_rebuild_token_map, __pyx_n_s_found_hosts, __pyx_n_s_row, __pyx_n_s_addr, __pyx_n_s__359, __pyx_n_s_old_host); if (unlikely(!__pyx_tuple__360)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__360);
  __Pyx_GIVEREF(__pyx_tuple__360);
  __pyx_codeobj__361 = (PyObject*)__Pyx_PyCode_New(4, 0, 24, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__360, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_refresh_node_list_and_token_map_2, 2430, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__361)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__362 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__362)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__362);
  __Pyx_GIVEREF(__pyx_tuple__362);

  /* "cassandra/cluster.py":2510
 *             self._cluster.metadata.rebuild_token_map(partitioner, token_map)
 * 
 *     def _update_location_info(self, host, datacenter, rack):             # <<<<<<<<<<<<<<
 *         if host.datacenter == datacenter and host.rack == rack:
 *             return False
 */
  __pyx_tuple__363 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_datacenter, __pyx_n_s_rack); if (unlikely(!__pyx_tuple__363)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__363);
  __Pyx_GIVEREF(__pyx_tuple__363);
  __pyx_codeobj__364 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__363, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_update_location_info, 2510, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__364)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2522
 *         return True
 * 
 *     def _delay_for_event_type(self, event_type, delay_window):             # <<<<<<<<<<<<<<
 *         # this serves to order processing correlated events (received within the window)
 *         # the window and randomization still have the desired effect of skew across client instances
 */
  __pyx_tuple__365 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_event_type, __pyx_n_s_delay_window, __pyx_n_s_next_time, __pyx_n_s_now, __pyx_n_s_this_time, __pyx_n_s_delay); if (unlikely(!__pyx_tuple__365)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__365);
  __Pyx_GIVEREF(__pyx_tuple__365);
  __pyx_codeobj__366 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__365, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_delay_for_event_type, 2522, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__366)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2536
 *         return delay
 * 
 *     def _handle_topology_change(self, event):             # <<<<<<<<<<<<<<
 *         change_type = event["change_type"]
 *         addr, port = event["address"]
 */
  __pyx_tuple__367 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_event, __pyx_n_s_change_type, __pyx_n_s_addr, __pyx_n_s_port, __pyx_n_s_delay, __pyx_n_s_host); if (unlikely(!__pyx_tuple__367)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__367);
  __Pyx_GIVEREF(__pyx_tuple__367);
  __pyx_codeobj__368 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__367, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_handle_topology_change, 2536, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__368)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2547
 *             self._cluster.scheduler.schedule_unique(0, self._cluster.remove_host, host)
 * 
 *     def _handle_status_change(self, event):             # <<<<<<<<<<<<<<
 *         change_type = event["change_type"]
 *         addr, port = event["address"]
 */
  __pyx_tuple__369 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_event, __pyx_n_s_change_type, __pyx_n_s_addr, __pyx_n_s_port, __pyx_n_s_host, __pyx_n_s_delay); if (unlikely(!__pyx_tuple__369)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__369);
  __Pyx_GIVEREF(__pyx_tuple__369);
  __pyx_codeobj__370 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__369, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_handle_status_change, 2547, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__370)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2567
 *                 self._cluster.on_down(host, is_host_addition=False)
 * 
 *     def _handle_schema_change(self, event):             # <<<<<<<<<<<<<<
 *         if self._schema_event_refresh_window < 0:
 *             return
 */
  __pyx_tuple__371 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_event, __pyx_n_s_keyspace, __pyx_n_s_table, __pyx_n_s_usertype, __pyx_n_s_function, __pyx_n_s_aggregate, __pyx_n_s_delay); if (unlikely(!__pyx_tuple__371)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__371);
  __Pyx_GIVEREF(__pyx_tuple__371);
  __pyx_codeobj__372 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__371, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_handle_schema_change, 2567, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__372)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2578
 *         self._cluster.scheduler.schedule_unique(delay, self.refresh_schema, keyspace, table, usertype, function, aggregate)
 * 
 *     def wait_for_schema_agreement(self, connection=None, preloaded_results=None, wait_time=None):             # <<<<<<<<<<<<<<
 * 
 *         total_timeout = wait_time if wait_time is not None else self._cluster.max_schema_agreement_wait
 */
  __pyx_tuple__373 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_connection, __pyx_n_s_preloaded_results, __pyx_n_s_wait_time, __pyx_n_s_total_timeout, __pyx_n_s_peers_result, __pyx_n_s_local_result, __pyx_n_s_schema_mismatches, __pyx_n_s_start, __pyx_n_s_elapsed, __pyx_n_s_cl, __pyx_n_s_peers_query, __pyx_n_s_local_query, __pyx_n_s_timeout); if (unlikely(!__pyx_tuple__373)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__373);
  __Pyx_GIVEREF(__pyx_tuple__373);
  __pyx_codeobj__374 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__373, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_wait_for_schema_agreement, 2578, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__374)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__375 = PyTuple_Pack(3, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__375)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__375);
  __Pyx_GIVEREF(__pyx_tuple__375);

  /* "cassandra/cluster.py":2640
 *             return False
 * 
 *     def _get_schema_mismatches(self, peers_result, local_result, local_address):             # <<<<<<<<<<<<<<
 *         peers_result = dict_factory(*peers_result.results)
 * 
 */
  __pyx_tuple__376 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_peers_result, __pyx_n_s_local_result, __pyx_n_s_local_address, __pyx_n_s_versions, __pyx_n_s_local_row, __pyx_n_s_row, __pyx_n_s_schema_ver, __pyx_n_s_addr, __pyx_n_s_peer, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__376)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__376);
  __Pyx_GIVEREF(__pyx_tuple__376);
  __pyx_codeobj__377 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__376, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_get_schema_mismatches, 2640, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__377)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2668
 *         return dict((version, list(nodes)) for version, nodes in six.iteritems(versions))
 * 
 *     def _signal_error(self):             # <<<<<<<<<<<<<<
 *         with self._lock:
 *             if self._is_shutdown:
 */
  __pyx_tuple__378 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_host); if (unlikely(!__pyx_tuple__378)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__378);
  __Pyx_GIVEREF(__pyx_tuple__378);
  __pyx_codeobj__379 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__378, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_signal_error, 2668, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__379)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2688
 *         self.reconnect()
 * 
 *     def on_up(self, host):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
  __pyx_tuple__380 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_host); if (unlikely(!__pyx_tuple__380)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__380);
  __Pyx_GIVEREF(__pyx_tuple__380);
  __pyx_codeobj__381 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_on_up, 2688, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__381)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2691
 *         pass
 * 
 *     def on_down(self, host):             # <<<<<<<<<<<<<<
 * 
 *         conn = self._connection
 */
  __pyx_tuple__382 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_conn); if (unlikely(!__pyx_tuple__382)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__382);
  __Pyx_GIVEREF(__pyx_tuple__382);
  __pyx_codeobj__383 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__382, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_on_down, 2691, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__383)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2701
 *             self.reconnect()
 * 
 *     def on_add(self, host, refresh_nodes=True):             # <<<<<<<<<<<<<<
 *         if refresh_nodes:
 *             self.refresh_node_list_and_token_map(force_token_rebuild=True)
 */
  __pyx_tuple__384 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_refresh_nodes); if (unlikely(!__pyx_tuple__384)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__384);
  __Pyx_GIVEREF(__pyx_tuple__384);
  __pyx_codeobj__385 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__384, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_on_add, 2701, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__385)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__386 = PyTuple_Pack(1, ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__386)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__386);
  __Pyx_GIVEREF(__pyx_tuple__386);

  /* "cassandra/cluster.py":2705
 *             self.refresh_node_list_and_token_map(force_token_rebuild=True)
 * 
 *     def on_remove(self, host):             # <<<<<<<<<<<<<<
 *         self.refresh_node_list_and_token_map(force_token_rebuild=True)
 * 
 */
  __pyx_tuple__387 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_host); if (unlikely(!__pyx_tuple__387)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__387);
  __Pyx_GIVEREF(__pyx_tuple__387);
  __pyx_codeobj__388 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__387, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_on_remove, 2705, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__388)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2708
 *         self.refresh_node_list_and_token_map(force_token_rebuild=True)
 * 
 *     def get_connections(self):             # <<<<<<<<<<<<<<
 *         c = getattr(self, '_connection', None)
 *         return [c] if c else []
 */
  __pyx_tuple__389 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_c); if (unlikely(!__pyx_tuple__389)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__389);
  __Pyx_GIVEREF(__pyx_tuple__389);
  __pyx_codeobj__390 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__389, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_get_connections, 2708, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__390)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2712
 *         return [c] if c else []
 * 
 *     def return_connection(self, connection):             # <<<<<<<<<<<<<<
 *         if connection is self._connection and (connection.is_defunct or connection.is_closed):
 *             self.reconnect()
 */
  __pyx_tuple__391 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_connection); if (unlikely(!__pyx_tuple__391)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__391);
  __Pyx_GIVEREF(__pyx_tuple__391);
  __pyx_codeobj__392 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__391, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_return_connection, 2712, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__392)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2716
 *             self.reconnect()
 * 
 *     def set_meta_refresh_enabled(self, enabled):             # <<<<<<<<<<<<<<
 *         self._meta_refresh_enabled = enabled
 * 
 */
  __pyx_tuple__393 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_enabled); if (unlikely(!__pyx_tuple__393)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__393);
  __Pyx_GIVEREF(__pyx_tuple__393);
  __pyx_codeobj__394 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__393, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_set_meta_refresh_enabled, 2716, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__394)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2720
 * 
 * 
 * def _stop_scheduler(scheduler, thread):             # <<<<<<<<<<<<<<
 *     try:
 *         if not scheduler.is_shutdown:
 */
  __pyx_tuple__395 = PyTuple_Pack(2, __pyx_n_s_scheduler, __pyx_n_s_thread); if (unlikely(!__pyx_tuple__395)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__395);
  __Pyx_GIVEREF(__pyx_tuple__395);
  __pyx_codeobj__396 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__395, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_stop_scheduler, 2720, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__396)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2737
 *     is_shutdown = False
 * 
 *     def __init__(self, executor):             # <<<<<<<<<<<<<<
 *         self._queue = Queue.PriorityQueue()
 *         self._scheduled_tasks = set()
 */
  __pyx_tuple__397 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_executor, __pyx_n_s_t); if (unlikely(!__pyx_tuple__397)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__397);
  __Pyx_GIVEREF(__pyx_tuple__397);
  __pyx_codeobj__398 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__397, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_init, 2737, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__398)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2750
 *         atexit.register(partial(_stop_scheduler, weakref.proxy(self), t))
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         try:
 *             log.debug("Shutting down Cluster Scheduler")
 */
  __pyx_tuple__399 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__399)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__399);
  __Pyx_GIVEREF(__pyx_tuple__399);
  __pyx_codeobj__400 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__399, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_shutdown, 2750, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__400)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2759
 *         self._queue.put_nowait((0, None))
 * 
 *     def schedule(self, delay, fn, *args):             # <<<<<<<<<<<<<<
 *         self._insert_task(delay, (fn, args))
 * 
 */
  __pyx_tuple__401 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_delay, __pyx_n_s_fn, __pyx_n_s_args); if (unlikely(!__pyx_tuple__401)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__401);
  __Pyx_GIVEREF(__pyx_tuple__401);
  __pyx_codeobj__402 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__401, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_schedule, 2759, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__402)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2762
 *         self._insert_task(delay, (fn, args))
 * 
 *     def schedule_unique(self, delay, fn, *args):             # <<<<<<<<<<<<<<
 *         task = (fn, args)
 *         if task not in self._scheduled_tasks:
 */
  __pyx_tuple__403 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_delay, __pyx_n_s_fn, __pyx_n_s_args, __pyx_n_s_task); if (unlikely(!__pyx_tuple__403)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__403);
  __Pyx_GIVEREF(__pyx_tuple__403);
  __pyx_codeobj__404 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__403, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_schedule_unique, 2762, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__404)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2769
 *             log.debug("Ignoring schedule_unique for already-scheduled task: %r", task)
 * 
 *     def _insert_task(self, delay, task):             # <<<<<<<<<<<<<<
 *         if not self.is_shutdown:
 *             run_at = time.time() + delay
 */
  __pyx_tuple__405 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_delay, __pyx_n_s_task, __pyx_n_s_run_at); if (unlikely(!__pyx_tuple__405)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__405);
  __Pyx_GIVEREF(__pyx_tuple__405);
  __pyx_codeobj__406 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__405, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_insert_task, 2769, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__406)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2777
 *             log.debug("Ignoring scheduled task after shutdown: %r", task)
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         while True:
 *             if self.is_shutdown:
 */
  __pyx_tuple__407 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_run_at, __pyx_n_s_task, __pyx_n_s_fn, __pyx_n_s_args, __pyx_n_s_future); if (unlikely(!__pyx_tuple__407)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__407);
  __Pyx_GIVEREF(__pyx_tuple__407);
  __pyx_codeobj__408 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__407, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_run, 2777, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__408)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2801
 *             time.sleep(0.1)
 * 
 *     def _log_if_failed(self, future):             # <<<<<<<<<<<<<<
 *         exc = future.exception()
 *         if exc:
 */
  __pyx_tuple__409 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_future, __pyx_n_s_exc); if (unlikely(!__pyx_tuple__409)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__409);
  __Pyx_GIVEREF(__pyx_tuple__409);
  __pyx_codeobj__410 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__409, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_log_if_failed, 2801, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__410)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2809
 * 
 * 
 * def refresh_schema_and_set_result(keyspace, table, usertype, function, aggregate, control_conn, response_future):             # <<<<<<<<<<<<<<
 *     try:
 *         if control_conn._meta_refresh_enabled:
 */
  __pyx_tuple__411 = PyTuple_Pack(7, __pyx_n_s_keyspace, __pyx_n_s_table, __pyx_n_s_usertype, __pyx_n_s_function, __pyx_n_s_aggregate, __pyx_n_s_control_conn, __pyx_n_s_response_future); if (unlikely(!__pyx_tuple__411)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__411);
  __Pyx_GIVEREF(__pyx_tuple__411);
  __pyx_codeobj__412 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__411, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_refresh_schema_and_set_result, 2809, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__412)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2868
 *     _protocol_handler = ProtocolHandler
 * 
 *     def __init__(self, session, message, query, timeout, metrics=None, prepared_statement=None):             # <<<<<<<<<<<<<<
 *         self.session = session
 *         self.row_factory = session.row_factory
 */
  __pyx_tuple__413 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_session, __pyx_n_s_message, __pyx_n_s_query, __pyx_n_s_timeout, __pyx_n_s_metrics, __pyx_n_s_prepared_statement); if (unlikely(!__pyx_tuple__413)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__413);
  __Pyx_GIVEREF(__pyx_tuple__413);
  __pyx_codeobj__414 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__413, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_init, 2868, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__414)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__415 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__415)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__415);
  __Pyx_GIVEREF(__pyx_tuple__415);

  /* "cassandra/cluster.py":2886
 *         self._start_timer()
 * 
 *     def _start_timer(self):             # <<<<<<<<<<<<<<
 *         if self.timeout is not None:
 *             self._timer = self.session.cluster.connection_class.create_timer(self.timeout, self._on_timeout)
 */
  __pyx_tuple__416 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__416)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__416);
  __Pyx_GIVEREF(__pyx_tuple__416);
  __pyx_codeobj__417 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__416, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_start_timer, 2886, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__417)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2890
 *             self._timer = self.session.cluster.connection_class.create_timer(self.timeout, self._on_timeout)
 * 
 *     def _cancel_timer(self):             # <<<<<<<<<<<<<<
 *         if self._timer:
 *             self._timer.cancel()
 */
  __pyx_tuple__418 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__418)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__418);
  __Pyx_GIVEREF(__pyx_tuple__418);
  __pyx_codeobj__419 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__418, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_cancel_timer, 2890, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__419)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2894
 *             self._timer.cancel()
 * 
 *     def _on_timeout(self):             # <<<<<<<<<<<<<<
 *         self._set_final_exception(OperationTimedOut(self._errors, self._current_host))
 * 
 */
  __pyx_tuple__420 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__420)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__420);
  __Pyx_GIVEREF(__pyx_tuple__420);
  __pyx_codeobj__421 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__420, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_on_timeout, 2894, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__421)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2897
 *         self._set_final_exception(OperationTimedOut(self._errors, self._current_host))
 * 
 *     def _make_query_plan(self):             # <<<<<<<<<<<<<<
 *         # convert the list/generator/etc to an iterator so that subsequent
 *         # calls to send_request (which retries may do) will resume where
 */
  __pyx_tuple__422 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__422)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__422);
  __Pyx_GIVEREF(__pyx_tuple__422);
  __pyx_codeobj__423 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__422, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_make_query_plan_2, 2897, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__423)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2904
 *             self.session.keyspace, self.query))
 * 
 *     def send_request(self):             # <<<<<<<<<<<<<<
 *         """ Internal """
 *         # query_plan is an iterator, so this will resume where we last left
 */
  __pyx_tuple__424 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_req_id_2); if (unlikely(!__pyx_tuple__424)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__424);
  __Pyx_GIVEREF(__pyx_tuple__424);
  __pyx_codeobj__425 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__424, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_send_request, 2904, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__425)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2917
 *             "Unable to complete the operation against any hosts", self._errors))
 * 
 *     def _query(self, host, message=None, cb=None):             # <<<<<<<<<<<<<<
 *         if message is None:
 *             message = self.message
 */
  __pyx_tuple__426 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_host, __pyx_n_s_message, __pyx_n_s_cb, __pyx_n_s_pool, __pyx_n_s_connection, __pyx_n_s_request_id, __pyx_n_s_exc); if (unlikely(!__pyx_tuple__426)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__426);
  __Pyx_GIVEREF(__pyx_tuple__426);
  __pyx_codeobj__427 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__426, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_query_2, 2917, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__427)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__428 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__428)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__428);
  __Pyx_GIVEREF(__pyx_tuple__428);

  /* "cassandra/cluster.py":2956
 * 
 *     @property
 *     def has_more_pages(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns :const:`True` if there are more pages left in the
 */
  __pyx_tuple__429 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__429)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__429);
  __Pyx_GIVEREF(__pyx_tuple__429);
  __pyx_codeobj__430 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__429, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_has_more_pages, 2956, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__430)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2967
 * 
 *     @property
 *     def warnings(self):             # <<<<<<<<<<<<<<
 *         """
 *         Warnings returned from the server, if any. This will only be
 */
  __pyx_tuple__431 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__431)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__431);
  __Pyx_GIVEREF(__pyx_tuple__431);
  __pyx_codeobj__432 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__431, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_warnings, 2967, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__432)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2985
 * 
 *     @property
 *     def custom_payload(self):             # <<<<<<<<<<<<<<
 *         """
 *         The custom payload returned from the server, if any. This will only be
 */
  __pyx_tuple__433 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__433)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__433);
  __Pyx_GIVEREF(__pyx_tuple__433);
  __pyx_codeobj__434 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__433, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_custom_payload, 2985, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__434)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3002
 *         return self._custom_payload
 * 
 *     def start_fetching_next_page(self):             # <<<<<<<<<<<<<<
 *         """
 *         If there are more pages left in the query result, this asynchronously
 */
  __pyx_tuple__435 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__435)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__435);
  __Pyx_GIVEREF(__pyx_tuple__435);
  __pyx_codeobj__436 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__435, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_start_fetching_next_page, 3002, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__436)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3023
 *         self.send_request()
 * 
 *     def _reprepare(self, prepare_message):             # <<<<<<<<<<<<<<
 *         cb = partial(self.session.submit, self._execute_after_prepare)
 *         request_id = self._query(self._current_host, prepare_message, cb=cb)
 */
  __pyx_tuple__437 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_prepare_message, __pyx_n_s_cb, __pyx_n_s_request_id); if (unlikely(!__pyx_tuple__437)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__437);
  __Pyx_GIVEREF(__pyx_tuple__437);
  __pyx_codeobj__438 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__437, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_reprepare, 3023, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__438)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3030
 *             self.send_request()
 * 
 *     def _set_result(self, response):             # <<<<<<<<<<<<<<
 *         try:
 *             if self._current_pool and self._connection:
 */
  __pyx_tuple__439 = PyTuple_Pack(16, __pyx_n_s_self, __pyx_n_s_response, __pyx_n_s_trace_id, __pyx_n_s_session, __pyx_n_s_results, __pyx_n_s_retry_policy, __pyx_n_s_retry_2, __pyx_n_s_query_id, __pyx_n_s_prepared_statement, __pyx_n_s_current_keyspace, __pyx_n_s_prepared_keyspace, __pyx_n_s_prepare_message, __pyx_n_s_retry_type, __pyx_n_s_consistency, __pyx_n_s_msg, __pyx_n_s_exc); if (unlikely(!__pyx_tuple__439)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__439);
  __Pyx_GIVEREF(__pyx_tuple__439);
  __pyx_codeobj__440 = (PyObject*)__Pyx_PyCode_New(2, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__439, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_set_result, 3030, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__440)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3188
 *             self._set_final_exception(exc)
 * 
 *     def _set_keyspace_completed(self, errors):             # <<<<<<<<<<<<<<
 *         if not errors:
 *             self._set_final_result(None)
 */
  __pyx_tuple__441 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_errors); if (unlikely(!__pyx_tuple__441)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__441);
  __Pyx_GIVEREF(__pyx_tuple__441);
  __pyx_codeobj__442 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__441, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_set_keyspace_completed, 3188, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__442)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3195
 *                 "Failed to set keyspace on all hosts: %s" % (errors,)))
 * 
 *     def _execute_after_prepare(self, response):             # <<<<<<<<<<<<<<
 *         """
 *         Handle the response to our attempt to prepare a statement.
 */
  __pyx_tuple__443 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_response, __pyx_n_s_request_id); if (unlikely(!__pyx_tuple__443)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__443);
  __Pyx_GIVEREF(__pyx_tuple__443);
  __pyx_codeobj__444 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__443, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_execute_after_prepare, 3195, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__444)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3234
 *                 "statement on host %s: %s" % (self._current_host, response)))
 * 
 *     def _set_final_result(self, response):             # <<<<<<<<<<<<<<
 *         self._cancel_timer()
 *         if self._metrics is not None:
 */
  __pyx_tuple__445 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_response, __pyx_n_s_callback, __pyx_n_s_fn, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__445)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__445);
  __Pyx_GIVEREF(__pyx_tuple__445);
  __pyx_codeobj__446 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__445, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_set_final_result, 3234, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__446)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3249
 *             fn(response, *args, **kwargs)
 * 
 *     def _set_final_exception(self, response):             # <<<<<<<<<<<<<<
 *         self._cancel_timer()
 *         if self._metrics is not None:
 */
  __pyx_tuple__447 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_response, __pyx_n_s_errback, __pyx_n_s_fn, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__447)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__447);
  __Pyx_GIVEREF(__pyx_tuple__447);
  __pyx_codeobj__448 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__447, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_set_final_exception, 3249, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__448)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3262
 *             fn(response, *args, **kwargs)
 * 
 *     def _retry(self, reuse_connection, consistency_level):             # <<<<<<<<<<<<<<
 *         if self._final_exception:
 *             # the connection probably broke while we were waiting
 */
  __pyx_tuple__449 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_reuse_connection, __pyx_n_s_consistency_level); if (unlikely(!__pyx_tuple__449)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__449);
  __Pyx_GIVEREF(__pyx_tuple__449);
  __pyx_codeobj__450 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__449, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_retry, 3262, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__450)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3276
 *         self.session.submit(self._retry_task, reuse_connection)
 * 
 *     def _retry_task(self, reuse_connection):             # <<<<<<<<<<<<<<
 *         if self._final_exception:
 *             # the connection probably broke while we were waiting
 */
  __pyx_tuple__451 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_reuse_connection); if (unlikely(!__pyx_tuple__451)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__451);
  __Pyx_GIVEREF(__pyx_tuple__451);
  __pyx_codeobj__452 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__451, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_retry_task, 3276, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__452)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3288
 *         self.send_request()
 * 
 *     def result(self, timeout=_NOT_SET):             # <<<<<<<<<<<<<<
 *         """
 *         Return the final result or raise an Exception if errors were
 */
  __pyx_tuple__453 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_timeout, __pyx_n_s_msg); if (unlikely(!__pyx_tuple__453)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__453);
  __Pyx_GIVEREF(__pyx_tuple__453);
  __pyx_codeobj__454 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__453, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_result, 3288, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__454)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3344
 *             raise self._final_exception
 * 
 *     def get_query_trace(self, max_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the :class:`~.query.QueryTrace` instance representing a trace
 */
  __pyx_tuple__455 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_max_wait); if (unlikely(!__pyx_tuple__455)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__455);
  __Pyx_GIVEREF(__pyx_tuple__455);
  __pyx_codeobj__456 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__455, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_get_query_trace, 3344, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__456)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__457 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__457)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__457);
  __Pyx_GIVEREF(__pyx_tuple__457);

  /* "cassandra/cluster.py":3359
 *         return self._query_trace
 * 
 *     def add_callback(self, fn, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Attaches a callback function to be called when the final results arrive.
 */
  __pyx_tuple__458 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_fn, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_run_now); if (unlikely(!__pyx_tuple__458)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__458);
  __Pyx_GIVEREF(__pyx_tuple__458);
  __pyx_codeobj__459 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__458, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_add_callback, 3359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__459)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3406
 *         return self
 * 
 *     def add_errback(self, fn, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Like :meth:`.add_callback()`, but handles error cases.
 */
  __pyx_tuple__460 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_fn, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_run_now); if (unlikely(!__pyx_tuple__460)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__460);
  __Pyx_GIVEREF(__pyx_tuple__460);
  __pyx_codeobj__461 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__460, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_add_errback, 3406, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__461)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3422
 *         return self
 * 
 *     def add_callbacks(self, callback, errback,             # <<<<<<<<<<<<<<
 *                       callback_args=(), callback_kwargs=None,
 *                       errback_args=(), errback_kwargs=None):
 */
  __pyx_tuple__462 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_callback, __pyx_n_s_errback, __pyx_n_s_callback_args, __pyx_n_s_callback_kwargs, __pyx_n_s_errback_args, __pyx_n_s_errback_kwargs); if (unlikely(!__pyx_tuple__462)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__462);
  __Pyx_GIVEREF(__pyx_tuple__462);
  __pyx_codeobj__463 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__462, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_add_callbacks, 3422, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__463)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__464 = PyTuple_Pack(4, ((PyObject*)__pyx_empty_tuple), ((PyObject *)Py_None), ((PyObject*)__pyx_empty_tuple), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__464)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__464);
  __Pyx_GIVEREF(__pyx_tuple__464);

  /* "cassandra/cluster.py":3450
 *         self.add_errback(errback, *errback_args, **(errback_kwargs or {}))
 * 
 *     def clear_callbacks(self):             # <<<<<<<<<<<<<<
 *         with self._callback_lock:
 *             self._callback = []
 */
  __pyx_tuple__465 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__465)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__465);
  __Pyx_GIVEREF(__pyx_tuple__465);
  __pyx_codeobj__466 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__465, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_clear_callbacks, 3450, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__466)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3455
 *             self._errback = []
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         result = "(no result yet)" if self._final_result is _NOT_SET else self._final_result
 *         return "<ResponseFuture: query='%s' request_id=%s result=%s exception=%s host=%s>" \
 */
  __pyx_tuple__467 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_result); if (unlikely(!__pyx_tuple__467)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__467);
  __Pyx_GIVEREF(__pyx_tuple__467);
  __pyx_codeobj__468 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__467, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_str, 3455, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__468)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3497
 *     response_future = None
 * 
 *     def __init__(self, response_future, initial_response):             # <<<<<<<<<<<<<<
 *         self.response_future = response_future
 *         self.current_response = iter(initial_response)
 */
  __pyx_tuple__469 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_response_future, __pyx_n_s_initial_response); if (unlikely(!__pyx_tuple__469)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__469);
  __Pyx_GIVEREF(__pyx_tuple__469);
  __pyx_codeobj__470 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__469, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_init, 3497, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__470)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3501
 *         self.current_response = iter(initial_response)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_tuple__471 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__471)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__471);
  __Pyx_GIVEREF(__pyx_tuple__471);
  __pyx_codeobj__472 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__471, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_iter, 3501, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__472)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3504
 *         return self
 * 
 *     def next(self):             # <<<<<<<<<<<<<<
 *         try:
 *             return next(self.current_response)
 */
  __pyx_tuple__473 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_result); if (unlikely(!__pyx_tuple__473)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__473);
  __Pyx_GIVEREF(__pyx_tuple__473);
  __pyx_codeobj__474 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__473, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_adamholmberg_git_python_m, __pyx_n_s_next, 3504, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__474)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_float_0_1 = PyFloat_FromDouble(0.1); if (unlikely(!__pyx_float_0_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_0_2 = PyFloat_FromDouble(0.2); if (unlikely(!__pyx_float_0_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_1e6 = PyFloat_FromDouble(1e6); if (unlikely(!__pyx_float_1e6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_5_0 = PyFloat_FromDouble(5.0); if (unlikely(!__pyx_float_5_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_0_01 = PyFloat_FromDouble(0.01); if (unlikely(!__pyx_float_0_01)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_10_0 = PyFloat_FromDouble(10.0); if (unlikely(!__pyx_float_10_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_600_0 = PyFloat_FromDouble(600.0); if (unlikely(!__pyx_float_600_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_30 = PyInt_FromLong(30); if (unlikely(!__pyx_int_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_5000 = PyInt_FromLong(5000); if (unlikely(!__pyx_int_5000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_9042 = PyInt_FromLong(9042); if (unlikely(!__pyx_int_9042)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initcluster(void); /*proto*/
PyMODINIT_FUNC initcluster(void)
#else
PyMODINIT_FUNC PyInit_cluster(void); /*proto*/
PyMODINIT_FUNC PyInit_cluster(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_cluster(void)", 0);
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("cluster", __pyx_methods, __pyx_k_This_module_houses_the_main_cla, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main_cassandra__cluster) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!PyDict_GetItemString(modules, "cassandra.cluster")) {
      if (unlikely(PyDict_SetItemString(modules, "cassandra.cluster", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct__run_in_executor) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct__run_in_executor.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct__run_in_executor = &__pyx_type_9cassandra_7cluster___pyx_scope_struct__run_in_executor;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_1_on_add) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_1_on_add.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_1_on_add = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_1_on_add;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_2__validate_refresh_schema;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_3_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_3_genexpr.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_3_genexpr = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_3_genexpr;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_4_add_or_renew_pool;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_5_on_down) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_5_on_down.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_5_on_down = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_5_on_down;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_6__set_keyspace_for_all_pools;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_7_user_type_registered;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_8_encode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_8_encode.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_8_encode = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_8_encode;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_9_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_9_genexpr.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_9_genexpr = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_9_genexpr;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_10_get_pool_state;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_11_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_11_genexpr.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_11_genexpr = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_11_genexpr;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_12__refresh_schema;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_13_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_13_genexpr.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_13_genexpr = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_13_genexpr;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_14_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_14_genexpr.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_14_genexpr = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_14_genexpr;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_15_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_15_genexpr.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_15_genexpr = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_15_genexpr;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_16__get_schema_mismatches;
  if (PyType_Ready(&__pyx_type_9cassandra_7cluster___pyx_scope_struct_17_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_9cassandra_7cluster___pyx_scope_struct_17_genexpr.tp_print = 0;
  __pyx_ptype_9cassandra_7cluster___pyx_scope_struct_17_genexpr = &__pyx_type_9cassandra_7cluster___pyx_scope_struct_17_genexpr;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "cassandra/cluster.py":21
 * from __future__ import absolute_import
 * 
 * import atexit             # <<<<<<<<<<<<<<
 * from collections import defaultdict
 * from concurrent.futures import ThreadPoolExecutor
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_atexit, 0, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_atexit, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":22
 * 
 * import atexit
 * from collections import defaultdict             # <<<<<<<<<<<<<<
 * from concurrent.futures import ThreadPoolExecutor
 * import logging
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_defaultdict);
  __Pyx_GIVEREF(__pyx_n_s_defaultdict);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_defaultdict);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_defaultdict, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":23
 * import atexit
 * from collections import defaultdict
 * from concurrent.futures import ThreadPoolExecutor             # <<<<<<<<<<<<<<
 * import logging
 * from random import random
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_ThreadPoolExecutor);
  __Pyx_GIVEREF(__pyx_n_s_ThreadPoolExecutor);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ThreadPoolExecutor);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_concurrent_futures, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ThreadPoolExecutor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ThreadPoolExecutor, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":24
 * from collections import defaultdict
 * from concurrent.futures import ThreadPoolExecutor
 * import logging             # <<<<<<<<<<<<<<
 * from random import random
 * import socket
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_logging, 0, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":25
 * from concurrent.futures import ThreadPoolExecutor
 * import logging
 * from random import random             # <<<<<<<<<<<<<<
 * import socket
 * import sys
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_random);
  __Pyx_GIVEREF(__pyx_n_s_random);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_random);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_random, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_random); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_random, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":26
 * import logging
 * from random import random
 * import socket             # <<<<<<<<<<<<<<
 * import sys
 * import time
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_socket, 0, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_socket, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":27
 * from random import random
 * import socket
 * import sys             # <<<<<<<<<<<<<<
 * import time
 * from threading import Lock, RLock, Thread, Event
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":28
 * import socket
 * import sys
 * import time             # <<<<<<<<<<<<<<
 * from threading import Lock, RLock, Thread, Event
 * import warnings
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_time, 0, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":29
 * import sys
 * import time
 * from threading import Lock, RLock, Thread, Event             # <<<<<<<<<<<<<<
 * import warnings
 * 
 */
  __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_Lock);
  __Pyx_GIVEREF(__pyx_n_s_Lock);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Lock);
  __Pyx_INCREF(__pyx_n_s_RLock);
  __Pyx_GIVEREF(__pyx_n_s_RLock);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_RLock);
  __Pyx_INCREF(__pyx_n_s_Thread);
  __Pyx_GIVEREF(__pyx_n_s_Thread);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_Thread);
  __Pyx_INCREF(__pyx_n_s_Event);
  __Pyx_GIVEREF(__pyx_n_s_Event);
  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_Event);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_threading, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Lock); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Lock, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_RLock); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RLock, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Thread); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Thread, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Event); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Event, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":30
 * import time
 * from threading import Lock, RLock, Thread, Event
 * import warnings             # <<<<<<<<<<<<<<
 * 
 * import six
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":32
 * import warnings
 * 
 * import six             # <<<<<<<<<<<<<<
 * from six.moves import range
 * from six.moves import queue as Queue
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_six, 0, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_six, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":33
 * 
 * import six
 * from six.moves import range             # <<<<<<<<<<<<<<
 * from six.moves import queue as Queue
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_range);
  __Pyx_GIVEREF(__pyx_n_s_range);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_range);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_six_moves, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_range); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_range, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":34
 * import six
 * from six.moves import range
 * from six.moves import queue as Queue             # <<<<<<<<<<<<<<
 * 
 * import weakref
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_queue_2);
  __Pyx_GIVEREF(__pyx_n_s_queue_2);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_queue_2);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_six_moves, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_queue_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Queue, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":36
 * from six.moves import queue as Queue
 * 
 * import weakref             # <<<<<<<<<<<<<<
 * from weakref import WeakValueDictionary
 * try:
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_weakref, 0, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_weakref, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":37
 * 
 * import weakref
 * from weakref import WeakValueDictionary             # <<<<<<<<<<<<<<
 * try:
 *     from weakref import WeakSet
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_WeakValueDictionary);
  __Pyx_GIVEREF(__pyx_n_s_WeakValueDictionary);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_WeakValueDictionary);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_weakref, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_WeakValueDictionary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_WeakValueDictionary, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":38
 * import weakref
 * from weakref import WeakValueDictionary
 * try:             # <<<<<<<<<<<<<<
 *     from weakref import WeakSet
 * except ImportError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "cassandra/cluster.py":39
 * from weakref import WeakValueDictionary
 * try:
 *     from weakref import WeakSet             # <<<<<<<<<<<<<<
 * except ImportError:
 *     from cassandra.util import WeakSet  # NOQA
 */
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_s_WeakSet);
      __Pyx_GIVEREF(__pyx_n_s_WeakSet);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_WeakSet);
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_weakref, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_WeakSet); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_WeakSet, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L9_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cassandra/cluster.py":40
 * try:
 *     from weakref import WeakSet
 * except ImportError:             # <<<<<<<<<<<<<<
 *     from cassandra.util import WeakSet  # NOQA
 * 
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("cassandra.cluster", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_7);

      /* "cassandra/cluster.py":41
 *     from weakref import WeakSet
 * except ImportError:
 *     from cassandra.util import WeakSet  # NOQA             # <<<<<<<<<<<<<<
 * 
 * from functools import partial, wraps
 */
      __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_n_s_WeakSet);
      __Pyx_GIVEREF(__pyx_n_s_WeakSet);
      PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_WeakSet);
      __pyx_t_9 = __Pyx_Import(__pyx_n_s_cassandra_util, __pyx_t_8, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_WeakSet); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_WeakSet, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L3_exception_handled;
    }
    goto __pyx_L4_except_error;
    __pyx_L4_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L9_try_end:;
  }

  /* "cassandra/cluster.py":43
 *     from cassandra.util import WeakSet  # NOQA
 * 
 * from functools import partial, wraps             # <<<<<<<<<<<<<<
 * from itertools import groupby
 * 
 */
  __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_n_s_partial);
  __Pyx_GIVEREF(__pyx_n_s_partial);
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_partial);
  __Pyx_INCREF(__pyx_n_s_wraps);
  __Pyx_GIVEREF(__pyx_n_s_wraps);
  PyList_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_wraps);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_functools, __pyx_t_7, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_partial); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_partial, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_wraps); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_wraps, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":44
 * 
 * from functools import partial, wraps
 * from itertools import groupby             # <<<<<<<<<<<<<<
 * 
 * from cassandra import (ConsistencyLevel, AuthenticationFailed,
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_groupby);
  __Pyx_GIVEREF(__pyx_n_s_groupby);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_groupby);
  __pyx_t_7 = __Pyx_Import(__pyx_n_s_itertools, __pyx_t_2, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_groupby); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_groupby, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "cassandra/cluster.py":46
 * from itertools import groupby
 * 
 * from cassandra import (ConsistencyLevel, AuthenticationFailed,             # <<<<<<<<<<<<<<
 *                        InvalidRequest, OperationTimedOut,
 *                        UnsupportedOperation, Unauthorized)
 */
  __pyx_t_7 = PyList_New(6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_n_s_ConsistencyLevel);
  __Pyx_GIVEREF(__pyx_n_s_ConsistencyLevel);
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_ConsistencyLevel);
  __Pyx_INCREF(__pyx_n_s_AuthenticationFailed);
  __Pyx_GIVEREF(__pyx_n_s_AuthenticationFailed);
  PyList_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_AuthenticationFailed);
  __Pyx_INCREF(__pyx_n_s_InvalidRequest);
  __Pyx_GIVEREF(__pyx_n_s_InvalidRequest);
  PyList_SET_ITEM(__pyx_t_7, 2, __pyx_n_s_InvalidRequest);
  __Pyx_INCREF(__pyx_n_s_OperationTimedOut);
  __Pyx_GIVEREF(__pyx_n_s_OperationTimedOut);
  PyList_SET_ITEM(__pyx_t_7, 3, __pyx_n_s_OperationTimedOut);
  __Pyx_INCREF(__pyx_n_s_UnsupportedOperation);
  __Pyx_GIVEREF(__pyx_n_s_UnsupportedOperation);
  PyList_SET_ITEM(__pyx_t_7, 4, __pyx_n_s_UnsupportedOperation);
  __Pyx_INCREF(__pyx_n_s_Unauthorized);
  __Pyx_GIVEREF(__pyx_n_s_Unauthorized);
  PyList_SET_ITEM(__pyx_t_7, 5, __pyx_n_s_Unauthorized);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_cassandra, __pyx_t_7, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ConsistencyLevel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ConsistencyLevel, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_AuthenticationFailed); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_AuthenticationFailed, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_InvalidRequest); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_InvalidRequest, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_OperationTimedOut); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_OperationTimedOut, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_UnsupportedOperation); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_UnsupportedOperation, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Unauthorized); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Unauthorized, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":49
 *                        InvalidRequest, OperationTimedOut,
 *                        UnsupportedOperation, Unauthorized)
 * from cassandra.connection import (ConnectionException, ConnectionShutdown,             # <<<<<<<<<<<<<<
 *                                   ConnectionHeartbeat, ProtocolVersionUnsupported)
 * from cassandra.cqltypes import UserType
 */
  __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_ConnectionException);
  __Pyx_GIVEREF(__pyx_n_s_ConnectionException);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ConnectionException);
  __Pyx_INCREF(__pyx_n_s_ConnectionShutdown);
  __Pyx_GIVEREF(__pyx_n_s_ConnectionShutdown);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_ConnectionShutdown);
  __Pyx_INCREF(__pyx_n_s_ConnectionHeartbeat);
  __Pyx_GIVEREF(__pyx_n_s_ConnectionHeartbeat);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_ConnectionHeartbeat);
  __Pyx_INCREF(__pyx_n_s_ProtocolVersionUnsupported);
  __Pyx_GIVEREF(__pyx_n_s_ProtocolVersionUnsupported);
  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_ProtocolVersionUnsupported);
  __pyx_t_7 = __Pyx_Import(__pyx_n_s_cassandra_connection, __pyx_t_2, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_ConnectionException); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ConnectionException, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_ConnectionShutdown); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ConnectionShutdown, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_ConnectionHeartbeat); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ConnectionHeartbeat, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_ProtocolVersionUnsupported); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ProtocolVersionUnsupported, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "cassandra/cluster.py":51
 * from cassandra.connection import (ConnectionException, ConnectionShutdown,
 *                                   ConnectionHeartbeat, ProtocolVersionUnsupported)
 * from cassandra.cqltypes import UserType             # <<<<<<<<<<<<<<
 * from cassandra.encoder import Encoder
 * from cassandra.protocol import (QueryMessage, ResultMessage,
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_n_s_UserType);
  __Pyx_GIVEREF(__pyx_n_s_UserType);
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_UserType);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_cassandra_cqltypes, __pyx_t_7, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_UserType); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_UserType, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":52
 *                                   ConnectionHeartbeat, ProtocolVersionUnsupported)
 * from cassandra.cqltypes import UserType
 * from cassandra.encoder import Encoder             # <<<<<<<<<<<<<<
 * from cassandra.protocol import (QueryMessage, ResultMessage,
 *                                 ErrorMessage, ReadTimeoutErrorMessage,
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_Encoder);
  __Pyx_GIVEREF(__pyx_n_s_Encoder);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Encoder);
  __pyx_t_7 = __Pyx_Import(__pyx_n_s_cassandra_encoder, __pyx_t_2, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_Encoder); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Encoder, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "cassandra/cluster.py":53
 * from cassandra.cqltypes import UserType
 * from cassandra.encoder import Encoder
 * from cassandra.protocol import (QueryMessage, ResultMessage,             # <<<<<<<<<<<<<<
 *                                 ErrorMessage, ReadTimeoutErrorMessage,
 *                                 WriteTimeoutErrorMessage,
 */
  __pyx_t_7 = PyList_New(18); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_n_s_QueryMessage);
  __Pyx_GIVEREF(__pyx_n_s_QueryMessage);
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_QueryMessage);
  __Pyx_INCREF(__pyx_n_s_ResultMessage);
  __Pyx_GIVEREF(__pyx_n_s_ResultMessage);
  PyList_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_ResultMessage);
  __Pyx_INCREF(__pyx_n_s_ErrorMessage);
  __Pyx_GIVEREF(__pyx_n_s_ErrorMessage);
  PyList_SET_ITEM(__pyx_t_7, 2, __pyx_n_s_ErrorMessage);
  __Pyx_INCREF(__pyx_n_s_ReadTimeoutErrorMessage);
  __Pyx_GIVEREF(__pyx_n_s_ReadTimeoutErrorMessage);
  PyList_SET_ITEM(__pyx_t_7, 3, __pyx_n_s_ReadTimeoutErrorMessage);
  __Pyx_INCREF(__pyx_n_s_WriteTimeoutErrorMessage);
  __Pyx_GIVEREF(__pyx_n_s_WriteTimeoutErrorMessage);
  PyList_SET_ITEM(__pyx_t_7, 4, __pyx_n_s_WriteTimeoutErrorMessage);
  __Pyx_INCREF(__pyx_n_s_UnavailableErrorMessage);
  __Pyx_GIVEREF(__pyx_n_s_UnavailableErrorMessage);
  PyList_SET_ITEM(__pyx_t_7, 5, __pyx_n_s_UnavailableErrorMessage);
  __Pyx_INCREF(__pyx_n_s_OverloadedErrorMessage);
  __Pyx_GIVEREF(__pyx_n_s_OverloadedErrorMessage);
  PyList_SET_ITEM(__pyx_t_7, 6, __pyx_n_s_OverloadedErrorMessage);
  __Pyx_INCREF(__pyx_n_s_PrepareMessage);
  __Pyx_GIVEREF(__pyx_n_s_PrepareMessage);
  PyList_SET_ITEM(__pyx_t_7, 7, __pyx_n_s_PrepareMessage);
  __Pyx_INCREF(__pyx_n_s_ExecuteMessage);
  __Pyx_GIVEREF(__pyx_n_s_ExecuteMessage);
  PyList_SET_ITEM(__pyx_t_7, 8, __pyx_n_s_ExecuteMessage);
  __Pyx_INCREF(__pyx_n_s_PreparedQueryNotFound);
  __Pyx_GIVEREF(__pyx_n_s_PreparedQueryNotFound);
  PyList_SET_ITEM(__pyx_t_7, 9, __pyx_n_s_PreparedQueryNotFound);
  __Pyx_INCREF(__pyx_n_s_IsBootstrappingErrorMessage);
  __Pyx_GIVEREF(__pyx_n_s_IsBootstrappingErrorMessage);
  PyList_SET_ITEM(__pyx_t_7, 10, __pyx_n_s_IsBootstrappingErrorMessage);
  __Pyx_INCREF(__pyx_n_s_BatchMessage);
  __Pyx_GIVEREF(__pyx_n_s_BatchMessage);
  PyList_SET_ITEM(__pyx_t_7, 11, __pyx_n_s_BatchMessage);
  __Pyx_INCREF(__pyx_n_s_RESULT_KIND_PREPARED);
  __Pyx_GIVEREF(__pyx_n_s_RESULT_KIND_PREPARED);
  PyList_SET_ITEM(__pyx_t_7, 12, __pyx_n_s_RESULT_KIND_PREPARED);
  __Pyx_INCREF(__pyx_n_s_RESULT_KIND_SET_KEYSPACE);
  __Pyx_GIVEREF(__pyx_n_s_RESULT_KIND_SET_KEYSPACE);
  PyList_SET_ITEM(__pyx_t_7, 13, __pyx_n_s_RESULT_KIND_SET_KEYSPACE);
  __Pyx_INCREF(__pyx_n_s_RESULT_KIND_ROWS);
  __Pyx_GIVEREF(__pyx_n_s_RESULT_KIND_ROWS);
  PyList_SET_ITEM(__pyx_t_7, 14, __pyx_n_s_RESULT_KIND_ROWS);
  __Pyx_INCREF(__pyx_n_s_RESULT_KIND_SCHEMA_CHANGE);
  __Pyx_GIVEREF(__pyx_n_s_RESULT_KIND_SCHEMA_CHANGE);
  PyList_SET_ITEM(__pyx_t_7, 15, __pyx_n_s_RESULT_KIND_SCHEMA_CHANGE);
  __Pyx_INCREF(__pyx_n_s_MIN_SUPPORTED_VERSION);
  __Pyx_GIVEREF(__pyx_n_s_MIN_SUPPORTED_VERSION);
  PyList_SET_ITEM(__pyx_t_7, 16, __pyx_n_s_MIN_SUPPORTED_VERSION);
  __Pyx_INCREF(__pyx_n_s_ProtocolHandler);
  __Pyx_GIVEREF(__pyx_n_s_ProtocolHandler);
  PyList_SET_ITEM(__pyx_t_7, 17, __pyx_n_s_ProtocolHandler);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_cassandra_protocol, __pyx_t_7, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_QueryMessage); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_QueryMessage, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ResultMessage); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ResultMessage, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ErrorMessage); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ErrorMessage, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ReadTimeoutErrorMessage); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ReadTimeoutErrorMessage, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_WriteTimeoutErrorMessage); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_WriteTimeoutErrorMessage, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_UnavailableErrorMessage); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_UnavailableErrorMessage, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_OverloadedErrorMessage); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_OverloadedErrorMessage, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PrepareMessage); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PrepareMessage, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ExecuteMessage); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ExecuteMessage, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PreparedQueryNotFound); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PreparedQueryNotFound, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_IsBootstrappingErrorMessage); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_IsBootstrappingErrorMessage, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_BatchMessage); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BatchMessage, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_RESULT_KIND_PREPARED); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RESULT_KIND_PREPARED, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_RESULT_KIND_SET_KEYSPACE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RESULT_KIND_SET_KEYSPACE, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_RESULT_KIND_ROWS); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RESULT_KIND_ROWS, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_RESULT_KIND_SCHEMA_CHANGE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RESULT_KIND_SCHEMA_CHANGE, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_MIN_SUPPORTED_VERSION); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MIN_SUPPORTED_VERSION, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ProtocolHandler); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ProtocolHandler, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":65
 *                                 RESULT_KIND_SCHEMA_CHANGE, MIN_SUPPORTED_VERSION,
 *                                 ProtocolHandler)
 * from cassandra.metadata import Metadata, protect_name, murmur3             # <<<<<<<<<<<<<<
 * from cassandra.policies import (TokenAwarePolicy, DCAwareRoundRobinPolicy, SimpleConvictionPolicy,
 *                                 ExponentialReconnectionPolicy, HostDistance,
 */
  __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_Metadata);
  __Pyx_GIVEREF(__pyx_n_s_Metadata);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Metadata);
  __Pyx_INCREF(__pyx_n_s_protect_name);
  __Pyx_GIVEREF(__pyx_n_s_protect_name);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_protect_name);
  __Pyx_INCREF(__pyx_n_s_murmur3);
  __Pyx_GIVEREF(__pyx_n_s_murmur3);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_murmur3);
  __pyx_t_7 = __Pyx_Import(__pyx_n_s_cassandra_metadata, __pyx_t_2, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_Metadata); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Metadata, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_protect_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_protect_name, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_murmur3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_murmur3, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "cassandra/cluster.py":66
 *                                 ProtocolHandler)
 * from cassandra.metadata import Metadata, protect_name, murmur3
 * from cassandra.policies import (TokenAwarePolicy, DCAwareRoundRobinPolicy, SimpleConvictionPolicy,             # <<<<<<<<<<<<<<
 *                                 ExponentialReconnectionPolicy, HostDistance,
 *                                 RetryPolicy)
 */
  __pyx_t_7 = PyList_New(6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_n_s_TokenAwarePolicy);
  __Pyx_GIVEREF(__pyx_n_s_TokenAwarePolicy);
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_TokenAwarePolicy);
  __Pyx_INCREF(__pyx_n_s_DCAwareRoundRobinPolicy);
  __Pyx_GIVEREF(__pyx_n_s_DCAwareRoundRobinPolicy);
  PyList_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_DCAwareRoundRobinPolicy);
  __Pyx_INCREF(__pyx_n_s_SimpleConvictionPolicy);
  __Pyx_GIVEREF(__pyx_n_s_SimpleConvictionPolicy);
  PyList_SET_ITEM(__pyx_t_7, 2, __pyx_n_s_SimpleConvictionPolicy);
  __Pyx_INCREF(__pyx_n_s_ExponentialReconnectionPolicy);
  __Pyx_GIVEREF(__pyx_n_s_ExponentialReconnectionPolicy);
  PyList_SET_ITEM(__pyx_t_7, 3, __pyx_n_s_ExponentialReconnectionPolicy);
  __Pyx_INCREF(__pyx_n_s_HostDistance);
  __Pyx_GIVEREF(__pyx_n_s_HostDistance);
  PyList_SET_ITEM(__pyx_t_7, 4, __pyx_n_s_HostDistance);
  __Pyx_INCREF(__pyx_n_s_RetryPolicy);
  __Pyx_GIVEREF(__pyx_n_s_RetryPolicy);
  PyList_SET_ITEM(__pyx_t_7, 5, __pyx_n_s_RetryPolicy);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_cassandra_policies, __pyx_t_7, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_TokenAwarePolicy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TokenAwarePolicy, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_DCAwareRoundRobinPolicy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DCAwareRoundRobinPolicy, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_SimpleConvictionPolicy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SimpleConvictionPolicy, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ExponentialReconnectionPolicy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ExponentialReconnectionPolicy, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_HostDistance); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_HostDistance, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_RetryPolicy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RetryPolicy, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":69
 *                                 ExponentialReconnectionPolicy, HostDistance,
 *                                 RetryPolicy)
 * from cassandra.pool import (Host, _ReconnectionHandler, _HostReconnectionHandler,             # <<<<<<<<<<<<<<
 *                             HostConnectionPool, HostConnection,
 *                             NoConnectionsAvailable)
 */
  __pyx_t_2 = PyList_New(6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_Host);
  __Pyx_GIVEREF(__pyx_n_s_Host);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Host);
  __Pyx_INCREF(__pyx_n_s_ReconnectionHandler);
  __Pyx_GIVEREF(__pyx_n_s_ReconnectionHandler);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_ReconnectionHandler);
  __Pyx_INCREF(__pyx_n_s_HostReconnectionHandler);
  __Pyx_GIVEREF(__pyx_n_s_HostReconnectionHandler);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_HostReconnectionHandler);
  __Pyx_INCREF(__pyx_n_s_HostConnectionPool);
  __Pyx_GIVEREF(__pyx_n_s_HostConnectionPool);
  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_HostConnectionPool);
  __Pyx_INCREF(__pyx_n_s_HostConnection);
  __Pyx_GIVEREF(__pyx_n_s_HostConnection);
  PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_HostConnection);
  __Pyx_INCREF(__pyx_n_s_NoConnectionsAvailable);
  __Pyx_GIVEREF(__pyx_n_s_NoConnectionsAvailable);
  PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_NoConnectionsAvailable);
  __pyx_t_7 = __Pyx_Import(__pyx_n_s_cassandra_pool, __pyx_t_2, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_Host); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Host, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_ReconnectionHandler); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ReconnectionHandler, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_HostReconnectionHandler); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_HostReconnectionHandler, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_HostConnectionPool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_HostConnectionPool, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_HostConnection); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_HostConnection, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_NoConnectionsAvailable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NoConnectionsAvailable, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "cassandra/cluster.py":72
 *                             HostConnectionPool, HostConnection,
 *                             NoConnectionsAvailable)
 * from cassandra.query import (SimpleStatement, PreparedStatement, BoundStatement,             # <<<<<<<<<<<<<<
 *                              BatchStatement, bind_params, QueryTrace, Statement,
 *                              named_tuple_factory, dict_factory, FETCH_SIZE_UNSET)
 */
  __pyx_t_7 = PyList_New(10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_n_s_SimpleStatement);
  __Pyx_GIVEREF(__pyx_n_s_SimpleStatement);
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_SimpleStatement);
  __Pyx_INCREF(__pyx_n_s_PreparedStatement);
  __Pyx_GIVEREF(__pyx_n_s_PreparedStatement);
  PyList_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_PreparedStatement);
  __Pyx_INCREF(__pyx_n_s_BoundStatement);
  __Pyx_GIVEREF(__pyx_n_s_BoundStatement);
  PyList_SET_ITEM(__pyx_t_7, 2, __pyx_n_s_BoundStatement);
  __Pyx_INCREF(__pyx_n_s_BatchStatement);
  __Pyx_GIVEREF(__pyx_n_s_BatchStatement);
  PyList_SET_ITEM(__pyx_t_7, 3, __pyx_n_s_BatchStatement);
  __Pyx_INCREF(__pyx_n_s_bind_params);
  __Pyx_GIVEREF(__pyx_n_s_bind_params);
  PyList_SET_ITEM(__pyx_t_7, 4, __pyx_n_s_bind_params);
  __Pyx_INCREF(__pyx_n_s_QueryTrace);
  __Pyx_GIVEREF(__pyx_n_s_QueryTrace);
  PyList_SET_ITEM(__pyx_t_7, 5, __pyx_n_s_QueryTrace);
  __Pyx_INCREF(__pyx_n_s_Statement);
  __Pyx_GIVEREF(__pyx_n_s_Statement);
  PyList_SET_ITEM(__pyx_t_7, 6, __pyx_n_s_Statement);
  __Pyx_INCREF(__pyx_n_s_named_tuple_factory);
  __Pyx_GIVEREF(__pyx_n_s_named_tuple_factory);
  PyList_SET_ITEM(__pyx_t_7, 7, __pyx_n_s_named_tuple_factory);
  __Pyx_INCREF(__pyx_n_s_dict_factory);
  __Pyx_GIVEREF(__pyx_n_s_dict_factory);
  PyList_SET_ITEM(__pyx_t_7, 8, __pyx_n_s_dict_factory);
  __Pyx_INCREF(__pyx_n_s_FETCH_SIZE_UNSET);
  __Pyx_GIVEREF(__pyx_n_s_FETCH_SIZE_UNSET);
  PyList_SET_ITEM(__pyx_t_7, 9, __pyx_n_s_FETCH_SIZE_UNSET);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_cassandra_query, __pyx_t_7, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_SimpleStatement); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SimpleStatement, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PreparedStatement); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PreparedStatement, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_BoundStatement); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BoundStatement, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_BatchStatement); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BatchStatement, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_bind_params); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_bind_params, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_QueryTrace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_QueryTrace, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Statement); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Statement, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_named_tuple_factory); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_named_tuple_factory, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_dict_factory); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_dict_factory, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_FETCH_SIZE_UNSET); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FETCH_SIZE_UNSET, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":77
 * 
 * 
 * def _is_eventlet_monkey_patched():             # <<<<<<<<<<<<<<
 *     if 'eventlet.patcher' not in sys.modules:
 *         return False
 */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_1_is_eventlet_monkey_patched, 0, __pyx_n_s_is_eventlet_monkey_patched, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__156)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_eventlet_monkey_patched, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":83
 *     return eventlet.patcher.is_monkey_patched('socket')
 * 
 * def _is_gevent_monkey_patched():             # <<<<<<<<<<<<<<
 *     if 'gevent.monkey' not in sys.modules:
 *         return False
 */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_3_is_gevent_monkey_patched, 0, __pyx_n_s_is_gevent_monkey_patched, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__158)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_gevent_monkey_patched, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":92
 * # monkey patched with eventlet, otherwise if libev is available, use that as
 * # the default because it's fastest. Otherwise, use asyncore.
 * if _is_gevent_monkey_patched():             # <<<<<<<<<<<<<<
 *     from cassandra.io.geventreactor import GeventConnection as DefaultConnection
 * elif _is_eventlet_monkey_patched():
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_is_gevent_monkey_patched); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_10) {

    /* "cassandra/cluster.py":93
 * # the default because it's fastest. Otherwise, use asyncore.
 * if _is_gevent_monkey_patched():
 *     from cassandra.io.geventreactor import GeventConnection as DefaultConnection             # <<<<<<<<<<<<<<
 * elif _is_eventlet_monkey_patched():
 *     from cassandra.io.eventletreactor import EventletConnection as DefaultConnection
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_GeventConnection);
    __Pyx_GIVEREF(__pyx_n_s_GeventConnection);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_GeventConnection);
    __pyx_t_7 = __Pyx_Import(__pyx_n_s_cassandra_io_geventreactor, __pyx_t_2, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_GeventConnection); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_DefaultConnection, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L12;
  }

  /* "cassandra/cluster.py":94
 * if _is_gevent_monkey_patched():
 *     from cassandra.io.geventreactor import GeventConnection as DefaultConnection
 * elif _is_eventlet_monkey_patched():             # <<<<<<<<<<<<<<
 *     from cassandra.io.eventletreactor import EventletConnection as DefaultConnection
 * else:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_is_eventlet_monkey_patched); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_10) {

    /* "cassandra/cluster.py":95
 *     from cassandra.io.geventreactor import GeventConnection as DefaultConnection
 * elif _is_eventlet_monkey_patched():
 *     from cassandra.io.eventletreactor import EventletConnection as DefaultConnection             # <<<<<<<<<<<<<<
 * else:
 *     try:
 */
    __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_n_s_EventletConnection);
    __Pyx_GIVEREF(__pyx_n_s_EventletConnection);
    PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_EventletConnection);
    __pyx_t_2 = __Pyx_Import(__pyx_n_s_cassandra_io_eventletreactor, __pyx_t_7, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_EventletConnection); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_DefaultConnection, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L12;
  }
  /*else*/ {

    /* "cassandra/cluster.py":97
 *     from cassandra.io.eventletreactor import EventletConnection as DefaultConnection
 * else:
 *     try:             # <<<<<<<<<<<<<<
 *         from cassandra.io.libevreactor import LibevConnection as DefaultConnection  # NOQA
 *     except ImportError:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      /*try:*/ {

        /* "cassandra/cluster.py":98
 * else:
 *     try:
 *         from cassandra.io.libevreactor import LibevConnection as DefaultConnection  # NOQA             # <<<<<<<<<<<<<<
 *     except ImportError:
 *         from cassandra.io.asyncorereactor import AsyncoreConnection as DefaultConnection  # NOQA
 */
        __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_n_s_LibevConnection);
        __Pyx_GIVEREF(__pyx_n_s_LibevConnection);
        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_LibevConnection);
        __pyx_t_7 = __Pyx_Import(__pyx_n_s_cassandra_io_libevreactor, __pyx_t_2, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_LibevConnection); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
        __Pyx_GOTREF(__pyx_t_2);
        if (PyDict_SetItem(__pyx_d, __pyx_n_s_DefaultConnection, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L20_try_end;
      __pyx_L13_error:;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "cassandra/cluster.py":99
 *     try:
 *         from cassandra.io.libevreactor import LibevConnection as DefaultConnection  # NOQA
 *     except ImportError:             # <<<<<<<<<<<<<<
 *         from cassandra.io.asyncorereactor import AsyncoreConnection as DefaultConnection  # NOQA
 * 
 */
      __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
      if (__pyx_t_6) {
        __Pyx_AddTraceback("cassandra.cluster", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_1);

        /* "cassandra/cluster.py":100
 *         from cassandra.io.libevreactor import LibevConnection as DefaultConnection  # NOQA
 *     except ImportError:
 *         from cassandra.io.asyncorereactor import AsyncoreConnection as DefaultConnection  # NOQA             # <<<<<<<<<<<<<<
 * 
 * # Forces load of utf8 encoding module to avoid deadlock that occurs
 */
        __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_n_s_AsyncoreConnection);
        __Pyx_GIVEREF(__pyx_n_s_AsyncoreConnection);
        PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_AsyncoreConnection);
        __pyx_t_8 = __Pyx_Import(__pyx_n_s_cassandra_io_asyncorereactor, __pyx_t_9, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_ImportFrom(__pyx_t_8, __pyx_n_s_AsyncoreConnection); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        if (PyDict_SetItem(__pyx_d, __pyx_n_s_DefaultConnection, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L14_exception_handled;
      }
      goto __pyx_L15_except_error;
      __pyx_L15_except_error:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
      goto __pyx_L1_error;
      __pyx_L14_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
      __pyx_L20_try_end:;
    }
  }
  __pyx_L12:;

  /* "cassandra/cluster.py":106
 * # thread.
 * # See http://bugs.python.org/issue10923
 * "".encode('utf8')             # <<<<<<<<<<<<<<
 * 
 * log = logging.getLogger(__name__)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s__159, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__160, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":108
 * "".encode('utf8')
 * 
 * log = logging.getLogger(__name__)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (!__pyx_t_8) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_log, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":111
 * 
 * 
 * DEFAULT_MIN_REQUESTS = 5             # <<<<<<<<<<<<<<
 * DEFAULT_MAX_REQUESTS = 100
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_MIN_REQUESTS, __pyx_int_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":112
 * 
 * DEFAULT_MIN_REQUESTS = 5
 * DEFAULT_MAX_REQUESTS = 100             # <<<<<<<<<<<<<<
 * 
 * DEFAULT_MIN_CONNECTIONS_PER_LOCAL_HOST = 2
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_MAX_REQUESTS, __pyx_int_100) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":114
 * DEFAULT_MAX_REQUESTS = 100
 * 
 * DEFAULT_MIN_CONNECTIONS_PER_LOCAL_HOST = 2             # <<<<<<<<<<<<<<
 * DEFAULT_MAX_CONNECTIONS_PER_LOCAL_HOST = 8
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_MIN_CONNECTIONS_PER_LOCA, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":115
 * 
 * DEFAULT_MIN_CONNECTIONS_PER_LOCAL_HOST = 2
 * DEFAULT_MAX_CONNECTIONS_PER_LOCAL_HOST = 8             # <<<<<<<<<<<<<<
 * 
 * DEFAULT_MIN_CONNECTIONS_PER_REMOTE_HOST = 1
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_MAX_CONNECTIONS_PER_LOCA, __pyx_int_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":117
 * DEFAULT_MAX_CONNECTIONS_PER_LOCAL_HOST = 8
 * 
 * DEFAULT_MIN_CONNECTIONS_PER_REMOTE_HOST = 1             # <<<<<<<<<<<<<<
 * DEFAULT_MAX_CONNECTIONS_PER_REMOTE_HOST = 2
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_MIN_CONNECTIONS_PER_REMO, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":118
 * 
 * DEFAULT_MIN_CONNECTIONS_PER_REMOTE_HOST = 1
 * DEFAULT_MAX_CONNECTIONS_PER_REMOTE_HOST = 2             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_MAX_CONNECTIONS_PER_REMO, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":121
 * 
 * 
 * _NOT_SET = object()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_object); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOT_SET, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":124
 * 
 * 
 * class NoHostAvailable(Exception):             # <<<<<<<<<<<<<<
 *     """
 *     Raised when an operation is attempted but all connections are
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception);
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_9 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_2, __pyx_n_s_NoHostAvailable, __pyx_n_s_NoHostAvailable, (PyObject *) NULL, __pyx_n_s_cassandra_cluster, __pyx_kp_s_Raised_when_an_operation_is_att); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);

  /* "cassandra/cluster.py":130
 *     """
 * 
 *     errors = None             # <<<<<<<<<<<<<<
 *     """
 *     A map of the form ``{ip: exception}`` which details the particular
 */
  if (PyObject_SetItem(__pyx_t_9, __pyx_n_s_errors, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":137
 *     """
 * 
 *     def __init__(self, message, errors):             # <<<<<<<<<<<<<<
 *         Exception.__init__(self, message, errors)
 *         self.errors = errors
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_15NoHostAvailable_1__init__, 0, __pyx_n_s_NoHostAvailable___init, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__162)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_9, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":124
 * 
 * 
 * class NoHostAvailable(Exception):             # <<<<<<<<<<<<<<
 *     """
 *     Raised when an operation is attempted but all connections are
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_NoHostAvailable, __pyx_t_2, __pyx_t_9, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NoHostAvailable, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":142
 * 
 * 
 * def _future_completed(future):             # <<<<<<<<<<<<<<
 *     """ Helper for run_in_executor() """
 *     exc = future.exception()
 */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_5_future_completed, 0, __pyx_n_s_future_completed, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__164)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_future_completed, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":149
 * 
 * 
 * def run_in_executor(f):             # <<<<<<<<<<<<<<
 *     """
 *     A decorator to run the given method in the ThreadPoolExecutor.
 */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7run_in_executor, 0, __pyx_n_s_run_in_executor, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__166)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_run_in_executor, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":168
 * 
 * 
 * def _shutdown_cluster(cluster):             # <<<<<<<<<<<<<<
 *     if cluster and not cluster.is_shutdown:
 *         cluster.shutdown()
 */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_9_shutdown_cluster, 0, __pyx_n_s_shutdown_cluster, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__168)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_shutdown_cluster, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":174
 * 
 * # murmur3 implementation required for TokenAware is only available for CPython
 * import platform             # <<<<<<<<<<<<<<
 * if platform.python_implementation() == 'CPython':
 *     def default_lbp_factory():
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_platform, 0, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_platform, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":175
 * # murmur3 implementation required for TokenAware is only available for CPython
 * import platform
 * if platform.python_implementation() == 'CPython':             # <<<<<<<<<<<<<<
 *     def default_lbp_factory():
 *         if murmur3 is not None:
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_platform); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_python_implementation); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  if (__pyx_t_7) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_10 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_CPython, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_10) {

    /* "cassandra/cluster.py":176
 * import platform
 * if platform.python_implementation() == 'CPython':
 *     def default_lbp_factory():             # <<<<<<<<<<<<<<
 *         if murmur3 is not None:
 *             return TokenAwarePolicy(DCAwareRoundRobinPolicy())
 */
    __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_11default_lbp_factory, 0, __pyx_n_s_default_lbp_factory, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__169)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_default_lbp_factory, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L23;
  }
  /*else*/ {

    /* "cassandra/cluster.py":181
 *         return DCAwareRoundRobinPolicy()
 * else:
 *     def default_lbp_factory():             # <<<<<<<<<<<<<<
 *         return DCAwareRoundRobinPolicy()
 * 
 */
    __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_13default_lbp_factory, 0, __pyx_n_s_default_lbp_factory, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__170)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_default_lbp_factory, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L23:;

  /* "cassandra/cluster.py":185
 * 
 * 
 * class Cluster(object):             # <<<<<<<<<<<<<<
 *     """
 *     The main class to use when interacting with a Cassandra cluster.
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_object);
  __pyx_t_9 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_9, __pyx_t_2, __pyx_n_s_Cluster, __pyx_n_s_Cluster, (PyObject *) NULL, __pyx_n_s_cassandra_cluster, __pyx_kp_s_The_main_class_to_use_when_inte); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "cassandra/cluster.py":202
 *     """
 * 
 *     contact_points = ['127.0.0.1']             # <<<<<<<<<<<<<<
 *     """
 *     The list of contact points to try connecting for cluster discovery.
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_kp_s_127_0_0_1);
  __Pyx_GIVEREF(__pyx_kp_s_127_0_0_1);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_s_127_0_0_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_contact_points, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":214
 *     """
 * 
 *     port = 9042             # <<<<<<<<<<<<<<
 *     """
 *     The server-side port to open connections to. Defaults to 9042.
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_port, __pyx_int_9042) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":219
 *     """
 * 
 *     cql_version = None             # <<<<<<<<<<<<<<
 *     """
 *     If a specific version of CQL should be used, this may be set to that
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_cql_version, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":226
 *     """
 * 
 *     protocol_version = 4             # <<<<<<<<<<<<<<
 *     """
 *     The maximum version of the native protocol to use.
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_protocol_version, __pyx_int_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":264
 *     """
 * 
 *     compression = True             # <<<<<<<<<<<<<<
 *     """
 *     Controls compression for communications between the driver and Cassandra.
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_compression, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":277
 *     """
 * 
 *     _auth_provider = None             # <<<<<<<<<<<<<<
 *     _auth_provider_callable = None
 * 
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_auth_provider, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":278
 * 
 *     _auth_provider = None
 *     _auth_provider_callable = None             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_auth_provider_callable, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":281
 * 
 *     @property
 *     def auth_provider(self):             # <<<<<<<<<<<<<<
 *         """
 *         When :attr:`~.Cluster.protocol_version` is 2 or higher, this should
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_1auth_provider, 0, __pyx_n_s_Cluster_auth_provider, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__172)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "cassandra/cluster.py":280
 *     _auth_provider_callable = None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def auth_provider(self):
 *         """
 */
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_auth_provider_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":295
 *         return self._auth_provider
 * 
 *     @auth_provider.setter  # noqa             # <<<<<<<<<<<<<<
 *     def auth_provider(self, value):
 *         if not value:
 */
  __pyx_t_8 = PyObject_GetItem(__pyx_t_7, __pyx_n_s_auth_provider_2);
  if (unlikely(!__pyx_t_8)) {
    PyErr_Clear();
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_auth_provider_2);
  }
  if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_setter); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "cassandra/cluster.py":296
 * 
 *     @auth_provider.setter  # noqa
 *     def auth_provider(self, value):             # <<<<<<<<<<<<<<
 *         if not value:
 *             self._auth_provider = value
 */
  __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_3auth_provider, 0, __pyx_n_s_Cluster_auth_provider, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__174)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_12 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
    }
  }
  if (!__pyx_t_12) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_auth_provider_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":313
 *         self._auth_provider = value
 * 
 *     load_balancing_policy = None             # <<<<<<<<<<<<<<
 *     """
 *     An instance of :class:`.policies.LoadBalancingPolicy` or
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_load_balancing_policy, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":328
 *     """
 * 
 *     reconnection_policy = ExponentialReconnectionPolicy(1.0, 600.0)             # <<<<<<<<<<<<<<
 *     """
 *     An instance of :class:`.policies.ReconnectionPolicy`. Defaults to an instance
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ExponentialReconnectionPolicy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__175, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_reconnection_policy, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":335
 *     """
 * 
 *     default_retry_policy = RetryPolicy()             # <<<<<<<<<<<<<<
 *     """
 *     A default :class:`.policies.RetryPolicy` instance to use for all
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_RetryPolicy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_13)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_13) {
    __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  } else {
    __pyx_t_11 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_default_retry_policy, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":342
 *     """
 * 
 *     conviction_policy_factory = SimpleConvictionPolicy             # <<<<<<<<<<<<<<
 *     """
 *     A factory function which creates instances of
 */
  __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_SimpleConvictionPolicy); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_conviction_policy_factory, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":349
 *     """
 * 
 *     connect_to_remote_hosts = True             # <<<<<<<<<<<<<<
 *     """
 *     If left as :const:`True`, hosts that are considered :attr:`~.HostDistance.REMOTE`
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_connect_to_remote_hosts, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":360
 *     """
 * 
 *     metrics_enabled = False             # <<<<<<<<<<<<<<
 *     """
 *     Whether or not metric collection is enabled.  If enabled, :attr:`.metrics`
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_metrics_enabled, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":366
 *     """
 * 
 *     metrics = None             # <<<<<<<<<<<<<<
 *     """
 *     An instance of :class:`cassandra.metrics.Metrics` if :attr:`.metrics_enabled` is
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_metrics, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":372
 *     """
 * 
 *     ssl_options = None             # <<<<<<<<<<<<<<
 *     """
 *     A optional dict which will be used as kwargs for ``ssl.wrap_socket()``
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_ssl_options, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":384
 *     """
 * 
 *     sockopts = None             # <<<<<<<<<<<<<<
 *     """
 *     An optional list of tuples which will be used as arguments to
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_sockopts, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":390
 *     """
 * 
 *     max_schema_agreement_wait = 10             # <<<<<<<<<<<<<<
 *     """
 *     The maximum duration (in seconds) that the driver will wait for schema
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_max_schema_agreement_wait, __pyx_int_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":397
 *     """
 * 
 *     metadata = None             # <<<<<<<<<<<<<<
 *     """
 *     An instance of :class:`cassandra.metadata.Metadata`.
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_metadata, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":402
 *     """
 * 
 *     connection_class = DefaultConnection             # <<<<<<<<<<<<<<
 *     """
 *     This determines what event loop system will be used for managing
 */
  __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_DefaultConnection); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_connection_class, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":423
 *     """
 * 
 *     control_connection_timeout = 2.0             # <<<<<<<<<<<<<<
 *     """
 *     A timeout, in seconds, for queries made by the control connection, such
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_control_connection_timeout, __pyx_float_2_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":430
 *     """
 * 
 *     idle_heartbeat_interval = 30             # <<<<<<<<<<<<<<
 *     """
 *     Interval, in seconds, on which to heartbeat idle connections. This helps
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_idle_heartbeat_interval, __pyx_int_30) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":438
 *     """
 * 
 *     schema_event_refresh_window = 2             # <<<<<<<<<<<<<<
 *     """
 *     Window, in seconds, within which a schema component will be refreshed after
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_schema_event_refresh_window, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":459
 *     """
 * 
 *     topology_event_refresh_window = 10             # <<<<<<<<<<<<<<
 *     """
 *     Window, in seconds, within which the node and token list will be refreshed after
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_topology_event_refresh_window, __pyx_int_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":472
 *     """
 * 
 *     connect_timeout = 5             # <<<<<<<<<<<<<<
 *     """
 *     Timeout, in seconds, for creating new connections.
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_connect_timeout, __pyx_int_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":480
 *     """
 * 
 *     sessions = None             # <<<<<<<<<<<<<<
 *     control_connection = None
 *     scheduler = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_sessions, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":481
 * 
 *     sessions = None
 *     control_connection = None             # <<<<<<<<<<<<<<
 *     scheduler = None
 *     executor = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_control_connection, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":482
 *     sessions = None
 *     control_connection = None
 *     scheduler = None             # <<<<<<<<<<<<<<
 *     executor = None
 *     is_shutdown = False
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_scheduler, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":483
 *     control_connection = None
 *     scheduler = None
 *     executor = None             # <<<<<<<<<<<<<<
 *     is_shutdown = False
 *     _is_setup = False
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_executor, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":484
 *     scheduler = None
 *     executor = None
 *     is_shutdown = False             # <<<<<<<<<<<<<<
 *     _is_setup = False
 *     _prepared_statements = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_is_shutdown, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":485
 *     executor = None
 *     is_shutdown = False
 *     _is_setup = False             # <<<<<<<<<<<<<<
 *     _prepared_statements = None
 *     _prepared_statement_lock = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_is_setup, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":486
 *     is_shutdown = False
 *     _is_setup = False
 *     _prepared_statements = None             # <<<<<<<<<<<<<<
 *     _prepared_statement_lock = None
 *     _idle_heartbeat = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_prepared_statements, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":487
 *     _is_setup = False
 *     _prepared_statements = None
 *     _prepared_statement_lock = None             # <<<<<<<<<<<<<<
 *     _idle_heartbeat = None
 * 
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_prepared_statement_lock, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":488
 *     _prepared_statements = None
 *     _prepared_statement_lock = None
 *     _idle_heartbeat = None             # <<<<<<<<<<<<<<
 * 
 *     _user_types = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_idle_heartbeat, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":490
 *     _idle_heartbeat = None
 * 
 *     _user_types = None             # <<<<<<<<<<<<<<
 *     """
 *     A map of {keyspace: {type_name: UserType}}
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_user_types, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":495
 *     """
 * 
 *     _listeners = None             # <<<<<<<<<<<<<<
 *     _listener_lock = None
 * 
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_listeners, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":496
 * 
 *     _listeners = None
 *     _listener_lock = None             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self,
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_listener_lock, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":498
 *     _listener_lock = None
 * 
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *                  contact_points=["127.0.0.1"],
 *                  port=9042,
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_5__init__, 0, __pyx_n_s_Cluster___init, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__177)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_11, sizeof(__pyx_defaults), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":499
 * 
 *     def __init__(self,
 *                  contact_points=["127.0.0.1"],             # <<<<<<<<<<<<<<
 *                  port=9042,
 *                  compression=True,
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_kp_s_127_0_0_1);
  __Pyx_GIVEREF(__pyx_kp_s_127_0_0_1);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_s_127_0_0_1);
  __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_11)->__pyx_arg_contact_points = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_11, __pyx_pf_9cassandra_7cluster_7Cluster_96__defaults__);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_init, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":620
 *             self.schema_event_refresh_window, self.topology_event_refresh_window)
 * 
 *     def register_user_type(self, keyspace, user_type, klass):             # <<<<<<<<<<<<<<
 *         """
 *         Registers a class to use to represent a particular user-defined type.
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_7register_user_type, 0, __pyx_n_s_Cluster_register_user_type, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__179)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_register_user_type, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":678
 *         UserType.evict_udt_class(keyspace, user_type)
 * 
 *     def get_min_requests_per_connection(self, host_distance):             # <<<<<<<<<<<<<<
 *         return self._min_requests_per_connection[host_distance]
 * 
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_9get_min_requests_per_connection, 0, __pyx_n_s_Cluster_get_min_requests_per_con, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__181)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_get_min_requests_per_connection, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":681
 *         return self._min_requests_per_connection[host_distance]
 * 
 *     def set_min_requests_per_connection(self, host_distance, min_requests):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a threshold for concurrent requests per connection, below which
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_11set_min_requests_per_connection, 0, __pyx_n_s_Cluster_set_min_requests_per_con_2, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__183)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_set_min_requests_per_connection, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":695
 *         self._min_requests_per_connection[host_distance] = min_requests
 * 
 *     def get_max_requests_per_connection(self, host_distance):             # <<<<<<<<<<<<<<
 *         return self._max_requests_per_connection[host_distance]
 * 
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_13get_max_requests_per_connection, 0, __pyx_n_s_Cluster_get_max_requests_per_con, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__185)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_get_max_requests_per_connection, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":698
 *         return self._max_requests_per_connection[host_distance]
 * 
 *     def set_max_requests_per_connection(self, host_distance, max_requests):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a threshold for concurrent requests per connection, above which new
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_15set_max_requests_per_connection, 0, __pyx_n_s_Cluster_set_max_requests_per_con_2, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__187)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_set_max_requests_per_connection, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":712
 *         self._max_requests_per_connection[host_distance] = max_requests
 * 
 *     def get_core_connections_per_host(self, host_distance):             # <<<<<<<<<<<<<<
 *         """
 *         Gets the minimum number of connections per Session that will be opened
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_17get_core_connections_per_host, 0, __pyx_n_s_Cluster_get_core_connections_per, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__189)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_get_core_connections_per_host, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":724
 *         return self._core_connections_per_host[host_distance]
 * 
 *     def set_core_connections_per_host(self, host_distance, core_connections):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the minimum number of connections per Session that will be opened
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_19set_core_connections_per_host, 0, __pyx_n_s_Cluster_set_core_connections_per_2, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__191)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_set_core_connections_per_host, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":749
 *             self._ensure_core_connections()
 * 
 *     def get_max_connections_per_host(self, host_distance):             # <<<<<<<<<<<<<<
 *         """
 *         Gets the maximum number of connections per Session that will be opened
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_21get_max_connections_per_host, 0, __pyx_n_s_Cluster_get_max_connections_per, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__193)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_get_max_connections_per_host, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":761
 *         return self._max_connections_per_host[host_distance]
 * 
 *     def set_max_connections_per_host(self, host_distance, max_connections):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the maximum number of connections per Session that will be opened
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_23set_max_connections_per_host, 0, __pyx_n_s_Cluster_set_max_connections_per_2, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__195)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_set_max_connections_per_host, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":779
 *         self._max_connections_per_host[host_distance] = max_connections
 * 
 *     def connection_factory(self, address, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Called to create a new connection with proper configuration.
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_25connection_factory, 0, __pyx_n_s_Cluster_connection_factory, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__197)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_connection_factory, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":787
 *         return self.connection_class.factory(address, self.connect_timeout, *args, **kwargs)
 * 
 *     def _make_connection_factory(self, host, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         kwargs = self._make_connection_kwargs(host.address, kwargs)
 *         return partial(self.connection_class.factory, host.address, self.connect_timeout, *args, **kwargs)
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_27_make_connection_factory, 0, __pyx_n_s_Cluster__make_connection_factory, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__199)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_make_connection_factory, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":791
 *         return partial(self.connection_class.factory, host.address, self.connect_timeout, *args, **kwargs)
 * 
 *     def _make_connection_kwargs(self, address, kwargs_dict):             # <<<<<<<<<<<<<<
 *         if self._auth_provider_callable:
 *             kwargs_dict.setdefault('authenticator', self._auth_provider_callable(address))
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_29_make_connection_kwargs, 0, __pyx_n_s_Cluster__make_connection_kwargs, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__201)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_make_connection_kwargs, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":805
 *         return kwargs_dict
 * 
 *     def protocol_downgrade(self, host_addr, previous_version):             # <<<<<<<<<<<<<<
 *         new_version = previous_version - 1
 *         if new_version < self.protocol_version:
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_31protocol_downgrade, 0, __pyx_n_s_Cluster_protocol_downgrade, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__203)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_protocol_downgrade, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":814
 *                 raise Exception("Cannot downgrade protocol version (%d) below minimum supported version: %d" % (new_version, MIN_SUPPORTED_VERSION))
 * 
 *     def connect(self, keyspace=None):             # <<<<<<<<<<<<<<
 *         """
 *         Creates and returns a new :class:`~.Session` object.  If `keyspace`
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_33connect, 0, __pyx_n_s_Cluster_connect, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__205)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_tuple__206);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_connect, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":859
 *         return session
 * 
 *     def get_connection_holders(self):             # <<<<<<<<<<<<<<
 *         holders = []
 *         for s in self.sessions:
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_35get_connection_holders, 0, __pyx_n_s_Cluster_get_connection_holders, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__208)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_get_connection_holders, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":866
 *         return holders
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         """
 *         Closes all sessions and connection associated with this Cluster.
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_37shutdown, 0, __pyx_n_s_Cluster_shutdown, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__210)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_shutdown, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":892
 *         self.executor.shutdown()
 * 
 *     def _new_session(self):             # <<<<<<<<<<<<<<
 *         session = Session(self, self.metadata.all_hosts())
 *         for keyspace, type_map in six.iteritems(self._user_types):
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_39_new_session, 0, __pyx_n_s_Cluster__new_session, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__212)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_new_session, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":900
 *         return session
 * 
 *     def _cleanup_failed_on_up_handling(self, host):             # <<<<<<<<<<<<<<
 *         self.load_balancing_policy.on_down(host)
 *         self.control_connection.on_down(host)
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_41_cleanup_failed_on_up_handling, 0, __pyx_n_s_Cluster__cleanup_failed_on_up_ha, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__214)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_cleanup_failed_on_up_handling, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":908
 *         self._start_reconnector(host, is_host_addition=False)
 * 
 *     def _on_up_future_completed(self, host, futures, results, lock, finished_future):             # <<<<<<<<<<<<<<
 *         with lock:
 *             futures.discard(finished_future)
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_43_on_up_future_completed, 0, __pyx_n_s_Cluster__on_up_future_completed, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__216)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_up_future_completed, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":945
 *             session.update_created_pools()
 * 
 *     def on_up(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Intended for internal use only.
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_45on_up, 0, __pyx_n_s_Cluster_on_up, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__218)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_up, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1015
 *         return futures
 * 
 *     def _start_reconnector(self, host, is_host_addition):             # <<<<<<<<<<<<<<
 *         if self.load_balancing_policy.distance(host) == HostDistance.IGNORED:
 *             return
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_47_start_reconnector, 0, __pyx_n_s_Cluster__start_reconnector, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__220)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_start_reconnector, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1039
 *         reconnector.start()
 * 
 *     @run_in_executor             # <<<<<<<<<<<<<<
 *     def on_down(self, host, is_host_addition, expect_host_to_be_down=False):
 *         """
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_run_in_executor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "cassandra/cluster.py":1040
 * 
 *     @run_in_executor
 *     def on_down(self, host, is_host_addition, expect_host_to_be_down=False):             # <<<<<<<<<<<<<<
 *         """
 *         Intended for internal use only.
 */
  __pyx_t_13 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_49on_down, 0, __pyx_n_s_Cluster_on_down, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__222)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_13, __pyx_tuple__223);
  __pyx_t_8 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_8) {
    __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_GOTREF(__pyx_t_11);
  } else {
    __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8); __pyx_t_8 = NULL;
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_13);
    __pyx_t_13 = 0;
    __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_12, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_down, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1065
 *         self._start_reconnector(host, is_host_addition)
 * 
 *     def on_add(self, host, refresh_nodes=True):             # <<<<<<<<<<<<<<
 *         if self.is_shutdown:
 *             return
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_51on_add, 0, __pyx_n_s_Cluster_on_add, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__225)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_tuple__226);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_add, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1124
 *             self._finalize_add(host)
 * 
 *     def _finalize_add(self, host):             # <<<<<<<<<<<<<<
 *         # mark the host as up and notify all listeners
 *         host.set_up()
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_53_finalize_add, 0, __pyx_n_s_Cluster__finalize_add, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__228)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_finalize_add, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1134
 *             session.update_created_pools()
 * 
 *     def on_remove(self, host):             # <<<<<<<<<<<<<<
 *         if self.is_shutdown:
 *             return
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_55on_remove, 0, __pyx_n_s_Cluster_on_remove, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__230)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_remove, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1147
 *         self.control_connection.on_remove(host)
 * 
 *     def signal_connection_failure(self, host, connection_exc, is_host_addition, expect_host_to_be_down=False):             # <<<<<<<<<<<<<<
 *         is_down = host.signal_connection_failure(connection_exc)
 *         if is_down:
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_57signal_connection_failure, 0, __pyx_n_s_Cluster_signal_connection_failur, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__232)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_tuple__233);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_signal_connection_failure, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1153
 *         return is_down
 * 
 *     def add_host(self, address, datacenter=None, rack=None, signal=True, refresh_nodes=True):             # <<<<<<<<<<<<<<
 *         """
 *         Called when adding initial contact points and when the control
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_59add_host, 0, __pyx_n_s_Cluster_add_host, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__235)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_tuple__236);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_add_host, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1168
 *         return host, new
 * 
 *     def remove_host(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Called when the control connection observes that a node has left the
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_61remove_host, 0, __pyx_n_s_Cluster_remove_host, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__238)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_remove_host, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1177
 *             self.on_remove(host)
 * 
 *     def register_listener(self, listener):             # <<<<<<<<<<<<<<
 *         """
 *         Adds a :class:`cassandra.policies.HostStateListener` subclass instance to
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_63register_listener, 0, __pyx_n_s_Cluster_register_listener, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__240)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_register_listener, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1186
 *             self._listeners.add(listener)
 * 
 *     def unregister_listener(self, listener):             # <<<<<<<<<<<<<<
 *         """ Removes a registered listener. """
 *         with self._listener_lock:
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_65unregister_listener, 0, __pyx_n_s_Cluster_unregister_listener, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__242)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_unregister_listener, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1192
 * 
 *     @property
 *     def listeners(self):             # <<<<<<<<<<<<<<
 *         with self._listener_lock:
 *             return self._listeners.copy()
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_67listeners, 0, __pyx_n_s_Cluster_listeners, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__244)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);

  /* "cassandra/cluster.py":1191
 *             self._listeners.remove(listener)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def listeners(self):
 *         with self._listener_lock:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_11);
  __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_1, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_listeners_2, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1196
 *             return self._listeners.copy()
 * 
 *     def _ensure_core_connections(self):             # <<<<<<<<<<<<<<
 *         """
 *         If any host has fewer than the configured number of core connections
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_69_ensure_core_connections, 0, __pyx_n_s_Cluster__ensure_core_connections, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__246)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_ensure_core_connections, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1205
 *                 pool.ensure_core_connections()
 * 
 *     def _validate_refresh_schema(self, keyspace, table, usertype, function, aggregate):             # <<<<<<<<<<<<<<
 *         if any((table, usertype, function, aggregate)):
 *             if not keyspace:
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_71_validate_refresh_schema, 0, __pyx_n_s_Cluster__validate_refresh_schema_2, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__248)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_validate_refresh_schema, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1212
 *                 raise ValueError("{table, usertype, function, aggregate} are mutually exclusive")
 * 
 *     def refresh_schema(self, keyspace=None, table=None, usertype=None, function=None, aggregate=None, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         .. deprecated:: 2.6.0
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_73refresh_schema, 0, __pyx_n_s_Cluster_refresh_schema, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__250)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_tuple__251);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_refresh_schema, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1250
 *             raise Exception("Schema was not refreshed. See log for details.")
 * 
 *     def submit_schema_refresh(self, keyspace=None, table=None, usertype=None, function=None, aggregate=None):             # <<<<<<<<<<<<<<
 *         """
 *         .. deprecated:: 2.6.0
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_75submit_schema_refresh, 0, __pyx_n_s_Cluster_submit_schema_refresh, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__253)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_tuple__254);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_submit_schema_refresh, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1266
 *             self.control_connection.refresh_schema, keyspace, table, usertype, function, aggregate)
 * 
 *     def refresh_schema_metadata(self, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh all schema metadata.
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_77refresh_schema_metadata, 0, __pyx_n_s_Cluster_refresh_schema_metadata, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__256)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_tuple__257);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_refresh_schema_metadata, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1282
 *             raise Exception("Schema metadata was not refreshed. See log for details.")
 * 
 *     def refresh_keyspace_metadata(self, keyspace, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh keyspace metadata. This applies to keyspace-level information such as replication
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_79refresh_keyspace_metadata, 0, __pyx_n_s_Cluster_refresh_keyspace_metadat, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__259)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_tuple__260);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_refresh_keyspace_metadata, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1292
 *             raise Exception("Keyspace metadata was not refreshed. See log for details.")
 * 
 *     def refresh_table_metadata(self, keyspace, table, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh table metadata. This applies to a table, and any triggers or indexes attached
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_81refresh_table_metadata, 0, __pyx_n_s_Cluster_refresh_table_metadata, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__262)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_tuple__263);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_refresh_table_metadata, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1302
 *             raise Exception("Table metadata was not refreshed. See log for details.")
 * 
 *     def refresh_user_type_metadata(self, keyspace, user_type, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh user defined type metadata.
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_83refresh_user_type_metadata, 0, __pyx_n_s_Cluster_refresh_user_type_metada, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__265)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_tuple__266);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_refresh_user_type_metadata, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1311
 *             raise Exception("User Type metadata was not refreshed. See log for details.")
 * 
 *     def refresh_user_function_metadata(self, keyspace, function, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh user defined function metadata.
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_85refresh_user_function_metadata, 0, __pyx_n_s_Cluster_refresh_user_function_me, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__268)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_tuple__269);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_refresh_user_function_metadata, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1322
 *             raise Exception("User Function metadata was not refreshed. See log for details.")
 * 
 *     def refresh_user_aggregate_metadata(self, keyspace, aggregate, max_schema_agreement_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh user defined aggregate metadata.
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_87refresh_user_aggregate_metadata, 0, __pyx_n_s_Cluster_refresh_user_aggregate_m, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__271)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_11, __pyx_tuple__272);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_refresh_user_aggregate_metadata, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1333
 *             raise Exception("User Aggregate metadata was not refreshed. See log for details.")
 * 
 *     def refresh_nodes(self):             # <<<<<<<<<<<<<<
 *         """
 *         Synchronously refresh the node list and token metadata
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_89refresh_nodes, 0, __pyx_n_s_Cluster_refresh_nodes, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__274)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_refresh_nodes, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1342
 *             raise Exception("Node list was not refreshed. See log for details.")
 * 
 *     def set_meta_refresh_enabled(self, enabled):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a flag to enable (True) or disable (False) all metadata refresh queries.
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_91set_meta_refresh_enabled, 0, __pyx_n_s_Cluster_set_meta_refresh_enabled, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__276)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_set_meta_refresh_enabled, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1354
 *         self.control_connection.set_meta_refresh_enabled(bool(enabled))
 * 
 *     def _prepare_all_queries(self, host):             # <<<<<<<<<<<<<<
 *         if not self._prepared_statements:
 *             return
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_93_prepare_all_queries, 0, __pyx_n_s_Cluster__prepare_all_queries, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__278)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_prepare_all_queries, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1399
 *                 connection.close()
 * 
 *     def prepare_on_all_sessions(self, query_id, prepared_statement, excluded_host):             # <<<<<<<<<<<<<<
 *         with self._prepared_statement_lock:
 *             self._prepared_statements[query_id] = prepared_statement
 */
  __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Cluster_95prepare_on_all_sessions, 0, __pyx_n_s_Cluster_prepare_on_all_sessions, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__280)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_prepare_on_all_sessions, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":185
 * 
 * 
 * class Cluster(object):             # <<<<<<<<<<<<<<
 *     """
 *     The main class to use when interacting with a Cassandra cluster.
 */
  __pyx_t_11 = __Pyx_Py3ClassCreate(__pyx_t_9, __pyx_n_s_Cluster, __pyx_t_2, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Cluster, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1406
 * 
 * 
 * class Session(object):             # <<<<<<<<<<<<<<
 *     """
 *     A collection of connection pools for each host in the cluster.
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_object);
  __pyx_t_9 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_9, __pyx_t_2, __pyx_n_s_Session, __pyx_n_s_Session, (PyObject *) NULL, __pyx_n_s_cassandra_cluster, __pyx_kp_s_A_collection_of_connection_pool); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "cassandra/cluster.py":1424
 *     """
 * 
 *     cluster = None             # <<<<<<<<<<<<<<
 *     hosts = None
 *     keyspace = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_cluster, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1425
 * 
 *     cluster = None
 *     hosts = None             # <<<<<<<<<<<<<<
 *     keyspace = None
 *     is_shutdown = False
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_hosts, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1426
 *     cluster = None
 *     hosts = None
 *     keyspace = None             # <<<<<<<<<<<<<<
 *     is_shutdown = False
 * 
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_keyspace, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1427
 *     hosts = None
 *     keyspace = None
 *     is_shutdown = False             # <<<<<<<<<<<<<<
 * 
 *     row_factory = staticmethod(named_tuple_factory)
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_is_shutdown, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1429
 *     is_shutdown = False
 * 
 *     row_factory = staticmethod(named_tuple_factory)             # <<<<<<<<<<<<<<
 *     """
 *     The format to return row results in.  By default, each
 */
  __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_named_tuple_factory); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_11);
  __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_1, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_row_factory, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cassandra/cluster.py":1442
 *     """
 * 
 *     default_timeout = 10.0             # <<<<<<<<<<<<<<
 *     """
 *     A default timeout, measured in seconds, for queries executed through
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_default_timeout, __pyx_float_10_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1456
 *     """
 * 
 *     default_consistency_level = ConsistencyLevel.ONE             # <<<<<<<<<<<<<<
 *     """
 *     The default :class:`~ConsistencyLevel` for operations executed through
 */
  __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConsistencyLevel); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_ONE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_default_consistency_level, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1465
 *     """
 * 
 *     max_trace_wait = 2.0             # <<<<<<<<<<<<<<
 *     """
 *     The maximum amount of time (in seconds) the driver will wait for trace
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_max_trace_wait, __pyx_float_2_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1475
 *     :attr:`.Statement.trace` will be left as :const:`None`. """
 * 
 *     default_fetch_size = 5000             # <<<<<<<<<<<<<<
 *     """
 *     By default, this many rows will be fetched at a time. Setting
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_default_fetch_size, __pyx_int_5000) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1488
 *     """
 * 
 *     use_client_timestamp = True             # <<<<<<<<<<<<<<
 *     """
 *     When using protocol version 3 or higher, write timestamps may be supplied
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_use_client_timestamp, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1498
 *     """
 * 
 *     encoder = None             # <<<<<<<<<<<<<<
 *     """
 *     A :class:`~cassandra.encoder.Encoder` instance that will be used when
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_encoder, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1524
 *     """
 * 
 *     client_protocol_handler = ProtocolHandler             # <<<<<<<<<<<<<<
 *     """
 *     Specifies a protocol handler that will be used for client-initiated requests (i.e. no
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProtocolHandler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_client_protocol_handler, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1538
 *     """
 * 
 *     _lock = None             # <<<<<<<<<<<<<<
 *     _pools = None
 *     _load_balancer = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_lock, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1539
 * 
 *     _lock = None
 *     _pools = None             # <<<<<<<<<<<<<<
 *     _load_balancer = None
 *     _metrics = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_pools, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1540
 *     _lock = None
 *     _pools = None
 *     _load_balancer = None             # <<<<<<<<<<<<<<
 *     _metrics = None
 * 
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_load_balancer, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1541
 *     _pools = None
 *     _load_balancer = None
 *     _metrics = None             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, cluster, hosts):
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_metrics_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":1543
 *     _metrics = None
 * 
 *     def __init__(self, cluster, hosts):             # <<<<<<<<<<<<<<
 *         self.cluster = cluster
 *         self.hosts = hosts
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_1__init__, 0, __pyx_n_s_Session___init, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__282)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1565
 *             future.result()
 * 
 *     def execute(self, query, parameters=None, timeout=_NOT_SET, trace=False, custom_payload=None):             # <<<<<<<<<<<<<<
 *         """
 *         Execute the given query and synchronously wait for the response.
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_3execute, 0, __pyx_n_s_Session_execute, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__284)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults1), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOT_SET); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_1)->__pyx_arg_timeout = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;
  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_9cassandra_7cluster_7Session_36__defaults__);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_execute, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1615
 *         return result
 * 
 *     def execute_async(self, query, parameters=None, trace=False, custom_payload=None, timeout=_NOT_SET):             # <<<<<<<<<<<<<<
 *         """
 *         Execute the given query and return a :class:`~.ResponseFuture` object
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_5execute_async, 0, __pyx_n_s_Session_execute_async, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__286)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults2), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOT_SET); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_t_1)->__pyx_arg_timeout = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;
  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_9cassandra_7cluster_7Session_38__defaults__);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_execute_async, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1668
 *         return future
 * 
 *     def _create_response_future(self, query, parameters, trace, custom_payload, timeout):             # <<<<<<<<<<<<<<
 *         """ Returns the ResponseFuture before calling send_request() on it """
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_7_create_response_future, 0, __pyx_n_s_Session__create_response_future, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__288)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_create_response_future, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1725
 *             prepared_statement=prepared_statement)
 * 
 *     def prepare(self, query, custom_payload=None):             # <<<<<<<<<<<<<<
 *         """
 *         Prepares a query string, returning a :class:`~cassandra.query.PreparedStatement`
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_9prepare, 0, __pyx_n_s_Session_prepare, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__290)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__291);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_prepare_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1776
 *         return prepared_statement
 * 
 *     def prepare_on_all_hosts(self, query, excluded_host):             # <<<<<<<<<<<<<<
 *         """
 *         Prepare the given query on all hosts, excluding ``excluded_host``.
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_11prepare_on_all_hosts, 0, __pyx_n_s_Session_prepare_on_all_hosts, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__293)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_prepare_on_all_hosts, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1809
 *                 log.exception("Error preparing query for host %s:", host)
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         """
 *         Close all connections.  ``Session`` instances should not be used
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_13shutdown, 0, __pyx_n_s_Session_shutdown, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__295)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_shutdown, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1823
 *             pool.shutdown()
 * 
 *     def add_or_renew_pool(self, host, is_host_addition):             # <<<<<<<<<<<<<<
 *         """
 *         For internal use only.
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_15add_or_renew_pool, 0, __pyx_n_s_Session_add_or_renew_pool, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__297)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_add_or_renew_pool, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1860
 *         return self.submit(run_add_or_renew_pool)
 * 
 *     def remove_pool(self, host):             # <<<<<<<<<<<<<<
 *         pool = self._pools.pop(host, None)
 *         if pool:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_17remove_pool, 0, __pyx_n_s_Session_remove_pool, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__299)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_remove_pool, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1868
 *             return None
 * 
 *     def update_created_pools(self):             # <<<<<<<<<<<<<<
 *         """
 *         When the set of live nodes change, the loadbalancer will change its
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_19update_created_pools, 0, __pyx_n_s_Session_update_created_pools, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__301)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_update_created_pools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1894
 *                     pool.host_distance = distance
 * 
 *     def on_down(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the parent Cluster instance when a node is marked down.
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_21on_down, 0, __pyx_n_s_Session_on_down, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__303)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_down, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1903
 *             future.add_done_callback(lambda f: self.update_created_pools())
 * 
 *     def on_remove(self, host):             # <<<<<<<<<<<<<<
 *         """ Internal """
 *         self.on_down(host)
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_23on_remove, 0, __pyx_n_s_Session_on_remove, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__305)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_remove, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1907
 *         self.on_down(host)
 * 
 *     def set_keyspace(self, keyspace):             # <<<<<<<<<<<<<<
 *         """
 *         Set the default keyspace for all queries made through this Session.
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_25set_keyspace, 0, __pyx_n_s_Session_set_keyspace, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__307)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_set_keyspace, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1914
 *         self.execute('USE %s' % (protect_name(keyspace),))
 * 
 *     def _set_keyspace_for_all_pools(self, keyspace, callback):             # <<<<<<<<<<<<<<
 *         """
 *         Asynchronously sets the keyspace on all pools.  When all
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_27_set_keyspace_for_all_pools, 0, __pyx_n_s_Session__set_keyspace_for_all_po_2, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__309)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_set_keyspace_for_all_pools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1941
 *             pool._set_keyspace_for_all_conns(keyspace, pool_finished_setting_keyspace)
 * 
 *     def user_type_registered(self, keyspace, user_type, klass):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the parent Cluster instance when the user registers a new
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_29user_type_registered, 0, __pyx_n_s_Session_user_type_registered, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__311)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_user_type_registered, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1967
 *         self.encoder.mapping[klass] = encode
 * 
 *     def submit(self, fn, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """ Internal """
 *         if not self.is_shutdown:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_31submit, 0, __pyx_n_s_Session_submit, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__313)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_submit, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1972
 *             return self.cluster.executor.submit(fn, *args, **kwargs)
 * 
 *     def get_pool_state(self):             # <<<<<<<<<<<<<<
 *         return dict((host, pool.get_state()) for host, pool in self._pools.items())
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_33get_pool_state, 0, __pyx_n_s_Session_get_pool_state, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__315)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_get_pool_state, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1975
 *         return dict((host, pool.get_state()) for host, pool in self._pools.items())
 * 
 *     def get_pools(self):             # <<<<<<<<<<<<<<
 *         return self._pools.values()
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_7Session_35get_pools, 0, __pyx_n_s_Session_get_pools, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__317)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_get_pools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1406
 * 
 * 
 * class Session(object):             # <<<<<<<<<<<<<<
 *     """
 *     A collection of connection pools for each host in the cluster.
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_9, __pyx_n_s_Session, __pyx_t_2, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Session, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1979
 * 
 * 
 * class UserTypeDoesNotExist(Exception):             # <<<<<<<<<<<<<<
 *     """
 *     An attempt was made to use a user-defined type that does not exist.
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception);
  __pyx_t_9 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_9, __pyx_t_2, __pyx_n_s_UserTypeDoesNotExist, __pyx_n_s_UserTypeDoesNotExist, (PyObject *) NULL, __pyx_n_s_cassandra_cluster, __pyx_kp_s_An_attempt_was_made_to_use_a_us); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_9, __pyx_n_s_UserTypeDoesNotExist, __pyx_t_2, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_UserTypeDoesNotExist, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cassandra/cluster.py":1988
 * 
 * 
 * class _ControlReconnectionHandler(_ReconnectionHandler):             # <<<<<<<<<<<<<<
 *     """
 *     Internal
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ReconnectionHandler); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_9, __pyx_n_s_ControlReconnectionHandler, __pyx_n_s_ControlReconnectionHandler, (PyObject *) NULL, __pyx_n_s_cassandra_cluster, __pyx_kp_s_Internal); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "cassandra/cluster.py":1993
 *     """
 * 
 *     def __init__(self, control_connection, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         _ReconnectionHandler.__init__(self, *args, **kwargs)
 *         self.control_connection = weakref.proxy(control_connection)
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_27_ControlReconnectionHandler_1__init__, 0, __pyx_n_s_ControlReconnectionHandler___in, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__319)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1997
 *         self.control_connection = weakref.proxy(control_connection)
 * 
 *     def try_reconnect(self):             # <<<<<<<<<<<<<<
 *         # we'll either get back a new Connection or a NoHostAvailable
 *         return self.control_connection._reconnect_internal()
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_27_ControlReconnectionHandler_3try_reconnect, 0, __pyx_n_s_ControlReconnectionHandler_try, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__321)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_try_reconnect, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2001
 *         return self.control_connection._reconnect_internal()
 * 
 *     def on_reconnection(self, connection):             # <<<<<<<<<<<<<<
 *         self.control_connection._set_new_connection(connection)
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_27_ControlReconnectionHandler_5on_reconnection, 0, __pyx_n_s_ControlReconnectionHandler_on_r, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__323)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_reconnection, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2004
 *         self.control_connection._set_new_connection(connection)
 * 
 *     def on_exception(self, exc, next_delay):             # <<<<<<<<<<<<<<
 *         # TODO only overridden to add logging, so add logging
 *         if isinstance(exc, AuthenticationFailed):
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_27_ControlReconnectionHandler_7on_exception, 0, __pyx_n_s_ControlReconnectionHandler_on_e, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__325)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_exception, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":1988
 * 
 * 
 * class _ControlReconnectionHandler(_ReconnectionHandler):             # <<<<<<<<<<<<<<
 *     """
 *     Internal
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_ControlReconnectionHandler, __pyx_t_9, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ControlReconnectionHandler, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cassandra/cluster.py":2013
 * 
 * 
 * def _watch_callback(obj_weakref, method_name, *args, **kwargs):             # <<<<<<<<<<<<<<
 *     """
 *     A callback handler for the ControlConnection that tolerates
 */
  __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_15_watch_callback, 0, __pyx_n_s_watch_callback, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__327)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_watch_callback, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cassandra/cluster.py":2024
 * 
 * 
 * def _clear_watcher(conn, expiring_weakref):             # <<<<<<<<<<<<<<
 *     """
 *     Called when the ControlConnection object is about to be finalized.
 */
  __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17_clear_watcher, 0, __pyx_n_s_clear_watcher, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__329)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_clear_watcher, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cassandra/cluster.py":2035
 * 
 * 
 * class ControlConnection(object):             # <<<<<<<<<<<<<<
 *     """
 *     Internal
 */
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_builtin_object);
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_9, __pyx_n_s_ControlConnection, __pyx_n_s_ControlConnection, (PyObject *) NULL, __pyx_n_s_cassandra_cluster, __pyx_kp_s_Internal); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "cassandra/cluster.py":2040
 *     """
 * 
 *     _SELECT_KEYSPACES = "SELECT * FROM system.schema_keyspaces"             # <<<<<<<<<<<<<<
 *     _SELECT_COLUMN_FAMILIES = "SELECT * FROM system.schema_columnfamilies"
 *     _SELECT_COLUMNS = "SELECT * FROM system.schema_columns"
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_SELECT_KEYSPACES, __pyx_kp_s_SELECT_FROM_system_schema_keyspa) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2041
 * 
 *     _SELECT_KEYSPACES = "SELECT * FROM system.schema_keyspaces"
 *     _SELECT_COLUMN_FAMILIES = "SELECT * FROM system.schema_columnfamilies"             # <<<<<<<<<<<<<<
 *     _SELECT_COLUMNS = "SELECT * FROM system.schema_columns"
 *     _SELECT_USERTYPES = "SELECT * FROM system.schema_usertypes"
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_SELECT_COLUMN_FAMILIES, __pyx_kp_s_SELECT_FROM_system_schema_column) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2042
 *     _SELECT_KEYSPACES = "SELECT * FROM system.schema_keyspaces"
 *     _SELECT_COLUMN_FAMILIES = "SELECT * FROM system.schema_columnfamilies"
 *     _SELECT_COLUMNS = "SELECT * FROM system.schema_columns"             # <<<<<<<<<<<<<<
 *     _SELECT_USERTYPES = "SELECT * FROM system.schema_usertypes"
 *     _SELECT_FUNCTIONS = "SELECT * FROM system.schema_functions"
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_SELECT_COLUMNS, __pyx_kp_s_SELECT_FROM_system_schema_column_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2043
 *     _SELECT_COLUMN_FAMILIES = "SELECT * FROM system.schema_columnfamilies"
 *     _SELECT_COLUMNS = "SELECT * FROM system.schema_columns"
 *     _SELECT_USERTYPES = "SELECT * FROM system.schema_usertypes"             # <<<<<<<<<<<<<<
 *     _SELECT_FUNCTIONS = "SELECT * FROM system.schema_functions"
 *     _SELECT_AGGREGATES = "SELECT * FROM system.schema_aggregates"
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_SELECT_USERTYPES, __pyx_kp_s_SELECT_FROM_system_schema_userty) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2044
 *     _SELECT_COLUMNS = "SELECT * FROM system.schema_columns"
 *     _SELECT_USERTYPES = "SELECT * FROM system.schema_usertypes"
 *     _SELECT_FUNCTIONS = "SELECT * FROM system.schema_functions"             # <<<<<<<<<<<<<<
 *     _SELECT_AGGREGATES = "SELECT * FROM system.schema_aggregates"
 *     _SELECT_TRIGGERS = "SELECT * FROM system.schema_triggers"
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_SELECT_FUNCTIONS, __pyx_kp_s_SELECT_FROM_system_schema_functi) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2045
 *     _SELECT_USERTYPES = "SELECT * FROM system.schema_usertypes"
 *     _SELECT_FUNCTIONS = "SELECT * FROM system.schema_functions"
 *     _SELECT_AGGREGATES = "SELECT * FROM system.schema_aggregates"             # <<<<<<<<<<<<<<
 *     _SELECT_TRIGGERS = "SELECT * FROM system.schema_triggers"
 * 
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_SELECT_AGGREGATES, __pyx_kp_s_SELECT_FROM_system_schema_aggreg) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2046
 *     _SELECT_FUNCTIONS = "SELECT * FROM system.schema_functions"
 *     _SELECT_AGGREGATES = "SELECT * FROM system.schema_aggregates"
 *     _SELECT_TRIGGERS = "SELECT * FROM system.schema_triggers"             # <<<<<<<<<<<<<<
 * 
 *     _SELECT_PEERS = "SELECT peer, data_center, rack, tokens, rpc_address, schema_version FROM system.peers"
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_SELECT_TRIGGERS, __pyx_kp_s_SELECT_FROM_system_schema_trigge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2048
 *     _SELECT_TRIGGERS = "SELECT * FROM system.schema_triggers"
 * 
 *     _SELECT_PEERS = "SELECT peer, data_center, rack, tokens, rpc_address, schema_version FROM system.peers"             # <<<<<<<<<<<<<<
 *     _SELECT_LOCAL = "SELECT cluster_name, data_center, rack, tokens, partitioner, schema_version FROM system.local WHERE key='local'"
 * 
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_SELECT_PEERS, __pyx_kp_s_SELECT_peer_data_center_rack_tok) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2049
 * 
 *     _SELECT_PEERS = "SELECT peer, data_center, rack, tokens, rpc_address, schema_version FROM system.peers"
 *     _SELECT_LOCAL = "SELECT cluster_name, data_center, rack, tokens, partitioner, schema_version FROM system.local WHERE key='local'"             # <<<<<<<<<<<<<<
 * 
 *     _SELECT_SCHEMA_PEERS = "SELECT peer, rpc_address, schema_version FROM system.peers"
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_SELECT_LOCAL, __pyx_kp_s_SELECT_cluster_name_data_center) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2051
 *     _SELECT_LOCAL = "SELECT cluster_name, data_center, rack, tokens, partitioner, schema_version FROM system.local WHERE key='local'"
 * 
 *     _SELECT_SCHEMA_PEERS = "SELECT peer, rpc_address, schema_version FROM system.peers"             # <<<<<<<<<<<<<<
 *     _SELECT_SCHEMA_LOCAL = "SELECT schema_version FROM system.local WHERE key='local'"
 * 
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_SELECT_SCHEMA_PEERS, __pyx_kp_s_SELECT_peer_rpc_address_schema_v) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2052
 * 
 *     _SELECT_SCHEMA_PEERS = "SELECT peer, rpc_address, schema_version FROM system.peers"
 *     _SELECT_SCHEMA_LOCAL = "SELECT schema_version FROM system.local WHERE key='local'"             # <<<<<<<<<<<<<<
 * 
 *     _is_shutdown = False
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_SELECT_SCHEMA_LOCAL, __pyx_kp_s_SELECT_schema_version_FROM_syste) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2054
 *     _SELECT_SCHEMA_LOCAL = "SELECT schema_version FROM system.local WHERE key='local'"
 * 
 *     _is_shutdown = False             # <<<<<<<<<<<<<<
 *     _timeout = None
 *     _protocol_version = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_is_shutdown_2, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2055
 * 
 *     _is_shutdown = False
 *     _timeout = None             # <<<<<<<<<<<<<<
 *     _protocol_version = None
 * 
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_timeout_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2056
 *     _is_shutdown = False
 *     _timeout = None
 *     _protocol_version = None             # <<<<<<<<<<<<<<
 * 
 *     _schema_event_refresh_window = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_protocol_version_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2058
 *     _protocol_version = None
 * 
 *     _schema_event_refresh_window = None             # <<<<<<<<<<<<<<
 *     _topology_event_refresh_window = None
 * 
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_schema_event_refresh_window_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2059
 * 
 *     _schema_event_refresh_window = None
 *     _topology_event_refresh_window = None             # <<<<<<<<<<<<<<
 * 
 *     _meta_refresh_enabled = True
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_topology_event_refresh_window_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2061
 *     _topology_event_refresh_window = None
 * 
 *     _meta_refresh_enabled = True             # <<<<<<<<<<<<<<
 * 
 *     # for testing purposes
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_meta_refresh_enabled, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2064
 * 
 *     # for testing purposes
 *     _time = time             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, cluster, timeout,
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_time_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2066
 *     _time = time
 * 
 *     def __init__(self, cluster, timeout,             # <<<<<<<<<<<<<<
 *                  schema_event_refresh_window,
 *                  topology_event_refresh_window):
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_1__init__, 0, __pyx_n_s_ControlConnection___init, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__331)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2086
 *         self._event_schedule_times = {}
 * 
 *     def connect(self):             # <<<<<<<<<<<<<<
 *         if self._is_shutdown:
 *             return
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_3connect, 0, __pyx_n_s_ControlConnection_connect, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__333)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_connect, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2093
 *         self._set_new_connection(self._reconnect_internal())
 * 
 *     def _set_new_connection(self, conn):             # <<<<<<<<<<<<<<
 *         """
 *         Replace existing connection (if there is one) and close it.
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_5_set_new_connection, 0, __pyx_n_s_ControlConnection__set_new_conne, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__335)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_set_new_connection, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2105
 *             old.close()
 * 
 *     def _reconnect_internal(self):             # <<<<<<<<<<<<<<
 *         """
 *         Tries to connect to each host in the query plan until one succeeds
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_7_reconnect_internal, 0, __pyx_n_s_ControlConnection__reconnect_int, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__337)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_reconnect_internal, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2128
 *         raise NoHostAvailable("Unable to connect to any servers", errors)
 * 
 *     def _try_connect(self, host):             # <<<<<<<<<<<<<<
 *         """
 *         Creates a new Connection, registers for pushed events, and refreshes
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_9_try_connect, 0, __pyx_n_s_ControlConnection__try_connect, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__339)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_try_connect, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2171
 *         return connection
 * 
 *     def reconnect(self):             # <<<<<<<<<<<<<<
 *         if self._is_shutdown:
 *             return
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_11reconnect, 0, __pyx_n_s_ControlConnection_reconnect, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__341)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_reconnect_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2177
 *         self._submit(self._reconnect)
 * 
 *     def _reconnect(self):             # <<<<<<<<<<<<<<
 *         log.debug("[control connection] Attempting to reconnect")
 *         try:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_13_reconnect, 0, __pyx_n_s_ControlConnection__reconnect, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__343)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_reconnect, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2203
 *             raise
 * 
 *     def _get_and_set_reconnection_handler(self, new_handler):             # <<<<<<<<<<<<<<
 *         """
 *         Called by the _ControlReconnectionHandler when a new connection
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_15_get_and_set_reconnection_handler, 0, __pyx_n_s_ControlConnection__get_and_set_r, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__345)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_get_and_set_reconnection_handle, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2214
 *             return old
 * 
 *     def _submit(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         try:
 *             if not self._cluster.is_shutdown:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_17_submit, 0, __pyx_n_s_ControlConnection__submit, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__347)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_submit_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2222
 *         return None
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         # stop trying to reconnect (if we are)
 *         with self._reconnection_lock:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_19shutdown, 0, __pyx_n_s_ControlConnection_shutdown, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__349)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_shutdown, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2239
 *                 del self._connection
 * 
 *     def refresh_schema(self, keyspace=None, table=None, usertype=None, function=None,             # <<<<<<<<<<<<<<
 *                        aggregate=None, schema_agreement_wait=None):
 *         if not self._meta_refresh_enabled:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_21refresh_schema, 0, __pyx_n_s_ControlConnection_refresh_schema, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__351)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__352);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_refresh_schema, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2256
 *         return False
 * 
 *     def _refresh_schema(self, connection, keyspace=None, table=None, usertype=None, function=None,             # <<<<<<<<<<<<<<
 *                         aggregate=None, preloaded_results=None, schema_agreement_wait=None):
 *         if self._cluster.is_shutdown:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_23_refresh_schema, 0, __pyx_n_s_ControlConnection__refresh_schem_3, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__354)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__355);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_refresh_schema_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2414
 *         return True
 * 
 *     def refresh_node_list_and_token_map(self, force_token_rebuild=False):             # <<<<<<<<<<<<<<
 *         if not self._meta_refresh_enabled:
 *             log.debug("[control connection] Skipping node list refresh because meta refresh is disabled")
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_25refresh_node_list_and_token_map, 0, __pyx_n_s_ControlConnection_refresh_node_l, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__357)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__358);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_refresh_node_list_and_token_map, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2430
 *         return False
 * 
 *     def _refresh_node_list_and_token_map(self, connection, preloaded_results=None,             # <<<<<<<<<<<<<<
 *                                          force_token_rebuild=False):
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_27_refresh_node_list_and_token_map, 0, __pyx_n_s_ControlConnection__refresh_node, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__361)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__362);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_refresh_node_list_and_token_map_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2510
 *             self._cluster.metadata.rebuild_token_map(partitioner, token_map)
 * 
 *     def _update_location_info(self, host, datacenter, rack):             # <<<<<<<<<<<<<<
 *         if host.datacenter == datacenter and host.rack == rack:
 *             return False
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_29_update_location_info, 0, __pyx_n_s_ControlConnection__update_locati, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__364)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_update_location_info, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2522
 *         return True
 * 
 *     def _delay_for_event_type(self, event_type, delay_window):             # <<<<<<<<<<<<<<
 *         # this serves to order processing correlated events (received within the window)
 *         # the window and randomization still have the desired effect of skew across client instances
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_31_delay_for_event_type, 0, __pyx_n_s_ControlConnection__delay_for_eve, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__366)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_delay_for_event_type, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2536
 *         return delay
 * 
 *     def _handle_topology_change(self, event):             # <<<<<<<<<<<<<<
 *         change_type = event["change_type"]
 *         addr, port = event["address"]
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_33_handle_topology_change, 0, __pyx_n_s_ControlConnection__handle_topolo, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__368)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_handle_topology_change, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2547
 *             self._cluster.scheduler.schedule_unique(0, self._cluster.remove_host, host)
 * 
 *     def _handle_status_change(self, event):             # <<<<<<<<<<<<<<
 *         change_type = event["change_type"]
 *         addr, port = event["address"]
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_35_handle_status_change, 0, __pyx_n_s_ControlConnection__handle_status, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__370)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_handle_status_change, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2567
 *                 self._cluster.on_down(host, is_host_addition=False)
 * 
 *     def _handle_schema_change(self, event):             # <<<<<<<<<<<<<<
 *         if self._schema_event_refresh_window < 0:
 *             return
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_37_handle_schema_change, 0, __pyx_n_s_ControlConnection__handle_schema, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__372)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_handle_schema_change, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2578
 *         self._cluster.scheduler.schedule_unique(delay, self.refresh_schema, keyspace, table, usertype, function, aggregate)
 * 
 *     def wait_for_schema_agreement(self, connection=None, preloaded_results=None, wait_time=None):             # <<<<<<<<<<<<<<
 * 
 *         total_timeout = wait_time if wait_time is not None else self._cluster.max_schema_agreement_wait
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_39wait_for_schema_agreement, 0, __pyx_n_s_ControlConnection_wait_for_schem, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__374)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__375);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_wait_for_schema_agreement, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2640
 *             return False
 * 
 *     def _get_schema_mismatches(self, peers_result, local_result, local_address):             # <<<<<<<<<<<<<<
 *         peers_result = dict_factory(*peers_result.results)
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_41_get_schema_mismatches, 0, __pyx_n_s_ControlConnection__get_schema_mi_2, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__377)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_get_schema_mismatches, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2668
 *         return dict((version, list(nodes)) for version, nodes in six.iteritems(versions))
 * 
 *     def _signal_error(self):             # <<<<<<<<<<<<<<
 *         with self._lock:
 *             if self._is_shutdown:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_43_signal_error, 0, __pyx_n_s_ControlConnection__signal_error, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__379)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_signal_error, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2688
 *         self.reconnect()
 * 
 *     def on_up(self, host):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_45on_up, 0, __pyx_n_s_ControlConnection_on_up, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__381)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_up, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2691
 *         pass
 * 
 *     def on_down(self, host):             # <<<<<<<<<<<<<<
 * 
 *         conn = self._connection
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_47on_down, 0, __pyx_n_s_ControlConnection_on_down, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__383)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_down, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2701
 *             self.reconnect()
 * 
 *     def on_add(self, host, refresh_nodes=True):             # <<<<<<<<<<<<<<
 *         if refresh_nodes:
 *             self.refresh_node_list_and_token_map(force_token_rebuild=True)
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_49on_add, 0, __pyx_n_s_ControlConnection_on_add, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__385)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__386);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_add, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2705
 *             self.refresh_node_list_and_token_map(force_token_rebuild=True)
 * 
 *     def on_remove(self, host):             # <<<<<<<<<<<<<<
 *         self.refresh_node_list_and_token_map(force_token_rebuild=True)
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_51on_remove, 0, __pyx_n_s_ControlConnection_on_remove, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__388)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_remove, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2708
 *         self.refresh_node_list_and_token_map(force_token_rebuild=True)
 * 
 *     def get_connections(self):             # <<<<<<<<<<<<<<
 *         c = getattr(self, '_connection', None)
 *         return [c] if c else []
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_53get_connections, 0, __pyx_n_s_ControlConnection_get_connection, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__390)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_get_connections, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2712
 *         return [c] if c else []
 * 
 *     def return_connection(self, connection):             # <<<<<<<<<<<<<<
 *         if connection is self._connection and (connection.is_defunct or connection.is_closed):
 *             self.reconnect()
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_55return_connection, 0, __pyx_n_s_ControlConnection_return_connect, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__392)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_return_connection, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2716
 *             self.reconnect()
 * 
 *     def set_meta_refresh_enabled(self, enabled):             # <<<<<<<<<<<<<<
 *         self._meta_refresh_enabled = enabled
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_17ControlConnection_57set_meta_refresh_enabled, 0, __pyx_n_s_ControlConnection_set_meta_refre, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__394)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_set_meta_refresh_enabled, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2035
 * 
 * 
 * class ControlConnection(object):             # <<<<<<<<<<<<<<
 *     """
 *     Internal
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_ControlConnection, __pyx_t_9, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ControlConnection, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cassandra/cluster.py":2720
 * 
 * 
 * def _stop_scheduler(scheduler, thread):             # <<<<<<<<<<<<<<
 *     try:
 *         if not scheduler.is_shutdown:
 */
  __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_19_stop_scheduler, 0, __pyx_n_s_stop_scheduler, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__396)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_stop_scheduler, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cassandra/cluster.py":2730
 * 
 * 
 * class _Scheduler(object):             # <<<<<<<<<<<<<<
 * 
 *     _queue = None
 */
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_builtin_object);
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_9, __pyx_n_s_Scheduler, __pyx_n_s_Scheduler, (PyObject *) NULL, __pyx_n_s_cassandra_cluster, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "cassandra/cluster.py":2732
 * class _Scheduler(object):
 * 
 *     _queue = None             # <<<<<<<<<<<<<<
 *     _scheduled_tasks = None
 *     _executor = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_queue, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2733
 * 
 *     _queue = None
 *     _scheduled_tasks = None             # <<<<<<<<<<<<<<
 *     _executor = None
 *     is_shutdown = False
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_scheduled_tasks, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2734
 *     _queue = None
 *     _scheduled_tasks = None
 *     _executor = None             # <<<<<<<<<<<<<<
 *     is_shutdown = False
 * 
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_executor_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2735
 *     _scheduled_tasks = None
 *     _executor = None
 *     is_shutdown = False             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, executor):
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_is_shutdown, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2737
 *     is_shutdown = False
 * 
 *     def __init__(self, executor):             # <<<<<<<<<<<<<<
 *         self._queue = Queue.PriorityQueue()
 *         self._scheduled_tasks = set()
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_10_Scheduler_1__init__, 0, __pyx_n_s_Scheduler___init, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__398)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2750
 *         atexit.register(partial(_stop_scheduler, weakref.proxy(self), t))
 * 
 *     def shutdown(self):             # <<<<<<<<<<<<<<
 *         try:
 *             log.debug("Shutting down Cluster Scheduler")
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_10_Scheduler_3shutdown, 0, __pyx_n_s_Scheduler_shutdown, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__400)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_shutdown, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2759
 *         self._queue.put_nowait((0, None))
 * 
 *     def schedule(self, delay, fn, *args):             # <<<<<<<<<<<<<<
 *         self._insert_task(delay, (fn, args))
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_10_Scheduler_5schedule, 0, __pyx_n_s_Scheduler_schedule, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__402)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_schedule, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2762
 *         self._insert_task(delay, (fn, args))
 * 
 *     def schedule_unique(self, delay, fn, *args):             # <<<<<<<<<<<<<<
 *         task = (fn, args)
 *         if task not in self._scheduled_tasks:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_10_Scheduler_7schedule_unique, 0, __pyx_n_s_Scheduler_schedule_unique, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__404)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_schedule_unique, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2769
 *             log.debug("Ignoring schedule_unique for already-scheduled task: %r", task)
 * 
 *     def _insert_task(self, delay, task):             # <<<<<<<<<<<<<<
 *         if not self.is_shutdown:
 *             run_at = time.time() + delay
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_10_Scheduler_9_insert_task, 0, __pyx_n_s_Scheduler__insert_task, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__406)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_insert_task, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2777
 *             log.debug("Ignoring scheduled task after shutdown: %r", task)
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         while True:
 *             if self.is_shutdown:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_10_Scheduler_11run, 0, __pyx_n_s_Scheduler_run, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__408)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_run, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2801
 *             time.sleep(0.1)
 * 
 *     def _log_if_failed(self, future):             # <<<<<<<<<<<<<<
 *         exc = future.exception()
 *         if exc:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_10_Scheduler_13_log_if_failed, 0, __pyx_n_s_Scheduler__log_if_failed, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__410)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_log_if_failed, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2730
 * 
 * 
 * class _Scheduler(object):             # <<<<<<<<<<<<<<
 * 
 *     _queue = None
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Scheduler, __pyx_t_9, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Scheduler, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cassandra/cluster.py":2809
 * 
 * 
 * def refresh_schema_and_set_result(keyspace, table, usertype, function, aggregate, control_conn, response_future):             # <<<<<<<<<<<<<<
 *     try:
 *         if control_conn._meta_refresh_enabled:
 */
  __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_21refresh_schema_and_set_result, 0, __pyx_n_s_refresh_schema_and_set_result, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__412)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_refresh_schema_and_set_result, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cassandra/cluster.py":2827
 * 
 * 
 * class ResponseFuture(object):             # <<<<<<<<<<<<<<
 *     """
 *     An asynchronous response delivery mechanism that is returned from calls
 */
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_builtin_object);
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_9, __pyx_n_s_ResponseFuture, __pyx_n_s_ResponseFuture, (PyObject *) NULL, __pyx_n_s_cassandra_cluster, __pyx_kp_s_An_asynchronous_response_delive); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "cassandra/cluster.py":2839
 *     """
 * 
 *     query = None             # <<<<<<<<<<<<<<
 *     """
 *     The :class:`~.Statement` instance that is being executed through this
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_query, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2845
 *     """
 * 
 *     session = None             # <<<<<<<<<<<<<<
 *     row_factory = None
 *     message = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_session, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2846
 * 
 *     session = None
 *     row_factory = None             # <<<<<<<<<<<<<<
 *     message = None
 *     default_timeout = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_row_factory, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2847
 *     session = None
 *     row_factory = None
 *     message = None             # <<<<<<<<<<<<<<
 *     default_timeout = None
 * 
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_message, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2848
 *     row_factory = None
 *     message = None
 *     default_timeout = None             # <<<<<<<<<<<<<<
 * 
 *     _req_id = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_default_timeout, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2850
 *     default_timeout = None
 * 
 *     _req_id = None             # <<<<<<<<<<<<<<
 *     _final_result = _NOT_SET
 *     _final_exception = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_req_id, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2851
 * 
 *     _req_id = None
 *     _final_result = _NOT_SET             # <<<<<<<<<<<<<<
 *     _final_exception = None
 *     _query_trace = None
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOT_SET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_final_result, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2852
 *     _req_id = None
 *     _final_result = _NOT_SET
 *     _final_exception = None             # <<<<<<<<<<<<<<
 *     _query_trace = None
 *     _callbacks = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_final_exception, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2853
 *     _final_result = _NOT_SET
 *     _final_exception = None
 *     _query_trace = None             # <<<<<<<<<<<<<<
 *     _callbacks = None
 *     _errbacks = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_query_trace, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2854
 *     _final_exception = None
 *     _query_trace = None
 *     _callbacks = None             # <<<<<<<<<<<<<<
 *     _errbacks = None
 *     _current_host = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_callbacks, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2855
 *     _query_trace = None
 *     _callbacks = None
 *     _errbacks = None             # <<<<<<<<<<<<<<
 *     _current_host = None
 *     _current_pool = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_errbacks, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2856
 *     _callbacks = None
 *     _errbacks = None
 *     _current_host = None             # <<<<<<<<<<<<<<
 *     _current_pool = None
 *     _connection = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_current_host, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2857
 *     _errbacks = None
 *     _current_host = None
 *     _current_pool = None             # <<<<<<<<<<<<<<
 *     _connection = None
 *     _query_retries = 0
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_current_pool, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2858
 *     _current_host = None
 *     _current_pool = None
 *     _connection = None             # <<<<<<<<<<<<<<
 *     _query_retries = 0
 *     _start_time = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_connection_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2859
 *     _current_pool = None
 *     _connection = None
 *     _query_retries = 0             # <<<<<<<<<<<<<<
 *     _start_time = None
 *     _metrics = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_query_retries, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2860
 *     _connection = None
 *     _query_retries = 0
 *     _start_time = None             # <<<<<<<<<<<<<<
 *     _metrics = None
 *     _paging_state = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_start_time, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2861
 *     _query_retries = 0
 *     _start_time = None
 *     _metrics = None             # <<<<<<<<<<<<<<
 *     _paging_state = None
 *     _custom_payload = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_metrics_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2862
 *     _start_time = None
 *     _metrics = None
 *     _paging_state = None             # <<<<<<<<<<<<<<
 *     _custom_payload = None
 *     _warnings = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_paging_state, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2863
 *     _metrics = None
 *     _paging_state = None
 *     _custom_payload = None             # <<<<<<<<<<<<<<
 *     _warnings = None
 *     _timer = None
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_custom_payload_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2864
 *     _paging_state = None
 *     _custom_payload = None
 *     _warnings = None             # <<<<<<<<<<<<<<
 *     _timer = None
 *     _protocol_handler = ProtocolHandler
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_warnings_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2865
 *     _custom_payload = None
 *     _warnings = None
 *     _timer = None             # <<<<<<<<<<<<<<
 *     _protocol_handler = ProtocolHandler
 * 
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_timer, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":2866
 *     _warnings = None
 *     _timer = None
 *     _protocol_handler = ProtocolHandler             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, session, message, query, timeout, metrics=None, prepared_statement=None):
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProtocolHandler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_protocol_handler, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2868
 *     _protocol_handler = ProtocolHandler
 * 
 *     def __init__(self, session, message, query, timeout, metrics=None, prepared_statement=None):             # <<<<<<<<<<<<<<
 *         self.session = session
 *         self.row_factory = session.row_factory
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_1__init__, 0, __pyx_n_s_ResponseFuture___init, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__414)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__415);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2886
 *         self._start_timer()
 * 
 *     def _start_timer(self):             # <<<<<<<<<<<<<<
 *         if self.timeout is not None:
 *             self._timer = self.session.cluster.connection_class.create_timer(self.timeout, self._on_timeout)
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_3_start_timer, 0, __pyx_n_s_ResponseFuture__start_timer, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__417)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_start_timer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2890
 *             self._timer = self.session.cluster.connection_class.create_timer(self.timeout, self._on_timeout)
 * 
 *     def _cancel_timer(self):             # <<<<<<<<<<<<<<
 *         if self._timer:
 *             self._timer.cancel()
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_5_cancel_timer, 0, __pyx_n_s_ResponseFuture__cancel_timer, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__419)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_cancel_timer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2894
 *             self._timer.cancel()
 * 
 *     def _on_timeout(self):             # <<<<<<<<<<<<<<
 *         self._set_final_exception(OperationTimedOut(self._errors, self._current_host))
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_7_on_timeout, 0, __pyx_n_s_ResponseFuture__on_timeout, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__421)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_timeout, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2897
 *         self._set_final_exception(OperationTimedOut(self._errors, self._current_host))
 * 
 *     def _make_query_plan(self):             # <<<<<<<<<<<<<<
 *         # convert the list/generator/etc to an iterator so that subsequent
 *         # calls to send_request (which retries may do) will resume where
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_9_make_query_plan, 0, __pyx_n_s_ResponseFuture__make_query_plan, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__423)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_make_query_plan_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2904
 *             self.session.keyspace, self.query))
 * 
 *     def send_request(self):             # <<<<<<<<<<<<<<
 *         """ Internal """
 *         # query_plan is an iterator, so this will resume where we last left
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_11send_request, 0, __pyx_n_s_ResponseFuture_send_request, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__425)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_send_request, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2917
 *             "Unable to complete the operation against any hosts", self._errors))
 * 
 *     def _query(self, host, message=None, cb=None):             # <<<<<<<<<<<<<<
 *         if message is None:
 *             message = self.message
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_13_query, 0, __pyx_n_s_ResponseFuture__query, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__427)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__428);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_query_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2956
 * 
 *     @property
 *     def has_more_pages(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns :const:`True` if there are more pages left in the
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_15has_more_pages, 0, __pyx_n_s_ResponseFuture_has_more_pages, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__430)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "cassandra/cluster.py":2955
 *             return None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def has_more_pages(self):
 *         """
 */
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_has_more_pages, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2967
 * 
 *     @property
 *     def warnings(self):             # <<<<<<<<<<<<<<
 *         """
 *         Warnings returned from the server, if any. This will only be
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_17warnings, 0, __pyx_n_s_ResponseFuture_warnings, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__432)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "cassandra/cluster.py":2966
 *         return self._paging_state is not None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def warnings(self):
 *         """
 */
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_warnings, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2985
 * 
 *     @property
 *     def custom_payload(self):             # <<<<<<<<<<<<<<
 *         """
 *         The custom payload returned from the server, if any. This will only be
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_19custom_payload, 0, __pyx_n_s_ResponseFuture_custom_payload, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__434)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "cassandra/cluster.py":2984
 *         return self._warnings
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def custom_payload(self):
 *         """
 */
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_custom_payload, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3002
 *         return self._custom_payload
 * 
 *     def start_fetching_next_page(self):             # <<<<<<<<<<<<<<
 *         """
 *         If there are more pages left in the query result, this asynchronously
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_21start_fetching_next_page, 0, __pyx_n_s_ResponseFuture_start_fetching_ne, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__436)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_start_fetching_next_page, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3023
 *         self.send_request()
 * 
 *     def _reprepare(self, prepare_message):             # <<<<<<<<<<<<<<
 *         cb = partial(self.session.submit, self._execute_after_prepare)
 *         request_id = self._query(self._current_host, prepare_message, cb=cb)
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_23_reprepare, 0, __pyx_n_s_ResponseFuture__reprepare, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__438)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_reprepare, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3030
 *             self.send_request()
 * 
 *     def _set_result(self, response):             # <<<<<<<<<<<<<<
 *         try:
 *             if self._current_pool and self._connection:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_25_set_result, 0, __pyx_n_s_ResponseFuture__set_result, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__440)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_set_result, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3188
 *             self._set_final_exception(exc)
 * 
 *     def _set_keyspace_completed(self, errors):             # <<<<<<<<<<<<<<
 *         if not errors:
 *             self._set_final_result(None)
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_27_set_keyspace_completed, 0, __pyx_n_s_ResponseFuture__set_keyspace_com, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__442)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_set_keyspace_completed, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3195
 *                 "Failed to set keyspace on all hosts: %s" % (errors,)))
 * 
 *     def _execute_after_prepare(self, response):             # <<<<<<<<<<<<<<
 *         """
 *         Handle the response to our attempt to prepare a statement.
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_29_execute_after_prepare, 0, __pyx_n_s_ResponseFuture__execute_after_pr, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__444)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_execute_after_prepare, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3234
 *                 "statement on host %s: %s" % (self._current_host, response)))
 * 
 *     def _set_final_result(self, response):             # <<<<<<<<<<<<<<
 *         self._cancel_timer()
 *         if self._metrics is not None:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_31_set_final_result, 0, __pyx_n_s_ResponseFuture__set_final_result, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__446)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_set_final_result, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3249
 *             fn(response, *args, **kwargs)
 * 
 *     def _set_final_exception(self, response):             # <<<<<<<<<<<<<<
 *         self._cancel_timer()
 *         if self._metrics is not None:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_33_set_final_exception, 0, __pyx_n_s_ResponseFuture__set_final_except, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__448)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_set_final_exception, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3262
 *             fn(response, *args, **kwargs)
 * 
 *     def _retry(self, reuse_connection, consistency_level):             # <<<<<<<<<<<<<<
 *         if self._final_exception:
 *             # the connection probably broke while we were waiting
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_35_retry, 0, __pyx_n_s_ResponseFuture__retry, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__450)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_retry, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3276
 *         self.session.submit(self._retry_task, reuse_connection)
 * 
 *     def _retry_task(self, reuse_connection):             # <<<<<<<<<<<<<<
 *         if self._final_exception:
 *             # the connection probably broke while we were waiting
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_37_retry_task, 0, __pyx_n_s_ResponseFuture__retry_task, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__452)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_retry_task, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3288
 *         self.send_request()
 * 
 *     def result(self, timeout=_NOT_SET):             # <<<<<<<<<<<<<<
 *         """
 *         Return the final result or raise an Exception if errors were
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_39result, 0, __pyx_n_s_ResponseFuture_result, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__454)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults3), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_NOT_SET); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_t_1)->__pyx_arg_timeout = __pyx_t_11;
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_11 = 0;
  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_9cassandra_7cluster_14ResponseFuture_52__defaults__);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_result, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3344
 *             raise self._final_exception
 * 
 *     def get_query_trace(self, max_wait=None):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the :class:`~.query.QueryTrace` instance representing a trace
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_41get_query_trace, 0, __pyx_n_s_ResponseFuture_get_query_trace, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__456)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__457);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_get_query_trace, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3359
 *         return self._query_trace
 * 
 *     def add_callback(self, fn, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Attaches a callback function to be called when the final results arrive.
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_43add_callback, 0, __pyx_n_s_ResponseFuture_add_callback, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__459)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_add_callback, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3406
 *         return self
 * 
 *     def add_errback(self, fn, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Like :meth:`.add_callback()`, but handles error cases.
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_45add_errback, 0, __pyx_n_s_ResponseFuture_add_errback, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__461)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_add_errback, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3422
 *         return self
 * 
 *     def add_callbacks(self, callback, errback,             # <<<<<<<<<<<<<<
 *                       callback_args=(), callback_kwargs=None,
 *                       errback_args=(), errback_kwargs=None):
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_47add_callbacks, 0, __pyx_n_s_ResponseFuture_add_callbacks, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__463)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__464);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_add_callbacks, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3450
 *         self.add_errback(errback, *errback_args, **(errback_kwargs or {}))
 * 
 *     def clear_callbacks(self):             # <<<<<<<<<<<<<<
 *         with self._callback_lock:
 *             self._callback = []
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_49clear_callbacks, 0, __pyx_n_s_ResponseFuture_clear_callbacks, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__466)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_clear_callbacks, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3455
 *             self._errback = []
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         result = "(no result yet)" if self._final_result is _NOT_SET else self._final_result
 *         return "<ResponseFuture: query='%s' request_id=%s result=%s exception=%s host=%s>" \
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_14ResponseFuture_51__str__, 0, __pyx_n_s_ResponseFuture___str, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__468)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_str, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3459
 *         return "<ResponseFuture: query='%s' request_id=%s result=%s exception=%s host=%s>" \
 *                % (self.query, self._req_id, result, self._final_exception, self._current_host)
 *     __repr__ = __str__             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_t_7, __pyx_n_s_str);
  if (unlikely(!__pyx_t_1)) {
    PyErr_Clear();
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_str);
  }
  if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_repr, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":2827
 * 
 * 
 * class ResponseFuture(object):             # <<<<<<<<<<<<<<
 *     """
 *     An asynchronous response delivery mechanism that is returned from calls
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_ResponseFuture, __pyx_t_9, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ResponseFuture, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cassandra/cluster.py":3462
 * 
 * 
 * class QueryExhausted(Exception):             # <<<<<<<<<<<<<<
 *     """
 *     Raised when :meth:`.ResponseFuture.start_fetching_next_page()` is called and
 */
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_builtin_Exception);
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_9, __pyx_n_s_QueryExhausted, __pyx_n_s_QueryExhausted, (PyObject *) NULL, __pyx_n_s_cassandra_cluster, __pyx_kp_s_Raised_when_meth_ResponseFuture); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_QueryExhausted, __pyx_t_9, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_QueryExhausted, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cassandra/cluster.py":3473
 * 
 * 
 * class PagedResult(object):             # <<<<<<<<<<<<<<
 *     """
 *     An iterator over the rows from a paged query result.  Whenever the number
 */
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_builtin_object);
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_9, __pyx_n_s_PagedResult, __pyx_n_s_PagedResult, (PyObject *) NULL, __pyx_n_s_cassandra_cluster, __pyx_kp_s_An_iterator_over_the_rows_from); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "cassandra/cluster.py":3495
 *     """
 * 
 *     response_future = None             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, response_future, initial_response):
 */
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_response_future, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cassandra/cluster.py":3497
 *     response_future = None
 * 
 *     def __init__(self, response_future, initial_response):             # <<<<<<<<<<<<<<
 *         self.response_future = response_future
 *         self.current_response = iter(initial_response)
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_11PagedResult_1__init__, 0, __pyx_n_s_PagedResult___init, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__470)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3501
 *         self.current_response = iter(initial_response)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_11PagedResult_3__iter__, 0, __pyx_n_s_PagedResult___iter, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__472)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_iter, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3504
 *         return self
 * 
 *     def next(self):             # <<<<<<<<<<<<<<
 *         try:
 *             return next(self.current_response)
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9cassandra_7cluster_11PagedResult_5next, 0, __pyx_n_s_PagedResult_next, NULL, __pyx_n_s_cassandra_cluster, __pyx_d, ((PyObject *)__pyx_codeobj__474)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_next, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3520
 *         return next(self.current_response)
 * 
 *     __next__ = next             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_t_7, __pyx_n_s_next);
  if (unlikely(!__pyx_t_1)) {
    PyErr_Clear();
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_next);
  }
  if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_next_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cassandra/cluster.py":3473
 * 
 * 
 * class PagedResult(object):             # <<<<<<<<<<<<<<
 *     """
 *     An iterator over the rows from a paged query result.  Whenever the number
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_PagedResult, __pyx_t_9, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PagedResult, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cassandra/cluster.py":1
 * # Copyright 2013-2015 DataStax, Inc.             # <<<<<<<<<<<<<<
 * #
 * # Licensed under the Apache License, Version 2.0 (the "License");
 */
  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_9, __pyx_kp_u_Session_execute_async_line_1615, __pyx_kp_u_Execute_the_given_query_and_ret) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_9, __pyx_kp_u_Session_prepare_line_1725, __pyx_kp_u_Prepares_a_query_string_returni) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_9, __pyx_kp_u_ResponseFuture_result_line_3288, __pyx_kp_u_Return_the_final_result_or_rais) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_9, __pyx_kp_u_ResponseFuture_add_callback_line, __pyx_kp_u_Attaches_a_callback_function_to) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_9, __pyx_kp_u_ResponseFuture_add_callbacks_lin, __pyx_kp_u_A_convenient_combination_of_met) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init cassandra.cluster", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init cassandra.cluster");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* --- Runtime support code --- */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject* args = PyTuple_Pack(1, arg);
    return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
#else
    PyErr_GetExcInfo(type, value, tb);
#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(type, value, tb);
#endif
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    Py_DECREF(res);
    return 0;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyMem_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
#if CYTHON_COMPILING_IN_PYPY
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    Py_ssize_t size;
    switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
    case METH_VARARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0)
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 0)
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 1)
                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
#else
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
	return PyCFunction_Call(func, arg, kw);
}
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_Call,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
};
static int __Pyx_CyFunction_init(void) {
#if !CYTHON_COMPILING_IN_PYPY
    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (__pyx_CyFunctionType == NULL) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyMem_Malloc(size);
    if (!m->defaults)
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
#if PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method, *result = NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto bad;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *args;
            PyObject *function = PyMethod_GET_FUNCTION(method);
            args = PyTuple_New(2);
            if (unlikely(!args)) goto bad;
            Py_INCREF(self);
            PyTuple_SET_ITEM(args, 0, self);
            Py_INCREF(arg);
            PyTuple_SET_ITEM(args, 1, arg);
            Py_INCREF(function);
            Py_DECREF(method); method = NULL;
            result = __Pyx_PyObject_Call(function, args, NULL);
            Py_DECREF(args);
            Py_DECREF(function);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallOneArg(method, arg);
bad:
    Py_XDECREF(method);
    return result;
}

static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
#else
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
#endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}

static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (PyErr_ExceptionMatches(PyExc_OverflowError))
                    PyErr_Clear();
                else
                    goto bad;
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_COMPILING_IN_CPYTHON
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_COMPILING_IN_CPYTHON
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = __Pyx_GetAttr(o, n);
    if (unlikely(!r)) {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError))
            goto bad;
        PyErr_Clear();
        r = d;
        Py_INCREF(d);
    }
    return r;
bad:
    return NULL;
}

#if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
}
#endif

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
    PyObject* next;
    iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(!iternext)) {
#else
    if (unlikely(!iternext) || unlikely(!PyIter_Check(iterator))) {
#endif
        PyErr_Format(PyExc_TypeError,
            "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name);
        return NULL;
    }
    next = iternext(iterator);
    if (likely(next))
        return next;
#if CYTHON_COMPILING_IN_CPYTHON
#if PY_VERSION_HEX >= 0x02070000
    if (unlikely(iternext == &_PyObject_NextNotImplemented))
        return NULL;
#endif
#endif
    if (defval) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
            if (unlikely(exc_type != PyExc_StopIteration) &&
                    !PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))
                return NULL;
            PyErr_Clear();
        }
        Py_INCREF(defval);
        return defval;
    }
    if (!PyErr_Occurred())
        PyErr_SetNone(PyExc_StopIteration);
    return NULL;
}

static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = (start + end) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        __pyx_d,      /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)       \
    {                                                                     \
        func_type value = func_value;                                     \
        if (sizeof(target_type) < sizeof(func_type)) {                    \
            if (unlikely(value != (func_type) (target_type) value)) {     \
                func_type zero = 0;                                       \
                if (is_unsigned && unlikely(value < zero))                \
                    goto raise_neg_overflow;                              \
                else                                                      \
                    goto raise_overflow;                                  \
            }                                                             \
        }                                                                 \
        return (target_type) value;                                       \
    }

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT(long, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT(int, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

static PyObject *__Pyx_Generator_Next(PyObject *self);
static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Generator_Close(PyObject *self);
static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args);
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    int result;
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (unlikely(et != PyExc_StopIteration) &&
            unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    if (likely(et == PyExc_StopIteration)) {
        int error = 0;
        if (!ev || !(error = PyObject_IsInstance(ev, PyExc_StopIteration))) {
            if (!ev) {
                Py_INCREF(Py_None);
                ev = Py_None;
            }
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = ev;
            return 0;
        }
        if (unlikely(error == -1)) {
            return -1;
        }
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    result = PyObject_IsInstance(ev, PyExc_StopIteration);
    if (unlikely(!result)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
    if (unlikely(result == -1)) {
        Py_DECREF(ev);
        return -1;
    }
#if PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = PyObject_GetAttr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
#endif
static CYTHON_INLINE
void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) {
    PyObject *exc_type = self->exc_type;
    PyObject *exc_value = self->exc_value;
    PyObject *exc_traceback = self->exc_traceback;
    self->exc_type = NULL;
    self->exc_value = NULL;
    self->exc_traceback = NULL;
    Py_XDECREF(exc_type);
    Py_XDECREF(exc_value);
    Py_XDECREF(exc_traceback);
}
static CYTHON_INLINE
int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) {
    if (unlikely(gen->is_running)) {
        PyErr_SetString(PyExc_ValueError,
                        "generator already executing");
        return 1;
    }
    return 0;
}
static CYTHON_INLINE
PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            PyErr_SetString(PyExc_TypeError,
                            "can't send non-None value to a "
                            "just-started generator");
            return NULL;
        }
    }
    if (unlikely(self->resume_label == -1)) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    if (value) {
#if CYTHON_COMPILING_IN_PYPY
#else
        if (self->exc_traceback) {
            PyThreadState *tstate = PyThreadState_GET();
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_XINCREF(tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = tstate->frame;
        }
#endif
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
    } else {
        __Pyx_Generator_ExceptionClear(self);
    }
    self->is_running = 1;
    retval = self->body((PyObject *) self, value);
    self->is_running = 0;
    if (retval) {
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
#if CYTHON_COMPILING_IN_PYPY
#else
        if (self->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_CLEAR(f->f_back);
        }
#endif
    } else {
        __Pyx_Generator_ExceptionClear(self);
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Generator_MethodReturn(PyObject *retval) {
    if (unlikely(!retval && !PyErr_Occurred())) {
        PyErr_SetNone(PyExc_StopIteration);
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Generator_Undelegate(gen);
    __Pyx_PyGen_FetchStopIterationValue(&val);
    ret = __Pyx_Generator_SendEx(gen, val);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Generator_FinishDelegation(gen);
    }
    return __Pyx_Generator_SendEx(gen, Py_None);
}
static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Send(yf, value);
        } else {
            if (value == Py_None)
                ret = PyIter_Next(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Generator_FinishDelegation(gen);
    } else {
        retval = __Pyx_Generator_SendEx(gen, value);
    }
    return __Pyx_Generator_MethodReturn(retval);
}
static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Generator_Close(yf);
        if (!retval)
            return -1;
    } else {
        PyObject *meth;
        gen->is_running = 1;
        meth = PyObject_GetAttr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Close(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Generator_CloseIter(gen, yf);
        __Pyx_Generator_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Generator_SendEx(gen, NULL);
    if (retval) {
        Py_DECREF(retval);
        PyErr_SetString(PyExc_RuntimeError,
                        "generator ignored GeneratorExit");
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (!raised_exception
        || raised_exception == PyExc_StopIteration
        || raised_exception == PyExc_GeneratorExit
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
    {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    PyObject *typ;
    PyObject *tb = NULL;
    PyObject *val = NULL;
    PyObject *yf = gen->yieldfrom;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
            int err = __Pyx_Generator_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Generator_Undelegate(gen);
            if (err < 0)
                return __Pyx_Generator_MethodReturn(__Pyx_Generator_SendEx(gen, NULL));
            goto throw_here;
        }
        gen->is_running = 1;
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Throw(yf, args);
        } else {
            PyObject *meth = PyObject_GetAttr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Generator_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            ret = PyObject_CallObject(meth, args);
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Generator_FinishDelegation(gen);
        }
        return __Pyx_Generator_MethodReturn(ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Generator_MethodReturn(__Pyx_Generator_SendEx(gen, NULL));
}
static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    Py_VISIT(gen->exc_type);
    Py_VISIT(gen->exc_value);
    Py_VISIT(gen->exc_traceback);
    return 0;
}
static int __Pyx_Generator_clear(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    Py_CLEAR(gen->exc_type);
    Py_CLEAR(gen->exc_value);
    Py_CLEAR(gen->exc_traceback);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    return 0;
}
static void __Pyx_Generator_dealloc(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label > 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (self->ob_refcnt > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
    __Pyx_Generator_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Generator_del(PyObject *self) {
    PyObject *res;
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    if (gen->resume_label <= 0)
        return ;
#if PY_VERSION_HEX < 0x030400a1
    assert(self->ob_refcnt == 0);
    self->ob_refcnt = 1;
#endif
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
    res = __Pyx_Generator_Close(self);
    if (res == NULL)
        PyErr_WriteUnraisable(self);
    else
        Py_DECREF(res);
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if PY_VERSION_HEX < 0x030400a1
    assert(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        self->ob_refcnt = refcnt;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Generator_get_name(__pyx_GeneratorObject *self)
{
    Py_INCREF(self->gi_name);
    return self->gi_name;
}
static int
__Pyx_Generator_set_name(__pyx_GeneratorObject *self, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Generator_get_qualname(__pyx_GeneratorObject *self)
{
    Py_INCREF(self->gi_qualname);
    return self->gi_qualname;
}
static int
__Pyx_Generator_set_qualname(__pyx_GeneratorObject *self, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Generator_get_name, (setter)__Pyx_Generator_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Generator_get_qualname, (setter)__Pyx_Generator_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_GeneratorObject, is_running), READONLY, NULL},
    {0, 0, 0, 0, 0}
};
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Generator_Send, METH_O, 0},
    {"throw", (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0},
    {"close", (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
    {0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "generator",
    sizeof(__pyx_GeneratorObject),
    0,
    (destructor) __Pyx_Generator_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Generator_traverse,
    0,
    0,
    offsetof(__pyx_GeneratorObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#else
    __Pyx_Generator_del,
#endif
    0,
#if PY_VERSION_HEX >= 0x030400a1
    __Pyx_Generator_del,
#endif
};
static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
                                                  PyObject *closure, PyObject *name, PyObject *qualname) {
    __pyx_GeneratorObject *gen =
        PyObject_GC_New(__pyx_GeneratorObject, __pyx_GeneratorType);
    if (gen == NULL)
        return NULL;
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->exc_type = NULL;
    gen->exc_value = NULL;
    gen->exc_traceback = NULL;
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    PyObject_GC_Track(gen);
    return gen;
}
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (__pyx_GeneratorType == NULL) {
        return -1;
    }
    return 0;
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else
        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_LENGTH(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else
        return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
    } else
#endif
#if !CYTHON_COMPILING_IN_PYPY
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b)))
      return PyInt_AS_LONG(b);
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
     #if CYTHON_USE_PYLONG_INTERNALS
       switch (Py_SIZE(b)) {
       case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
       case  0: return 0;
       case  1: return ((PyLongObject*)b)->ob_digit[0];
       }
     #endif
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
