/* Generated by Cython 0.21.2 */

#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_21_2"
#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
#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
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX < 0x030400a1 && !defined(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
#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
#ifdef __cplusplus
template<typename T>
void __Pyx_call_destructor(T* x) {
    x->~T();
}
#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__pyredblack__redblack
#define __PYX_HAVE_API__pyredblack__redblack
#include "prbconfig.h"
#include "pyredblack.h"
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#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
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_FromUString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromUString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromUString(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*) (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;
    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[] = {
  "pyredblack/redblack.pyx",
};

/*--- Type declarations ---*/
struct __pyx_obj_10pyredblack_8redblack_rbset;
struct __pyx_obj_10pyredblack_8redblack_rbdict;
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__;
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__;
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_genexpr;
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__;
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_genexpr;
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__;
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_genexpr;
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_genexpr;
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys;
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues;
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems;

/* "pyredblack/redblack.pyx":70
 *         void clear_objs()
 * 
 * cdef class rbset(object):             # <<<<<<<<<<<<<<
 *     '''Red-black-tree-based set.'''
 * 
 */
struct __pyx_obj_10pyredblack_8redblack_rbset {
  PyObject_HEAD
  ObjectRBTree *_tree;
  int _num_nodes;
};


/* "pyredblack/redblack.pyx":389
 * 
 * 
 * cdef class rbdict(object):             # <<<<<<<<<<<<<<
 *     '''Red-black-tree-based associative array.'''
 * 
 */
struct __pyx_obj_10pyredblack_8redblack_rbdict {
  PyObject_HEAD
  PairRBTree *_tree;
  int _num_nodes;
};


/* "pyredblack/redblack.pyx":103
 *         return False
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         '''Return an iterator over the items in the set.'''
 *         cdef ObjectRBTreeIterator it = self._tree.begin()
 */
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__ {
  PyObject_HEAD
  ObjectRBTreeIterator __pyx_v_it;
  struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self;
};


/* "pyredblack/redblack.pyx":254
 *         return self.__and__(other)
 * 
 *     def __and__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements common to the set and all others.
 */
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__ {
  PyObject_HEAD
  PyObject *__pyx_v_bigger;
  PyObject *__pyx_v_smaller;
};


/* "pyredblack/redblack.pyx":262
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),
 *                                               (len(other), other)])
 *         return rbset(elem for elem in smaller if elem in bigger)             # <<<<<<<<<<<<<<
 * 
 *     def difference(self, other, *others):
 */
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_genexpr {
  PyObject_HEAD
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__ *__pyx_outer_scope;
  PyObject *__pyx_v_elem;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pyredblack/redblack.pyx":273
 *         return self.__sub__(other)
 * 
 *     def __sub__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements in the set that are not in the
 */
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__ {
  PyObject_HEAD
  PyObject *__pyx_v_other;
  PyObject *__pyx_v_self;
};


/* "pyredblack/redblack.pyx":280
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for -')
 *         return rbset(elem for elem in self if elem not in other)             # <<<<<<<<<<<<<<
 * 
 *     def symmetric_difference(self, other):
 */
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_genexpr {
  PyObject_HEAD
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__ *__pyx_outer_scope;
  PyObject *__pyx_v_elem;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pyredblack/redblack.pyx":291
 *         return self.__xor__(other)
 * 
 *     def __xor__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements in either the set or `other` but
 */
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__ {
  PyObject_HEAD
  PyObject *__pyx_v_other;
  PyObject *__pyx_v_self;
};


/* "pyredblack/redblack.pyx":298
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for ^')
 *         rv = rbset(elem for elem in self if elem not in other)             # <<<<<<<<<<<<<<
 *         rv.update(elem for elem in other if elem not in self)
 *         return rv
 */
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_genexpr {
  PyObject_HEAD
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *__pyx_outer_scope;
  PyObject *__pyx_v_elem;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pyredblack/redblack.pyx":299
 *             raise TypeError('unsupported operand type(s) for ^')
 *         rv = rbset(elem for elem in self if elem not in other)
 *         rv.update(elem for elem in other if elem not in self)             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_genexpr {
  PyObject_HEAD
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *__pyx_outer_scope;
  PyObject *__pyx_v_elem;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pyredblack/redblack.pyx":523
 *             return default
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         '''Return an iterator over the dictionarys keys.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()
 */
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys {
  PyObject_HEAD
  PairRBTreeIterator __pyx_v_it;
  struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self;
};


/* "pyredblack/redblack.pyx":530
 *             preincrement(it)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         '''Return an iterator over the dictionarys values.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()
 */
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues {
  PyObject_HEAD
  PairRBTreeIterator __pyx_v_it;
  struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self;
};


/* "pyredblack/redblack.pyx":537
 *             preincrement(it)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         '''Return an iterator over the dictionarys `(key, value)` pairs.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()
 */
struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems {
  PyObject_HEAD
  PairRBTreeIterator __pyx_v_it;
  struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self;
};

#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 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 CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);

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
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

#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);

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);

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_PySequence_Contains(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

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

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 CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

#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 PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);

#include <string.h>

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 CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

#ifndef __Pyx_CppExn2PyErr
#include <new>
#include <typeinfo>
#include <stdexcept>
#include <ios>
static void __Pyx_CppExn2PyErr() {
  try {
    if (PyErr_Occurred())
      ; // let the latest Python exn pass through and ignore the current one
    else
      throw;
  } catch (const std::bad_alloc& exn) {
    PyErr_SetString(PyExc_MemoryError, exn.what());
  } catch (const std::bad_cast& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::domain_error& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::invalid_argument& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::ios_base::failure& exn) {
    PyErr_SetString(PyExc_IOError, exn.what());
  } catch (const std::out_of_range& exn) {
    PyErr_SetString(PyExc_IndexError, exn.what());
  } catch (const std::overflow_error& exn) {
    PyErr_SetString(PyExc_OverflowError, exn.what());
  } catch (const std::range_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::underflow_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::exception& exn) {
    PyErr_SetString(PyExc_RuntimeError, exn.what());
  }
  catch (...)
  {
    PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
  }
}
#endif

#include <new>

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 *);

static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

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

#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 'libcpp' */

/* Module declarations from 'cpython.ref' */

/* Module declarations from 'pyredblack.redblack' */
static PyTypeObject *__pyx_ptype_10pyredblack_8redblack_rbset = 0;
static PyTypeObject *__pyx_ptype_10pyredblack_8redblack_rbdict = 0;
static PyTypeObject *__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct____iter__ = 0;
static PyTypeObject *__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_1___and__ = 0;
static PyTypeObject *__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_2_genexpr = 0;
static PyTypeObject *__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_3___sub__ = 0;
static PyTypeObject *__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_4_genexpr = 0;
static PyTypeObject *__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_5___xor__ = 0;
static PyTypeObject *__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_6_genexpr = 0;
static PyTypeObject *__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_7_genexpr = 0;
static PyTypeObject *__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys = 0;
static PyTypeObject *__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_9_itervalues = 0;
static PyTypeObject *__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_10_iteritems = 0;
#define __Pyx_MODULE_NAME "pyredblack.redblack"
int __pyx_module_is_main_pyredblack__redblack = 0;

/* Implementation of 'pyredblack.redblack' */
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_sorted;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_ValueError;
static int __pyx_pf_10pyredblack_8redblack_5rbset___cinit__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self); /* proto */
static int __pyx_pf_10pyredblack_8redblack_5rbset_2__init__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_iterable); /* proto */
static void __pyx_pf_10pyredblack_8redblack_5rbset_4__dealloc__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_10pyredblack_8redblack_5rbset_6__len__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self); /* proto */
static int __pyx_pf_10pyredblack_8redblack_5rbset_8__contains__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_elem); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_10__iter__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_13add(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_elem); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_15remove(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_elem); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_17discard(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_elem); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_19pop(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_21clear(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_23isdisjoint(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_25issubset(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_27issuperset(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_29__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_op); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_31union(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_others); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_33__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_35intersection(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other, CYTHON_UNUSED PyObject *__pyx_v_others); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_7__and___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_37__and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_39difference(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other, CYTHON_UNUSED PyObject *__pyx_v_others); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_7__sub___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_41__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_43symmetric_difference(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_7__xor___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_7__xor___3genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_45__xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_47copy(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_49update(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_others); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_51__ior__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_53intersection_update(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_others); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_55__iand__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_57difference_update(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_others); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_59__isub__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_61symmetric_difference_update(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_63__ixor__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static int __pyx_pf_10pyredblack_8redblack_6rbdict___cinit__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self); /* proto */
static int __pyx_pf_10pyredblack_8redblack_6rbdict_2__init__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_mapping, PyObject *__pyx_v_kwargs); /* proto */
static void __pyx_pf_10pyredblack_8redblack_6rbdict_4__dealloc__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_10pyredblack_8redblack_6rbdict_6__len__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_8__missing__(CYTHON_UNUSED struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_10__getitem__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_10pyredblack_8redblack_6rbdict_12__setitem__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_10pyredblack_8redblack_6rbdict_14__delitem__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_10pyredblack_8redblack_6rbdict_16__contains__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_18__iter__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_20keys(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_22values(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_24items(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_26has_key(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_28get(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_30clear(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_32setdefault(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_34iterkeys(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_37itervalues(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_40iteritems(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_43pop(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_45popitem(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_47copy(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_49update(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_mapping, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_tp_new_10pyredblack_8redblack_rbset(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pyredblack_8redblack_rbdict(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_1___and__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_3___sub__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_5___xor__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_7_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_9_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_10_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_eq[] = "__eq__";
static char __pyx_k_ge[] = "__ge__";
static char __pyx_k_le[] = "__le__";
static char __pyx_k_add[] = "add";
static char __pyx_k_and[] = "__and__";
static char __pyx_k_key[] = "key";
static char __pyx_k_sub[] = "__sub__";
static char __pyx_k_xor[] = "__xor__";
static char __pyx_k_args[] = "args";
static char __pyx_k_iand[] = "__iand__";
static char __pyx_k_iter[] = "__iter__";
static char __pyx_k_ixor[] = "__ixor__";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_send[] = "send";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_clear[] = "clear";
static char __pyx_k_close[] = "close";
static char __pyx_k_items[] = "items";
static char __pyx_k_other[] = "other";
static char __pyx_k_throw[] = "throw";
static char __pyx_k_sorted[] = "sorted";
static char __pyx_k_update[] = "update";
static char __pyx_k_default[] = "default";
static char __pyx_k_genexpr[] = "genexpr";
static char __pyx_k_getitem[] = "__getitem__";
static char __pyx_k_mapping[] = "mapping";
static char __pyx_k_missing[] = "__missing__";
static char __pyx_k_setitem[] = "__setitem__";
static char __pyx_k_KeyError[] = "KeyError";
static char __pyx_k_contains[] = "__contains__";
static char __pyx_k_iterable[] = "iterable";
static char __pyx_k_iterkeys[] = "iterkeys";
static char __pyx_k_TypeError[] = "TypeError";
static char __pyx_k_iteritems[] = "iteritems";
static char __pyx_k_ValueError[] = "ValueError";
static char __pyx_k_itervalues[] = "itervalues";
static char __pyx_k_rbset___iter[] = "rbset.__iter__";
static char __pyx_k_StopIteration[] = "StopIteration";
static char __pyx_k_AttributeError[] = "AttributeError";
static char __pyx_k_rbdict_iterkeys[] = "rbdict.iterkeys";
static char __pyx_k_rbdict_iteritems[] = "rbdict.iteritems";
static char __pyx_k_rbdict_itervalues[] = "rbdict.itervalues";
static char __pyx_k_NotImplementedError[] = "NotImplementedError";
static char __pyx_k_and___locals_genexpr[] = "__and__.<locals>.genexpr";
static char __pyx_k_sub___locals_genexpr[] = "__sub__.<locals>.genexpr";
static char __pyx_k_xor___locals_genexpr[] = "__xor__.<locals>.genexpr";
static char __pyx_k_pop_from_an_empty_set[] = "pop from an empty set";
static char __pyx_k_popitem_dictionary_is_empty[] = "popitem(): dictionary is empty";
static char __pyx_k_redblack_pyx_c_Will_Roberts_25[] = "\nredblack.pyx\n(c) Will Roberts  25 February, 2015\n\nCython source to make red-black tree-based containers.\n";
static char __pyx_k_unsupported_operand_type_s_for[] = "unsupported operand type(s) for |";
static char __pyx_k_cannot_convert_dictionary_update[] = "cannot convert dictionary update sequence element to a sequence";
static char __pyx_k_dictionary_update_sequence_eleme[] = "dictionary update sequence element must have length 2";
static char __pyx_k_unsupported_operand_type_s_for_2[] = "unsupported operand type(s) for &";
static char __pyx_k_unsupported_operand_type_s_for_3[] = "unsupported operand type(s) for -";
static char __pyx_k_unsupported_operand_type_s_for_4[] = "unsupported operand type(s) for ^";
static char __pyx_k_unsupported_operand_type_s_for_5[] = "unsupported operand type(s) for |=";
static char __pyx_k_unsupported_operand_type_s_for_6[] = "unsupported operand type(s) for &=";
static char __pyx_k_unsupported_operand_type_s_for_7[] = "unsupported operand type(s) for -=";
static char __pyx_k_unsupported_operand_type_s_for_8[] = "unsupported operand type(s) for ^=";
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_n_s_StopIteration;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_add;
static PyObject *__pyx_n_s_and;
static PyObject *__pyx_n_s_and___locals_genexpr;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_kp_s_cannot_convert_dictionary_update;
static PyObject *__pyx_n_s_clear;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_contains;
static PyObject *__pyx_n_s_default;
static PyObject *__pyx_kp_s_dictionary_update_sequence_eleme;
static PyObject *__pyx_n_s_eq;
static PyObject *__pyx_n_s_ge;
static PyObject *__pyx_n_s_genexpr;
static PyObject *__pyx_n_s_getitem;
static PyObject *__pyx_n_s_iand;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_iter;
static PyObject *__pyx_n_s_iterable;
static PyObject *__pyx_n_s_iteritems;
static PyObject *__pyx_n_s_iterkeys;
static PyObject *__pyx_n_s_itervalues;
static PyObject *__pyx_n_s_ixor;
static PyObject *__pyx_n_s_key;
static PyObject *__pyx_n_s_le;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_mapping;
static PyObject *__pyx_n_s_missing;
static PyObject *__pyx_n_s_other;
static PyObject *__pyx_kp_s_pop_from_an_empty_set;
static PyObject *__pyx_kp_s_popitem_dictionary_is_empty;
static PyObject *__pyx_n_s_rbdict_iteritems;
static PyObject *__pyx_n_s_rbdict_iterkeys;
static PyObject *__pyx_n_s_rbdict_itervalues;
static PyObject *__pyx_n_s_rbset___iter;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_setitem;
static PyObject *__pyx_n_s_sorted;
static PyObject *__pyx_n_s_sub;
static PyObject *__pyx_n_s_sub___locals_genexpr;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_kp_s_unsupported_operand_type_s_for;
static PyObject *__pyx_kp_s_unsupported_operand_type_s_for_2;
static PyObject *__pyx_kp_s_unsupported_operand_type_s_for_3;
static PyObject *__pyx_kp_s_unsupported_operand_type_s_for_4;
static PyObject *__pyx_kp_s_unsupported_operand_type_s_for_5;
static PyObject *__pyx_kp_s_unsupported_operand_type_s_for_6;
static PyObject *__pyx_kp_s_unsupported_operand_type_s_for_7;
static PyObject *__pyx_kp_s_unsupported_operand_type_s_for_8;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_xor;
static PyObject *__pyx_n_s_xor___locals_genexpr;
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_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
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;

/* "pyredblack/redblack.pyx":76
 *     cdef int _num_nodes
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         '''C Constructor.'''
 *         self._tree = new ObjectRBTree()
 */

/* Python wrapper */
static int __pyx_pw_10pyredblack_8redblack_5rbset_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pyredblack_8redblack_5rbset_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset___cinit__(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self));

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

static int __pyx_pf_10pyredblack_8redblack_5rbset___cinit__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  ObjectRBTree *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pyredblack/redblack.pyx":78
 *     def __cinit__(self):
 *         '''C Constructor.'''
 *         self._tree = new ObjectRBTree()             # <<<<<<<<<<<<<<
 *         self._num_nodes = 0
 * 
 */
  try {
    __pyx_t_1 = new ObjectRBTree();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_self->_tree = __pyx_t_1;

  /* "pyredblack/redblack.pyx":79
 *         '''C Constructor.'''
 *         self._tree = new ObjectRBTree()
 *         self._num_nodes = 0             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, iterable = None):
 */
  __pyx_v_self->_num_nodes = 0;

  /* "pyredblack/redblack.pyx":76
 *     cdef int _num_nodes
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         '''C Constructor.'''
 *         self._tree = new ObjectRBTree()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyredblack.redblack.rbset.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":81
 *         self._num_nodes = 0
 * 
 *     def __init__(self, iterable = None):             # <<<<<<<<<<<<<<
 *         '''Python Constructor.'''
 *         self.update(iterable)
 */

/* Python wrapper */
static int __pyx_pw_10pyredblack_8redblack_5rbset_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_2__init__[] = "Python Constructor.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_5rbset_2__init__;
#endif
static int __pyx_pw_10pyredblack_8redblack_5rbset_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_iterable = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iterable,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iterable);
          if (value) { values[0] = 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 = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_iterable = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyredblack.redblack.rbset.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_2__init__(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), __pyx_v_iterable);

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

static int __pyx_pf_10pyredblack_8redblack_5rbset_2__init__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_iterable) {
  int __pyx_r;
  __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);

  /* "pyredblack/redblack.pyx":83
 *     def __init__(self, iterable = None):
 *         '''Python Constructor.'''
 *         self.update(iterable)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update); 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);
  __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_iterable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __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 = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_iterable);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_iterable);
    __Pyx_GIVEREF(__pyx_v_iterable);
    __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 = 83; __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;

  /* "pyredblack/redblack.pyx":81
 *         self._num_nodes = 0
 * 
 *     def __init__(self, iterable = None):             # <<<<<<<<<<<<<<
 *         '''Python Constructor.'''
 *         self.update(iterable)
 */

  /* function exit code */
  __pyx_r = 0;
  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("pyredblack.redblack.rbset.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":85
 *         self.update(iterable)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         '''Destructor.'''
 *         if self._tree is not NULL:
 */

/* Python wrapper */
static void __pyx_pw_10pyredblack_8redblack_5rbset_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_10pyredblack_8redblack_5rbset_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_10pyredblack_8redblack_5rbset_4__dealloc__(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self));

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

static void __pyx_pf_10pyredblack_8redblack_5rbset_4__dealloc__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "pyredblack/redblack.pyx":87
 *     def __dealloc__(self):
 *         '''Destructor.'''
 *         if self._tree is not NULL:             # <<<<<<<<<<<<<<
 *             self._tree.clear_objs()
 *             del self._tree
 */
  __pyx_t_1 = ((__pyx_v_self->_tree != NULL) != 0);
  if (__pyx_t_1) {

    /* "pyredblack/redblack.pyx":88
 *         '''Destructor.'''
 *         if self._tree is not NULL:
 *             self._tree.clear_objs()             # <<<<<<<<<<<<<<
 *             del self._tree
 * 
 */
    __pyx_v_self->_tree->clear_objs();

    /* "pyredblack/redblack.pyx":89
 *         if self._tree is not NULL:
 *             self._tree.clear_objs()
 *             del self._tree             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    delete __pyx_v_self->_tree;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":85
 *         self.update(iterable)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         '''Destructor.'''
 *         if self._tree is not NULL:
 */

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

/* "pyredblack/redblack.pyx":91
 *             del self._tree
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         '''Return the number of items in the set.'''
 *         return self._num_nodes
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_10pyredblack_8redblack_5rbset_7__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_6__len__[] = "Return the number of items in the set.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_5rbset_6__len__;
#endif
static Py_ssize_t __pyx_pw_10pyredblack_8redblack_5rbset_7__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_6__len__(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_10pyredblack_8redblack_5rbset_6__len__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "pyredblack/redblack.pyx":93
 *     def __len__(self):
 *         '''Return the number of items in the set.'''
 *         return self._num_nodes             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, elem):
 */
  __pyx_r = __pyx_v_self->_num_nodes;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":91
 *             del self._tree
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         '''Return the number of items in the set.'''
 *         return self._num_nodes
 */

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

/* "pyredblack/redblack.pyx":95
 *         return self._num_nodes
 * 
 *     def __contains__(self, elem):             # <<<<<<<<<<<<<<
 *         '''Return `True` if the set has a member `elem`, else `False`.'''
 *         _hash = hash(elem)
 */

/* Python wrapper */
static int __pyx_pw_10pyredblack_8redblack_5rbset_9__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_elem); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_8__contains__[] = "Return `True` if the set has a member `elem`, else `False`.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_5rbset_8__contains__;
#endif
static int __pyx_pw_10pyredblack_8redblack_5rbset_9__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_elem) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_8__contains__(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), ((PyObject *)__pyx_v_elem));

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

static int __pyx_pf_10pyredblack_8redblack_5rbset_8__contains__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_elem) {
  CYTHON_UNUSED Py_hash_t __pyx_v__hash;
  ObjectRBTreeIterator __pyx_v_it;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_hash_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "pyredblack/redblack.pyx":97
 *     def __contains__(self, elem):
 *         '''Return `True` if the set has a member `elem`, else `False`.'''
 *         _hash = hash(elem)             # <<<<<<<<<<<<<<
 *         cdef ObjectRBTreeIterator it = self._tree.find(elem)
 *         if it.valid() and it.getDir() == 0:
 */
  __pyx_t_1 = PyObject_Hash(__pyx_v_elem); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v__hash = __pyx_t_1;

  /* "pyredblack/redblack.pyx":98
 *         '''Return `True` if the set has a member `elem`, else `False`.'''
 *         _hash = hash(elem)
 *         cdef ObjectRBTreeIterator it = self._tree.find(elem)             # <<<<<<<<<<<<<<
 *         if it.valid() and it.getDir() == 0:
 *             return True
 */
  __pyx_v_it = __pyx_v_self->_tree->find(__pyx_v_elem);

  /* "pyredblack/redblack.pyx":99
 *         _hash = hash(elem)
 *         cdef ObjectRBTreeIterator it = self._tree.find(elem)
 *         if it.valid() and it.getDir() == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         return False
 */
  __pyx_t_3 = (__pyx_v_it.valid() != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_it.getDir() == 0) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "pyredblack/redblack.pyx":100
 *         cdef ObjectRBTreeIterator it = self._tree.find(elem)
 *         if it.valid() and it.getDir() == 0:
 *             return True             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
    __pyx_r = 1;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":101
 *         if it.valid() and it.getDir() == 0:
 *             return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":95
 *         return self._num_nodes
 * 
 *     def __contains__(self, elem):             # <<<<<<<<<<<<<<
 *         '''Return `True` if the set has a member `elem`, else `False`.'''
 *         _hash = hash(elem)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyredblack.redblack.rbset.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_10pyredblack_8redblack_5rbset_12generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pyredblack/redblack.pyx":103
 *         return False
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         '''Return an iterator over the items in the set.'''
 *         cdef ObjectRBTreeIterator it = self._tree.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_11__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_10__iter__[] = "Return an iterator over the items in the set.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_5rbset_10__iter__;
#endif
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_11__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_10__iter__(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_10__iter__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__ *)__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct____iter__(__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct____iter__, __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((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_10pyredblack_8redblack_5rbset_12generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_rbset___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __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("pyredblack.redblack.rbset.__iter__", __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_10pyredblack_8redblack_5rbset_12generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2;
  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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyredblack/redblack.pyx":105
 *     def __iter__(self):
 *         '''Return an iterator over the items in the set.'''
 *         cdef ObjectRBTreeIterator it = self._tree.begin()             # <<<<<<<<<<<<<<
 *         while it != self._tree.end():
 *             yield <object>dereference(it)
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->_tree->begin();

  /* "pyredblack/redblack.pyx":106
 *         '''Return an iterator over the items in the set.'''
 *         cdef ObjectRBTreeIterator it = self._tree.begin()
 *         while it != self._tree.end():             # <<<<<<<<<<<<<<
 *             yield <object>dereference(it)
 *             preincrement(it)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->_tree->end()) != 0);
    if (!__pyx_t_1) break;

    /* "pyredblack/redblack.pyx":107
 *         cdef ObjectRBTreeIterator it = self._tree.begin()
 *         while it != self._tree.end():
 *             yield <object>dereference(it)             # <<<<<<<<<<<<<<
 *             preincrement(it)
 * 
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it);
    __Pyx_INCREF(((PyObject *)__pyx_t_2));
    __pyx_r = ((PyObject *)__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pyredblack/redblack.pyx":108
 *         while it != self._tree.end():
 *             yield <object>dereference(it)
 *             preincrement(it)             # <<<<<<<<<<<<<<
 * 
 *     def add(self, elem):
 */
    (++__pyx_cur_scope->__pyx_v_it);
  }

  /* "pyredblack/redblack.pyx":103
 *         return False
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         '''Return an iterator over the items in the set.'''
 *         cdef ObjectRBTreeIterator it = self._tree.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("__iter__", __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;
}

/* "pyredblack/redblack.pyx":110
 *             preincrement(it)
 * 
 *     def add(self, elem):             # <<<<<<<<<<<<<<
 *         '''Add element `elem` to the set.'''
 *         _hash = hash(elem)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_14add(PyObject *__pyx_v_self, PyObject *__pyx_v_elem); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_13add[] = "Add element `elem` to the set.";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_14add(PyObject *__pyx_v_self, PyObject *__pyx_v_elem) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_13add(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), ((PyObject *)__pyx_v_elem));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_13add(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_elem) {
  CYTHON_UNUSED Py_hash_t __pyx_v__hash;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_hash_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add", 0);

  /* "pyredblack/redblack.pyx":112
 *     def add(self, elem):
 *         '''Add element `elem` to the set.'''
 *         _hash = hash(elem)             # <<<<<<<<<<<<<<
 *         if self._tree.add_obj(elem):
 *             self._num_nodes += 1
 */
  __pyx_t_1 = PyObject_Hash(__pyx_v_elem); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v__hash = __pyx_t_1;

  /* "pyredblack/redblack.pyx":113
 *         '''Add element `elem` to the set.'''
 *         _hash = hash(elem)
 *         if self._tree.add_obj(elem):             # <<<<<<<<<<<<<<
 *             self._num_nodes += 1
 * 
 */
  __pyx_t_2 = (__pyx_v_self->_tree->add_obj(__pyx_v_elem) != 0);
  if (__pyx_t_2) {

    /* "pyredblack/redblack.pyx":114
 *         _hash = hash(elem)
 *         if self._tree.add_obj(elem):
 *             self._num_nodes += 1             # <<<<<<<<<<<<<<
 * 
 *     def remove(self, elem):
 */
    __pyx_v_self->_num_nodes = (__pyx_v_self->_num_nodes + 1);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":110
 *             preincrement(it)
 * 
 *     def add(self, elem):             # <<<<<<<<<<<<<<
 *         '''Add element `elem` to the set.'''
 *         _hash = hash(elem)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyredblack.redblack.rbset.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":116
 *             self._num_nodes += 1
 * 
 *     def remove(self, elem):             # <<<<<<<<<<<<<<
 *         '''
 *         Remove element `elem` from the set. Raises `KeyError` if `elem` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_16remove(PyObject *__pyx_v_self, PyObject *__pyx_v_elem); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_15remove[] = "\n        Remove element `elem` from the set. Raises `KeyError` if `elem` is\n        not contained in the set.\n        ";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_16remove(PyObject *__pyx_v_self, PyObject *__pyx_v_elem) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_15remove(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), ((PyObject *)__pyx_v_elem));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_15remove(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_elem) {
  CYTHON_UNUSED Py_hash_t __pyx_v__hash;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_hash_t __pyx_t_1;
  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("remove", 0);

  /* "pyredblack/redblack.pyx":121
 *         not contained in the set.
 *         '''
 *         _hash = hash(elem)             # <<<<<<<<<<<<<<
 *         if self._tree.del_obj(elem):
 *             self._num_nodes -= 1
 */
  __pyx_t_1 = PyObject_Hash(__pyx_v_elem); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v__hash = __pyx_t_1;

  /* "pyredblack/redblack.pyx":122
 *         '''
 *         _hash = hash(elem)
 *         if self._tree.del_obj(elem):             # <<<<<<<<<<<<<<
 *             self._num_nodes -= 1
 *         else:
 */
  __pyx_t_2 = (__pyx_v_self->_tree->del_obj(__pyx_v_elem) != 0);
  if (__pyx_t_2) {

    /* "pyredblack/redblack.pyx":123
 *         _hash = hash(elem)
 *         if self._tree.del_obj(elem):
 *             self._num_nodes -= 1             # <<<<<<<<<<<<<<
 *         else:
 *             raise KeyError(elem)
 */
    __pyx_v_self->_num_nodes = (__pyx_v_self->_num_nodes - 1);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pyredblack/redblack.pyx":125
 *             self._num_nodes -= 1
 *         else:
 *             raise KeyError(elem)             # <<<<<<<<<<<<<<
 * 
 *     def discard(self, elem):
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_elem);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_elem);
    __Pyx_GIVEREF(__pyx_v_elem);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":116
 *             self._num_nodes += 1
 * 
 *     def remove(self, elem):             # <<<<<<<<<<<<<<
 *         '''
 *         Remove element `elem` from the set. Raises `KeyError` if `elem` is
 */

  /* 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_AddTraceback("pyredblack.redblack.rbset.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":127
 *             raise KeyError(elem)
 * 
 *     def discard(self, elem):             # <<<<<<<<<<<<<<
 *         '''Remove element `elem` from the set if it is present.'''
 *         _hash = hash(elem)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_18discard(PyObject *__pyx_v_self, PyObject *__pyx_v_elem); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_17discard[] = "Remove element `elem` from the set if it is present.";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_18discard(PyObject *__pyx_v_self, PyObject *__pyx_v_elem) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("discard (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_17discard(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), ((PyObject *)__pyx_v_elem));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_17discard(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_elem) {
  CYTHON_UNUSED Py_hash_t __pyx_v__hash;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_hash_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("discard", 0);

  /* "pyredblack/redblack.pyx":129
 *     def discard(self, elem):
 *         '''Remove element `elem` from the set if it is present.'''
 *         _hash = hash(elem)             # <<<<<<<<<<<<<<
 *         if self._tree.del_obj(elem):
 *             self._num_nodes -= 1
 */
  __pyx_t_1 = PyObject_Hash(__pyx_v_elem); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v__hash = __pyx_t_1;

  /* "pyredblack/redblack.pyx":130
 *         '''Remove element `elem` from the set if it is present.'''
 *         _hash = hash(elem)
 *         if self._tree.del_obj(elem):             # <<<<<<<<<<<<<<
 *             self._num_nodes -= 1
 * 
 */
  __pyx_t_2 = (__pyx_v_self->_tree->del_obj(__pyx_v_elem) != 0);
  if (__pyx_t_2) {

    /* "pyredblack/redblack.pyx":131
 *         _hash = hash(elem)
 *         if self._tree.del_obj(elem):
 *             self._num_nodes -= 1             # <<<<<<<<<<<<<<
 * 
 *     def pop(self):
 */
    __pyx_v_self->_num_nodes = (__pyx_v_self->_num_nodes - 1);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":127
 *             raise KeyError(elem)
 * 
 *     def discard(self, elem):             # <<<<<<<<<<<<<<
 *         '''Remove element `elem` from the set if it is present.'''
 *         _hash = hash(elem)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyredblack.redblack.rbset.discard", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":133
 *             self._num_nodes -= 1
 * 
 *     def pop(self):             # <<<<<<<<<<<<<<
 *         '''
 *         Remove and return an arbitrary element from the set. Raises
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_20pop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_19pop[] = "\n        Remove and return an arbitrary element from the set. Raises\n        `KeyError` if the set is empty.\n        ";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_20pop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pop (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_19pop(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_19pop(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self) {
  PyObject *__pyx_v_obj = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pop", 0);

  /* "pyredblack/redblack.pyx":138
 *         `KeyError` if the set is empty.
 *         '''
 *         cdef object obj = None             # <<<<<<<<<<<<<<
 *         if self._tree.pop_first_save_obj(obj):
 *             self._num_nodes -= 1
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_obj = Py_None;

  /* "pyredblack/redblack.pyx":139
 *         '''
 *         cdef object obj = None
 *         if self._tree.pop_first_save_obj(obj):             # <<<<<<<<<<<<<<
 *             self._num_nodes -= 1
 *             return obj
 */
  __pyx_t_1 = (__pyx_v_self->_tree->pop_first_save_obj(__pyx_v_obj) != 0);
  if (__pyx_t_1) {

    /* "pyredblack/redblack.pyx":140
 *         cdef object obj = None
 *         if self._tree.pop_first_save_obj(obj):
 *             self._num_nodes -= 1             # <<<<<<<<<<<<<<
 *             return obj
 *         else:
 */
    __pyx_v_self->_num_nodes = (__pyx_v_self->_num_nodes - 1);

    /* "pyredblack/redblack.pyx":141
 *         if self._tree.pop_first_save_obj(obj):
 *             self._num_nodes -= 1
 *             return obj             # <<<<<<<<<<<<<<
 *         else:
 *             raise KeyError('pop from an empty set')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_obj);
    __pyx_r = __pyx_v_obj;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pyredblack/redblack.pyx":143
 *             return obj
 *         else:
 *             raise KeyError('pop from an empty set')             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __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 = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyredblack/redblack.pyx":133
 *             self._num_nodes -= 1
 * 
 *     def pop(self):             # <<<<<<<<<<<<<<
 *         '''
 *         Remove and return an arbitrary element from the set. Raises
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.pop", __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;
}

/* "pyredblack/redblack.pyx":145
 *             raise KeyError('pop from an empty set')
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         '''Remove all items from the set.'''
 *         self._tree.clear_objs()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_22clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_21clear[] = "Remove all items from the set.";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_22clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_21clear(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_21clear(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear", 0);

  /* "pyredblack/redblack.pyx":147
 *     def clear(self):
 *         '''Remove all items from the set.'''
 *         self._tree.clear_objs()             # <<<<<<<<<<<<<<
 *         self._num_nodes = 0
 * 
 */
  __pyx_v_self->_tree->clear_objs();

  /* "pyredblack/redblack.pyx":148
 *         '''Remove all items from the set.'''
 *         self._tree.clear_objs()
 *         self._num_nodes = 0             # <<<<<<<<<<<<<<
 * 
 *     def isdisjoint(self, other):
 */
  __pyx_v_self->_num_nodes = 0;

  /* "pyredblack/redblack.pyx":145
 *             raise KeyError('pop from an empty set')
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         '''Remove all items from the set.'''
 *         self._tree.clear_objs()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":150
 *         self._num_nodes = 0
 * 
 *     def isdisjoint(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return True if the set has no elements in common with
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_24isdisjoint(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_23isdisjoint[] = "\n        Return True if the set has no elements in common with\n        `other`. Sets are disjoint if and only if their intersection\n        is the empty set.\n        ";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_24isdisjoint(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isdisjoint (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_23isdisjoint(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_23isdisjoint(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED PyObject *__pyx_v__d = NULL;
  PyObject *__pyx_v_smaller = NULL;
  PyObject *__pyx_v_bigger = NULL;
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("isdisjoint", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "pyredblack/redblack.pyx":156
 *         is the empty set.
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             other = rbset(other)
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":157
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)             # <<<<<<<<<<<<<<
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),
 *                                               (len(other), other)])
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":158
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),             # <<<<<<<<<<<<<<
 *                                               (len(other), other)])
 *         for elem in smaller:
 */
  __pyx_t_6 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_5 = 0;

  /* "pyredblack/redblack.pyx":159
 *             other = rbset(other)
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),
 *                                               (len(other), other)])             # <<<<<<<<<<<<<<
 *         for elem in smaller:
 *             if elem in bigger:
 */
  __pyx_t_6 = PyObject_Length(__pyx_v_other); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_other);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_other);
  __Pyx_GIVEREF(__pyx_v_other);
  __pyx_t_5 = 0;

  /* "pyredblack/redblack.pyx":158
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),             # <<<<<<<<<<<<<<
 *                                               (len(other), other)])
 *         for elem in smaller:
 */
  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_4 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__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 = 158; __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_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
    index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_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 = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L8_unpacking_done:;
  }
  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 = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_10);
    #else
    __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    #endif
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_11 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_9 = Py_TYPE(__pyx_t_11)->tp_iternext;
    index = 0; __pyx_t_8 = __pyx_t_9(__pyx_t_11); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    index = 1; __pyx_t_10 = __pyx_t_9(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_10);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = 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_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L10_unpacking_done:;
  }
  __pyx_v__d = __pyx_t_8;
  __pyx_t_8 = 0;
  __pyx_v_smaller = __pyx_t_10;
  __pyx_t_10 = 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 = 158; __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_8 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_8);
    #else
    __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_9 = Py_TYPE(__pyx_t_11)->tp_iternext;
    index = 0; __pyx_t_10 = __pyx_t_9(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_10);
    index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_11); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L12_unpacking_done;
    __pyx_L11_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L12_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v__d, __pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_v_bigger = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "pyredblack/redblack.pyx":160
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),
 *                                               (len(other), other)])
 *         for elem in smaller:             # <<<<<<<<<<<<<<
 *             if elem in bigger:
 *                 return False
 */
  if (likely(PyList_CheckExact(__pyx_v_smaller)) || PyTuple_CheckExact(__pyx_v_smaller)) {
    __pyx_t_5 = __pyx_v_smaller; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
    __pyx_t_12 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_smaller); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_12 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_12)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_12(__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 = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pyredblack/redblack.pyx":161
 *                                               (len(other), other)])
 *         for elem in smaller:
 *             if elem in bigger:             # <<<<<<<<<<<<<<
 *                 return False
 *         return True
 */
    __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_v_elem, __pyx_v_bigger, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = (__pyx_t_3 != 0);
    if (__pyx_t_1) {

      /* "pyredblack/redblack.pyx":162
 *         for elem in smaller:
 *             if elem in bigger:
 *                 return False             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L0;
    }

    /* "pyredblack/redblack.pyx":160
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),
 *                                               (len(other), other)])
 *         for elem in smaller:             # <<<<<<<<<<<<<<
 *             if elem in bigger:
 *                 return False
 */
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pyredblack/redblack.pyx":163
 *             if elem in bigger:
 *                 return False
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def issubset(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":150
 *         self._num_nodes = 0
 * 
 *     def isdisjoint(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return True if the set has no elements in common with
 */

  /* 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_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.isdisjoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v__d);
  __Pyx_XDECREF(__pyx_v_smaller);
  __Pyx_XDECREF(__pyx_v_bigger);
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":165
 *         return True
 * 
 *     def issubset(self, other):             # <<<<<<<<<<<<<<
 *         '''Test whether every element in the set is in `other`.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_26issubset(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_25issubset[] = "Test whether every element in the set is in `other`.";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_26issubset(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("issubset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_25issubset(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_25issubset(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("issubset", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "pyredblack/redblack.pyx":167
 *     def issubset(self, other):
 *         '''Test whether every element in the set is in `other`.'''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             other = rbset(other)
 *         return self.__le__(other)
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":168
 *         '''Test whether every element in the set is in `other`.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)             # <<<<<<<<<<<<<<
 *         return self.__le__(other)
 * 
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":169
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)
 *         return self.__le__(other)             # <<<<<<<<<<<<<<
 * 
 *     def issuperset(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_le); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __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_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __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 = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __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 = 169; __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_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":165
 *         return True
 * 
 *     def issubset(self, other):             # <<<<<<<<<<<<<<
 *         '''Test whether every element in the set is in `other`.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.issubset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":171
 *         return self.__le__(other)
 * 
 *     def issuperset(self, other):             # <<<<<<<<<<<<<<
 *         '''Test whether every element in `other` is in the set.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_28issuperset(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_27issuperset[] = "Test whether every element in `other` is in the set.";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_28issuperset(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("issuperset (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_27issuperset(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_27issuperset(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("issuperset", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "pyredblack/redblack.pyx":173
 *     def issuperset(self, other):
 *         '''Test whether every element in `other` is in the set.'''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             other = rbset(other)
 *         return self.__ge__(other)
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":174
 *         '''Test whether every element in `other` is in the set.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)             # <<<<<<<<<<<<<<
 *         return self.__ge__(other)
 * 
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":175
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)
 *         return self.__ge__(other)             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, other, op):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ge); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __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_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __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 = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __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 = 175; __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_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":171
 *         return self.__le__(other)
 * 
 *     def issuperset(self, other):             # <<<<<<<<<<<<<<
 *         '''Test whether every element in `other` is in the set.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.issuperset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":177
 *         return self.__ge__(other)
 * 
 *     def __richcmp__(self, other, op):             # <<<<<<<<<<<<<<
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             return False
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_30__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_op); /*proto*/
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_30__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_op) {
  PyObject *__pyx_v_op = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_v_op = __Pyx_PyInt_From_int(__pyx_arg_op); if (unlikely(!__pyx_v_op)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __Pyx_GOTREF(__pyx_v_op);
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyredblack.redblack.rbset.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_29__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_op));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_29__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_op) {
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_v_it1 = NULL;
  PyObject *__pyx_v_it2 = NULL;
  PyObject *__pyx_v_elem1 = NULL;
  PyObject *__pyx_v_elem2 = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  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("__richcmp__", 0);

  /* "pyredblack/redblack.pyx":178
 * 
 *     def __richcmp__(self, other, op):
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             return False
 *         if op == 0:
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":179
 *     def __richcmp__(self, other, op):
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             return False             # <<<<<<<<<<<<<<
 *         if op == 0:
 *             # LT: Test whether the set is a proper subset of `other`,
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":180
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             return False
 *         if op == 0:             # <<<<<<<<<<<<<<
 *             # LT: Test whether the set is a proper subset of `other`,
 *             # that is, `set <= other` and `set != other`.
 */
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_op, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":183
 *             # LT: Test whether the set is a proper subset of `other`,
 *             # that is, `set <= other` and `set != other`.
 *             for elem in self:             # <<<<<<<<<<<<<<
 *                 if not elem in other:
 *                     return False
 */
    if (likely(PyList_CheckExact(__pyx_v_self)) || PyTuple_CheckExact(__pyx_v_self)) {
      __pyx_t_4 = __pyx_v_self; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __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 = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    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_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        }
      } else {
        __pyx_t_7 = __pyx_t_6(__pyx_t_4);
        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 = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pyredblack/redblack.pyx":184
 *             # that is, `set <= other` and `set != other`.
 *             for elem in self:
 *                 if not elem in other:             # <<<<<<<<<<<<<<
 *                     return False
 *             for elem in other:
 */
      __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_v_elem, __pyx_v_other, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "pyredblack/redblack.pyx":185
 *             for elem in self:
 *                 if not elem in other:
 *                     return False             # <<<<<<<<<<<<<<
 *             for elem in other:
 *                 if elem not in self:
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L0;
      }

      /* "pyredblack/redblack.pyx":183
 *             # LT: Test whether the set is a proper subset of `other`,
 *             # that is, `set <= other` and `set != other`.
 *             for elem in self:             # <<<<<<<<<<<<<<
 *                 if not elem in other:
 *                     return False
 */
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pyredblack/redblack.pyx":186
 *                 if not elem in other:
 *                     return False
 *             for elem in other:             # <<<<<<<<<<<<<<
 *                 if elem not in self:
 *                     return True
 */
    if (likely(PyList_CheckExact(__pyx_v_other)) || PyTuple_CheckExact(__pyx_v_other)) {
      __pyx_t_4 = __pyx_v_other; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __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 = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    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_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        }
      } else {
        __pyx_t_7 = __pyx_t_6(__pyx_t_4);
        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 = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pyredblack/redblack.pyx":187
 *                     return False
 *             for elem in other:
 *                 if elem not in self:             # <<<<<<<<<<<<<<
 *                     return True
 *             return False
 */
      __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_elem, __pyx_v_self, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = (__pyx_t_1 != 0);
      if (__pyx_t_3) {

        /* "pyredblack/redblack.pyx":188
 *             for elem in other:
 *                 if elem not in self:
 *                     return True             # <<<<<<<<<<<<<<
 *             return False
 *         elif op == 1:
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_True);
        __pyx_r = Py_True;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L0;
      }

      /* "pyredblack/redblack.pyx":186
 *                 if not elem in other:
 *                     return False
 *             for elem in other:             # <<<<<<<<<<<<<<
 *                 if elem not in self:
 *                     return True
 */
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pyredblack/redblack.pyx":189
 *                 if elem not in self:
 *                     return True
 *             return False             # <<<<<<<<<<<<<<
 *         elif op == 1:
 *             # LE: Test whether every element in the set is in `other`.
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":190
 *                     return True
 *             return False
 *         elif op == 1:             # <<<<<<<<<<<<<<
 *             # LE: Test whether every element in the set is in `other`.
 *             for elem in self:
 */
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_op, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":192
 *         elif op == 1:
 *             # LE: Test whether every element in the set is in `other`.
 *             for elem in self:             # <<<<<<<<<<<<<<
 *                 if not elem in other:
 *                     return False
 */
    if (likely(PyList_CheckExact(__pyx_v_self)) || PyTuple_CheckExact(__pyx_v_self)) {
      __pyx_t_4 = __pyx_v_self; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __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 = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    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_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        }
      } else {
        __pyx_t_7 = __pyx_t_6(__pyx_t_4);
        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 = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pyredblack/redblack.pyx":193
 *             # LE: Test whether every element in the set is in `other`.
 *             for elem in self:
 *                 if not elem in other:             # <<<<<<<<<<<<<<
 *                     return False
 *             return True
 */
      __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_v_elem, __pyx_v_other, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "pyredblack/redblack.pyx":194
 *             for elem in self:
 *                 if not elem in other:
 *                     return False             # <<<<<<<<<<<<<<
 *             return True
 *         elif op == 2:
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L0;
      }

      /* "pyredblack/redblack.pyx":192
 *         elif op == 1:
 *             # LE: Test whether every element in the set is in `other`.
 *             for elem in self:             # <<<<<<<<<<<<<<
 *                 if not elem in other:
 *                     return False
 */
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pyredblack/redblack.pyx":195
 *                 if not elem in other:
 *                     return False
 *             return True             # <<<<<<<<<<<<<<
 *         elif op == 2:
 *             # EQ: Test for equality
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":196
 *                     return False
 *             return True
 *         elif op == 2:             # <<<<<<<<<<<<<<
 *             # EQ: Test for equality
 *             if len(self) != len(other):
 */
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_op, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "pyredblack/redblack.pyx":198
 *         elif op == 2:
 *             # EQ: Test for equality
 *             if len(self) != len(other):             # <<<<<<<<<<<<<<
 *                 return False
 *             it1 = iter(self)
 */
    __pyx_t_5 = PyObject_Length(__pyx_v_self); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = PyObject_Length(__pyx_v_other); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = ((__pyx_t_5 != __pyx_t_8) != 0);
    if (__pyx_t_1) {

      /* "pyredblack/redblack.pyx":199
 *             # EQ: Test for equality
 *             if len(self) != len(other):
 *                 return False             # <<<<<<<<<<<<<<
 *             it1 = iter(self)
 *             it2 = iter(other)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L0;
    }

    /* "pyredblack/redblack.pyx":200
 *             if len(self) != len(other):
 *                 return False
 *             it1 = iter(self)             # <<<<<<<<<<<<<<
 *             it2 = iter(other)
 *             while True:
 */
    __pyx_t_4 = PyObject_GetIter(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_it1 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pyredblack/redblack.pyx":201
 *                 return False
 *             it1 = iter(self)
 *             it2 = iter(other)             # <<<<<<<<<<<<<<
 *             while True:
 *                 try:
 */
    __pyx_t_4 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_it2 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pyredblack/redblack.pyx":202
 *             it1 = iter(self)
 *             it2 = iter(other)
 *             while True:             # <<<<<<<<<<<<<<
 *                 try:
 *                     elem1 = next(it1)
 */
    while (1) {

      /* "pyredblack/redblack.pyx":203
 *             it2 = iter(other)
 *             while True:
 *                 try:             # <<<<<<<<<<<<<<
 *                     elem1 = next(it1)
 *                     elem2 = next(it2)
 */
      {
        __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:*/ {

          /* "pyredblack/redblack.pyx":204
 *             while True:
 *                 try:
 *                     elem1 = next(it1)             # <<<<<<<<<<<<<<
 *                     elem2 = next(it2)
 *                     if elem1 != elem2:
 */
          __pyx_t_4 = __Pyx_PyIter_Next(__pyx_v_it1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_XDECREF_SET(__pyx_v_elem1, __pyx_t_4);
          __pyx_t_4 = 0;

          /* "pyredblack/redblack.pyx":205
 *                 try:
 *                     elem1 = next(it1)
 *                     elem2 = next(it2)             # <<<<<<<<<<<<<<
 *                     if elem1 != elem2:
 *                         return False
 */
          __pyx_t_4 = __Pyx_PyIter_Next(__pyx_v_it2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_XDECREF_SET(__pyx_v_elem2, __pyx_t_4);
          __pyx_t_4 = 0;

          /* "pyredblack/redblack.pyx":206
 *                     elem1 = next(it1)
 *                     elem2 = next(it2)
 *                     if elem1 != elem2:             # <<<<<<<<<<<<<<
 *                         return False
 *                 except StopIteration:
 */
          __pyx_t_4 = PyObject_RichCompare(__pyx_v_elem1, __pyx_v_elem2, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
          __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (__pyx_t_1) {

            /* "pyredblack/redblack.pyx":207
 *                     elem2 = next(it2)
 *                     if elem1 != elem2:
 *                         return False             # <<<<<<<<<<<<<<
 *                 except StopIteration:
 *                     break
 */
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(Py_False);
            __pyx_r = Py_False;
            goto __pyx_L24_try_return;
          }
        }
        __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_L27_try_end;
        __pyx_L20_error:;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "pyredblack/redblack.pyx":208
 *                     if elem1 != elem2:
 *                         return False
 *                 except StopIteration:             # <<<<<<<<<<<<<<
 *                     break
 *             return True
 */
        __pyx_t_12 = PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
        if (__pyx_t_12) {
          __Pyx_AddTraceback("pyredblack.redblack.rbset.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GOTREF(__pyx_t_13);

          /* "pyredblack/redblack.pyx":209
 *                         return False
 *                 except StopIteration:
 *                     break             # <<<<<<<<<<<<<<
 *             return True
 *         elif op == 3:
 */
          goto __pyx_L29_except_break;
          __pyx_L29_except_break:;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L25_try_break;
        }
        goto __pyx_L22_except_error;
        __pyx_L22_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_L25_try_break:;
        __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_L19_break;
        __pyx_L24_try_return:;
        __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_L0;
        __pyx_L27_try_end:;
      }
    }
    __pyx_L19_break:;

    /* "pyredblack/redblack.pyx":210
 *                 except StopIteration:
 *                     break
 *             return True             # <<<<<<<<<<<<<<
 *         elif op == 3:
 *             # NEQ: Test for inequality
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":211
 *                     break
 *             return True
 *         elif op == 3:             # <<<<<<<<<<<<<<
 *             # NEQ: Test for inequality
 *             return not self.__eq__(other)
 */
  __pyx_t_13 = PyObject_RichCompare(__pyx_v_op, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (__pyx_t_1) {

    /* "pyredblack/redblack.pyx":213
 *         elif op == 3:
 *             # NEQ: Test for inequality
 *             return not self.__eq__(other)             # <<<<<<<<<<<<<<
 *         elif op == 4:
 *             # GT: Test whether the set is a proper superset of
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_eq); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __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_13 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_other); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
    } else {
      __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_14, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = __Pyx_PyBool_FromLong((!__pyx_t_1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_r = __pyx_t_13;
    __pyx_t_13 = 0;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":214
 *             # NEQ: Test for inequality
 *             return not self.__eq__(other)
 *         elif op == 4:             # <<<<<<<<<<<<<<
 *             # GT: Test whether the set is a proper superset of
 *             # `other`, that is, `set >= other` and `set != other`.
 */
  __pyx_t_13 = PyObject_RichCompare(__pyx_v_op, __pyx_int_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (__pyx_t_1) {

    /* "pyredblack/redblack.pyx":217
 *             # GT: Test whether the set is a proper superset of
 *             # `other`, that is, `set >= other` and `set != other`.
 *             for elem in other:             # <<<<<<<<<<<<<<
 *                 if not elem in self:
 *                     return False
 */
    if (likely(PyList_CheckExact(__pyx_v_other)) || PyTuple_CheckExact(__pyx_v_other)) {
      __pyx_t_13 = __pyx_v_other; __Pyx_INCREF(__pyx_t_13); __pyx_t_8 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_6 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_13))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_13)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_13, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_13)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_13, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        }
      } else {
        __pyx_t_7 = __pyx_t_6(__pyx_t_13);
        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 = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pyredblack/redblack.pyx":218
 *             # `other`, that is, `set >= other` and `set != other`.
 *             for elem in other:
 *                 if not elem in self:             # <<<<<<<<<<<<<<
 *                     return False
 *             for elem in self:
 */
      __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_elem, __pyx_v_self, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = (__pyx_t_1 != 0);
      if (__pyx_t_3) {

        /* "pyredblack/redblack.pyx":219
 *             for elem in other:
 *                 if not elem in self:
 *                     return False             # <<<<<<<<<<<<<<
 *             for elem in self:
 *                 if elem not in other:
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L0;
      }

      /* "pyredblack/redblack.pyx":217
 *             # GT: Test whether the set is a proper superset of
 *             # `other`, that is, `set >= other` and `set != other`.
 *             for elem in other:             # <<<<<<<<<<<<<<
 *                 if not elem in self:
 *                     return False
 */
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "pyredblack/redblack.pyx":220
 *                 if not elem in self:
 *                     return False
 *             for elem in self:             # <<<<<<<<<<<<<<
 *                 if elem not in other:
 *                     return True
 */
    if (likely(PyList_CheckExact(__pyx_v_self)) || PyTuple_CheckExact(__pyx_v_self)) {
      __pyx_t_13 = __pyx_v_self; __Pyx_INCREF(__pyx_t_13); __pyx_t_8 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_v_self); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_6 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_13))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_13)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_13, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_13)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_13, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        }
      } else {
        __pyx_t_7 = __pyx_t_6(__pyx_t_13);
        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 = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pyredblack/redblack.pyx":221
 *                     return False
 *             for elem in self:
 *                 if elem not in other:             # <<<<<<<<<<<<<<
 *                     return True
 *             return False
 */
      __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_v_elem, __pyx_v_other, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "pyredblack/redblack.pyx":222
 *             for elem in self:
 *                 if elem not in other:
 *                     return True             # <<<<<<<<<<<<<<
 *             return False
 *         elif op == 5:
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_True);
        __pyx_r = Py_True;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L0;
      }

      /* "pyredblack/redblack.pyx":220
 *                 if not elem in self:
 *                     return False
 *             for elem in self:             # <<<<<<<<<<<<<<
 *                 if elem not in other:
 *                     return True
 */
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "pyredblack/redblack.pyx":223
 *                 if elem not in other:
 *                     return True
 *             return False             # <<<<<<<<<<<<<<
 *         elif op == 5:
 *             # GE: Test whether every element in `other` is in the set.
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":224
 *                     return True
 *             return False
 *         elif op == 5:             # <<<<<<<<<<<<<<
 *             # GE: Test whether every element in `other` is in the set.
 *             for elem in other:
 */
  __pyx_t_13 = PyObject_RichCompare(__pyx_v_op, __pyx_int_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (__pyx_t_1) {

    /* "pyredblack/redblack.pyx":226
 *         elif op == 5:
 *             # GE: Test whether every element in `other` is in the set.
 *             for elem in other:             # <<<<<<<<<<<<<<
 *                 if not elem in self:
 *                     return False
 */
    if (likely(PyList_CheckExact(__pyx_v_other)) || PyTuple_CheckExact(__pyx_v_other)) {
      __pyx_t_13 = __pyx_v_other; __Pyx_INCREF(__pyx_t_13); __pyx_t_8 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_6 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_13))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_13)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_13, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_13)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_13, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        }
      } else {
        __pyx_t_7 = __pyx_t_6(__pyx_t_13);
        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 = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pyredblack/redblack.pyx":227
 *             # GE: Test whether every element in `other` is in the set.
 *             for elem in other:
 *                 if not elem in self:             # <<<<<<<<<<<<<<
 *                     return False
 *             return True
 */
      __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_elem, __pyx_v_self, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = (__pyx_t_1 != 0);
      if (__pyx_t_3) {

        /* "pyredblack/redblack.pyx":228
 *             for elem in other:
 *                 if not elem in self:
 *                     return False             # <<<<<<<<<<<<<<
 *             return True
 *         raise NotImplementedError
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L0;
      }

      /* "pyredblack/redblack.pyx":226
 *         elif op == 5:
 *             # GE: Test whether every element in `other` is in the set.
 *             for elem in other:             # <<<<<<<<<<<<<<
 *                 if not elem in self:
 *                     return False
 */
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "pyredblack/redblack.pyx":229
 *                 if not elem in self:
 *                     return False
 *             return True             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":230
 *                     return False
 *             return True
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def union(self, other, *others):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyredblack/redblack.pyx":177
 *         return self.__ge__(other)
 * 
 *     def __richcmp__(self, other, op):             # <<<<<<<<<<<<<<
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             return False
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XDECREF(__pyx_v_it1);
  __Pyx_XDECREF(__pyx_v_it2);
  __Pyx_XDECREF(__pyx_v_elem1);
  __Pyx_XDECREF(__pyx_v_elem2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":232
 *         raise NotImplementedError
 * 
 *     def union(self, other, *others):             # <<<<<<<<<<<<<<
 *         '''Return a new set with elements from the set and all others.'''
 *         rv = rbset(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_32union(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_31union[] = "Return a new set with elements from the set and all others.";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_32union(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_other = 0;
  PyObject *__pyx_v_others = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("union (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_others = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_others)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_others);
  } else {
    __pyx_v_others = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_other,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_other)) != 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, 0, values, used_pos_args, "union") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __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_other = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("union", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_others); __pyx_v_others = 0;
  __Pyx_AddTraceback("pyredblack.redblack.rbset.union", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_31union(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), __pyx_v_other, __pyx_v_others);

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_31union(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_others) {
  struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_rv = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("union", 0);

  /* "pyredblack/redblack.pyx":234
 *     def union(self, other, *others):
 *         '''Return a new set with elements from the set and all others.'''
 *         rv = rbset(self)             # <<<<<<<<<<<<<<
 *         rv.update(other, others)
 *         return rv
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rv = ((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyredblack/redblack.pyx":235
 *         '''Return a new set with elements from the set and all others.'''
 *         rv = rbset(self)
 *         rv.update(other, others)             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rv), __pyx_n_s_update); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __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 && 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);
      __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 = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_3) {
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_v_other);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_other);
  __Pyx_GIVEREF(__pyx_v_other);
  __Pyx_INCREF(__pyx_v_others);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_others);
  __Pyx_GIVEREF(__pyx_v_others);
  __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 = 235; __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(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyredblack/redblack.pyx":236
 *         rv = rbset(self)
 *         rv.update(other, others)
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def __or__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_rv));
  __pyx_r = ((PyObject *)__pyx_v_rv);
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":232
 *         raise NotImplementedError
 * 
 *     def union(self, other, *others):             # <<<<<<<<<<<<<<
 *         '''Return a new set with elements from the set and all others.'''
 *         rv = rbset(self)
 */

  /* 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("pyredblack.redblack.rbset.union", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":238
 *         return rv
 * 
 *     def __or__(self, other):             # <<<<<<<<<<<<<<
 *         '''Return a new set with elements from the set and all others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_34__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_33__or__[] = "Return a new set with elements from the set and all others.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_5rbset_33__or__;
#endif
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_34__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__or__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_33__or__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_33__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("__or__", 0);

  /* "pyredblack/redblack.pyx":240
 *     def __or__(self, other):
 *         '''Return a new set with elements from the set and all others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             raise TypeError('unsupported operand type(s) for |')
 *         rv = rbset(self)
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":241
 *         '''Return a new set with elements from the set and all others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for |')             # <<<<<<<<<<<<<<
 *         rv = rbset(self)
 *         rv.update(other)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __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 = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyredblack/redblack.pyx":242
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for |')
 *         rv = rbset(self)             # <<<<<<<<<<<<<<
 *         rv.update(other)
 *         return rv
 */
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_rv = ((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pyredblack/redblack.pyx":243
 *             raise TypeError('unsupported operand type(s) for |')
 *         rv = rbset(self)
 *         rv.update(other)             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rv), __pyx_n_s_update); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __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_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __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 = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __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 = 243; __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_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pyredblack/redblack.pyx":244
 *         rv = rbset(self)
 *         rv.update(other)
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def intersection(self, other, *others):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_rv));
  __pyx_r = ((PyObject *)__pyx_v_rv);
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":238
 *         return rv
 * 
 *     def __or__(self, other):             # <<<<<<<<<<<<<<
 *         '''Return a new set with elements from the set and all others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.__or__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":246
 *         return rv
 * 
 *     def intersection(self, other, *others):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements common to the set and all others.
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_36intersection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_35intersection[] = "\n        Return a new set with elements common to the set and all others.\n        ";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_36intersection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_other = 0;
  CYTHON_UNUSED PyObject *__pyx_v_others = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("intersection (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_others = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_others)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_others);
  } else {
    __pyx_v_others = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_other,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_other)) != 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, 0, values, used_pos_args, "intersection") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __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_other = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("intersection", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_others); __pyx_v_others = 0;
  __Pyx_AddTraceback("pyredblack.redblack.rbset.intersection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_35intersection(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), __pyx_v_other, __pyx_v_others);

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_35intersection(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other, CYTHON_UNUSED PyObject *__pyx_v_others) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("intersection", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "pyredblack/redblack.pyx":250
 *         Return a new set with elements common to the set and all others.
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             other = rbset(other)
 *         return self.__and__(other)
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":251
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)             # <<<<<<<<<<<<<<
 *         return self.__and__(other)
 * 
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":252
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)
 *         return self.__and__(other)             # <<<<<<<<<<<<<<
 * 
 *     def __and__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_and); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __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_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __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 = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __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 = 252; __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_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":246
 *         return rv
 * 
 *     def intersection(self, other, *others):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements common to the set and all others.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.intersection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":254
 *         return self.__and__(other)
 * 
 *     def __and__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements common to the set and all others.
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_38__and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_37__and__[] = "\n        Return a new set with elements common to the set and all others.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_5rbset_37__and__;
#endif
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_38__and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__and__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_37__and__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

/* "pyredblack/redblack.pyx":262
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),
 *                                               (len(other), other)])
 *         return rbset(elem for elem in smaller if elem in bigger)             # <<<<<<<<<<<<<<
 * 
 *     def difference(self, other, *others):
 */

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_7__and___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_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_10pyredblack_8redblack___pyx_scope_struct_2_genexpr *)__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_2_genexpr(__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_2_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_10pyredblack_8redblack___pyx_scope_struct_1___and__ *) __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_10pyredblack_8redblack_5rbset_7__and___2generator4, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_and___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __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("pyredblack.redblack.rbset.__and__.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_10pyredblack_8redblack_5rbset_7__and___2generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  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_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 = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_smaller)) { __Pyx_RaiseClosureNameError("smaller"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_smaller)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_smaller)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_smaller; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_smaller); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__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 = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_bigger)) { __Pyx_RaiseClosureNameError("bigger"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_5 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_elem, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_bigger, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (__pyx_t_6) {
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_elem);
      __pyx_r = __pyx_cur_scope->__pyx_v_elem;
      __Pyx_XGIVEREF(__pyx_t_1);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
      __pyx_cur_scope->__pyx_t_2 = __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_1 = __pyx_cur_scope->__pyx_t_0;
      __pyx_cur_scope->__pyx_t_0 = 0;
      __Pyx_XGOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "pyredblack/redblack.pyx":254
 *         return self.__and__(other)
 * 
 *     def __and__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements common to the set and all others.
 */

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_37__and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__ *__pyx_cur_scope;
  CYTHON_UNUSED PyObject *__pyx_v__d = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  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)(PyObject *);
  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("__and__", 0);
  __pyx_cur_scope = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__ *)__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_1___and__(__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_1___and__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);

  /* "pyredblack/redblack.pyx":258
 *         Return a new set with elements common to the set and all others.
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             raise TypeError('unsupported operand type(s) for &')
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":259
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for &')             # <<<<<<<<<<<<<<
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),
 *                                               (len(other), other)])
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __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 = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyredblack/redblack.pyx":260
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for &')
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),             # <<<<<<<<<<<<<<
 *                                               (len(other), other)])
 *         return rbset(elem for elem in smaller if elem in bigger)
 */
  __pyx_t_5 = PyObject_Length(__pyx_v_self); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_4 = 0;

  /* "pyredblack/redblack.pyx":261
 *             raise TypeError('unsupported operand type(s) for &')
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),
 *                                               (len(other), other)])             # <<<<<<<<<<<<<<
 *         return rbset(elem for elem in smaller if elem in bigger)
 * 
 */
  __pyx_t_5 = PyObject_Length(__pyx_v_other); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_other);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_other);
  __Pyx_GIVEREF(__pyx_v_other);
  __pyx_t_4 = 0;

  /* "pyredblack/redblack.pyx":260
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for &')
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),             # <<<<<<<<<<<<<<
 *                                               (len(other), other)])
 *         return rbset(elem for elem in smaller if elem in bigger)
 */
  __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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 = 260; __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_6 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    #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 = 260; __pyx_clineno = __LINE__; goto __pyx_L1_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_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    index = 1; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L7_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 = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_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 = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L8_unpacking_done:;
  }
  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 = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_10);
    #else
    __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    #endif
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_11 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_9 = Py_TYPE(__pyx_t_11)->tp_iternext;
    index = 0; __pyx_t_8 = __pyx_t_9(__pyx_t_11); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    index = 1; __pyx_t_10 = __pyx_t_9(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_10);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = 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_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L10_unpacking_done:;
  }
  __pyx_v__d = __pyx_t_8;
  __pyx_t_8 = 0;
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_cur_scope->__pyx_v_smaller = __pyx_t_10;
  __pyx_t_10 = 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 = 260; __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_8 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_8);
    #else
    __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    #endif
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_9 = Py_TYPE(__pyx_t_11)->tp_iternext;
    index = 0; __pyx_t_10 = __pyx_t_9(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_10);
    index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_11); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L12_unpacking_done;
    __pyx_L11_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L12_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v__d, __pyx_t_10);
  __pyx_t_10 = 0;
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_cur_scope->__pyx_v_bigger = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "pyredblack/redblack.pyx":262
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),
 *                                               (len(other), other)])
 *         return rbset(elem for elem in smaller if elem in bigger)             # <<<<<<<<<<<<<<
 * 
 *     def difference(self, other, *others):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __pyx_pf_10pyredblack_8redblack_5rbset_7__and___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":254
 *         return self.__and__(other)
 * 
 *     def __and__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements common to the set and all others.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.__and__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v__d);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":264
 *         return rbset(elem for elem in smaller if elem in bigger)
 * 
 *     def difference(self, other, *others):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements in the set that are not in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_40difference(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_39difference[] = "\n        Return a new set with elements in the set that are not in the\n        others.\n        ";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_40difference(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_other = 0;
  CYTHON_UNUSED PyObject *__pyx_v_others = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("difference (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_others = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_others)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_others);
  } else {
    __pyx_v_others = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_other,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_other)) != 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, 0, values, used_pos_args, "difference") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __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_other = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("difference", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_others); __pyx_v_others = 0;
  __Pyx_AddTraceback("pyredblack.redblack.rbset.difference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_39difference(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), __pyx_v_other, __pyx_v_others);

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_39difference(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other, CYTHON_UNUSED PyObject *__pyx_v_others) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("difference", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "pyredblack/redblack.pyx":269
 *         others.
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             other = rbset(other)
 *         return self.__sub__(other)
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":270
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)             # <<<<<<<<<<<<<<
 *         return self.__sub__(other)
 * 
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":271
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)
 *         return self.__sub__(other)             # <<<<<<<<<<<<<<
 * 
 *     def __sub__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_sub); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __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_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __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 = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __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 = 271; __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_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":264
 *         return rbset(elem for elem in smaller if elem in bigger)
 * 
 *     def difference(self, other, *others):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements in the set that are not in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.difference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":273
 *         return self.__sub__(other)
 * 
 *     def __sub__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements in the set that are not in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_42__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_41__sub__[] = "\n        Return a new set with elements in the set that are not in the\n        others.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_5rbset_41__sub__;
#endif
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_42__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_41__sub__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

/* "pyredblack/redblack.pyx":280
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for -')
 *         return rbset(elem for elem in self if elem not in other)             # <<<<<<<<<<<<<<
 * 
 *     def symmetric_difference(self, other):
 */

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_7__sub___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_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_10pyredblack_8redblack___pyx_scope_struct_4_genexpr *)__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_4_genexpr(__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_4_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_10pyredblack_8redblack___pyx_scope_struct_3___sub__ *) __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_10pyredblack_8redblack_5rbset_7__sub___2generator5, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_sub___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __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("pyredblack.redblack.rbset.__sub__.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_10pyredblack_8redblack_5rbset_7__sub___2generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_genexpr *__pyx_cur_scope = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  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_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 = 280; __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 = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_self; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self); 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_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__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 = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_other)) { __Pyx_RaiseClosureNameError("other"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_5 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_elem, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_other, Py_NE)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (__pyx_t_6) {
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_elem);
      __pyx_r = __pyx_cur_scope->__pyx_v_elem;
      __Pyx_XGIVEREF(__pyx_t_1);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
      __pyx_cur_scope->__pyx_t_2 = __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_1 = __pyx_cur_scope->__pyx_t_0;
      __pyx_cur_scope->__pyx_t_0 = 0;
      __Pyx_XGOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "pyredblack/redblack.pyx":273
 *         return self.__sub__(other)
 * 
 *     def __sub__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements in the set that are not in the
 */

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_41__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__ *__pyx_cur_scope;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__sub__", 0);
  __pyx_cur_scope = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__ *)__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_3___sub__(__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_3___sub__, __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_other = __pyx_v_other;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_other);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_other);

  /* "pyredblack/redblack.pyx":278
 *         others.
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             raise TypeError('unsupported operand type(s) for -')
 *         return rbset(elem for elem in self if elem not in other)
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_other;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PySet_Check(__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_cur_scope->__pyx_v_other;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = PyFrozenSet_Check(__pyx_t_2); 
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_other;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_t_2, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  __pyx_t_4 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_4) {

    /* "pyredblack/redblack.pyx":279
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for -')             # <<<<<<<<<<<<<<
 *         return rbset(elem for elem in self if elem not in other)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyredblack/redblack.pyx":280
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for -')
 *         return rbset(elem for elem in self if elem not in other)             # <<<<<<<<<<<<<<
 * 
 *     def symmetric_difference(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_pf_10pyredblack_8redblack_5rbset_7__sub___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":273
 *         return self.__sub__(other)
 * 
 *     def __sub__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements in the set that are not in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.__sub__", __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;
}

/* "pyredblack/redblack.pyx":282
 *         return rbset(elem for elem in self if elem not in other)
 * 
 *     def symmetric_difference(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements in either the set or `other` but
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_44symmetric_difference(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_43symmetric_difference[] = "\n        Return a new set with elements in either the set or `other` but\n        not both.\n        ";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_44symmetric_difference(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("symmetric_difference (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_43symmetric_difference(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_43symmetric_difference(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("symmetric_difference", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "pyredblack/redblack.pyx":287
 *         not both.
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             other = rbset(other)
 *         return self.__xor__(other)
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":288
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)             # <<<<<<<<<<<<<<
 *         return self.__xor__(other)
 * 
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":289
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)
 *         return self.__xor__(other)             # <<<<<<<<<<<<<<
 * 
 *     def __xor__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_xor); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __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_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __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 = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __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 = 289; __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_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":282
 *         return rbset(elem for elem in self if elem not in other)
 * 
 *     def symmetric_difference(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements in either the set or `other` but
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.symmetric_difference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":291
 *         return self.__xor__(other)
 * 
 *     def __xor__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements in either the set or `other` but
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_46__xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_45__xor__[] = "\n        Return a new set with elements in either the set or `other` but\n        not both.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_5rbset_45__xor__;
#endif
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_46__xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__xor__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_45__xor__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

/* "pyredblack/redblack.pyx":298
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for ^')
 *         rv = rbset(elem for elem in self if elem not in other)             # <<<<<<<<<<<<<<
 *         rv.update(elem for elem in other if elem not in self)
 *         return rv
 */

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_7__xor___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_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_10pyredblack_8redblack___pyx_scope_struct_6_genexpr *)__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_6_genexpr(__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_6_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_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *) __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_10pyredblack_8redblack_5rbset_7__xor___2generator6, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_xor___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __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("pyredblack.redblack.rbset.__xor__.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_10pyredblack_8redblack_5rbset_7__xor___2generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_genexpr *__pyx_cur_scope = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  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_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 = 298; __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 = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_self; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__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 = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_other)) { __Pyx_RaiseClosureNameError("other"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_5 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_elem, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_other, Py_NE)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (__pyx_t_6) {
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_elem);
      __pyx_r = __pyx_cur_scope->__pyx_v_elem;
      __Pyx_XGIVEREF(__pyx_t_1);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
      __pyx_cur_scope->__pyx_t_2 = __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_1 = __pyx_cur_scope->__pyx_t_0;
      __pyx_cur_scope->__pyx_t_0 = 0;
      __Pyx_XGOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __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_10pyredblack_8redblack_5rbset_7__xor___5generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pyredblack/redblack.pyx":299
 *             raise TypeError('unsupported operand type(s) for ^')
 *         rv = rbset(elem for elem in self if elem not in other)
 *         rv.update(elem for elem in other if elem not in self)             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_7__xor___3genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_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_10pyredblack_8redblack___pyx_scope_struct_7_genexpr *)__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_7_genexpr(__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_7_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_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *) __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_10pyredblack_8redblack_5rbset_7__xor___5generator7, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_xor___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __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("pyredblack.redblack.rbset.__xor__.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_10pyredblack_8redblack_5rbset_7__xor___5generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_genexpr *__pyx_cur_scope = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  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_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 = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_other)) { __Pyx_RaiseClosureNameError("other"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_other)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_other)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_other; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_other); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__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 = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_5 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_elem, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, Py_NE)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (__pyx_t_6) {
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_elem);
      __pyx_r = __pyx_cur_scope->__pyx_v_elem;
      __Pyx_XGIVEREF(__pyx_t_1);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
      __pyx_cur_scope->__pyx_t_2 = __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_1 = __pyx_cur_scope->__pyx_t_0;
      __pyx_cur_scope->__pyx_t_0 = 0;
      __Pyx_XGOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* "pyredblack/redblack.pyx":291
 *         return self.__xor__(other)
 * 
 *     def __xor__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements in either the set or `other` but
 */

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_45__xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *__pyx_cur_scope;
  struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_rv = NULL;
  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;
  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("__xor__", 0);
  __pyx_cur_scope = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *)__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_5___xor__(__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_5___xor__, __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_other = __pyx_v_other;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_other);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_other);

  /* "pyredblack/redblack.pyx":296
 *         not both.
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             raise TypeError('unsupported operand type(s) for ^')
 *         rv = rbset(elem for elem in self if elem not in other)
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_other;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PySet_Check(__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_cur_scope->__pyx_v_other;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = PyFrozenSet_Check(__pyx_t_2); 
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_other;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_t_2, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  __pyx_t_4 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_4) {

    /* "pyredblack/redblack.pyx":297
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for ^')             # <<<<<<<<<<<<<<
 *         rv = rbset(elem for elem in self if elem not in other)
 *         rv.update(elem for elem in other if elem not in self)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __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 = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyredblack/redblack.pyx":298
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for ^')
 *         rv = rbset(elem for elem in self if elem not in other)             # <<<<<<<<<<<<<<
 *         rv.update(elem for elem in other if elem not in self)
 *         return rv
 */
  __pyx_t_2 = __pyx_pf_10pyredblack_8redblack_5rbset_7__xor___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_rv = ((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyredblack/redblack.pyx":299
 *             raise TypeError('unsupported operand type(s) for ^')
 *         rv = rbset(elem for elem in self if elem not in other)
 *         rv.update(elem for elem in other if elem not in self)             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rv), __pyx_n_s_update); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __pyx_pf_10pyredblack_8redblack_5rbset_7__xor___3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __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_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);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __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 = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
    PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __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_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyredblack/redblack.pyx":300
 *         rv = rbset(elem for elem in self if elem not in other)
 *         rv.update(elem for elem in other if elem not in self)
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_rv));
  __pyx_r = ((PyObject *)__pyx_v_rv);
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":291
 *         return self.__xor__(other)
 * 
 *     def __xor__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Return a new set with elements in either the set or `other` but
 */

  /* function exit code */
  __pyx_L1_error:;
  __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("pyredblack.redblack.rbset.__xor__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rv);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":302
 *         return rv
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         '''Return a new set with a shallow copy of the set.'''
 *         return rbset(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_48copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_47copy[] = "Return a new set with a shallow copy of the set.";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_48copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_47copy(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_47copy(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_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("copy", 0);

  /* "pyredblack/redblack.pyx":304
 *     def copy(self):
 *         '''Return a new set with a shallow copy of the set.'''
 *         return rbset(self)             # <<<<<<<<<<<<<<
 * 
 *     def update(self, other, *others):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __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;

  /* "pyredblack/redblack.pyx":302
 *         return rv
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         '''Return a new set with a shallow copy of the set.'''
 *         return rbset(self)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":306
 *         return rbset(self)
 * 
 *     def update(self, other, *others):             # <<<<<<<<<<<<<<
 *         '''Update the set, adding elements from all others.'''
 *         if other:
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_50update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_49update[] = "Update the set, adding elements from all others.";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_50update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_other = 0;
  PyObject *__pyx_v_others = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_others = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_others)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_others);
  } else {
    __pyx_v_others = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_other,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_other)) != 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, 0, values, used_pos_args, "update") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __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_other = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_others); __pyx_v_others = 0;
  __Pyx_AddTraceback("pyredblack.redblack.rbset.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_49update(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), __pyx_v_other, __pyx_v_others);

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_49update(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_others) {
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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;
  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("update", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "pyredblack/redblack.pyx":308
 *     def update(self, other, *others):
 *         '''Update the set, adding elements from all others.'''
 *         if other:             # <<<<<<<<<<<<<<
 *             for elem in other:
 *                 self.add(elem)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_other); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "pyredblack/redblack.pyx":309
 *         '''Update the set, adding elements from all others.'''
 *         if other:
 *             for elem in other:             # <<<<<<<<<<<<<<
 *                 self.add(elem)
 *         for other in others:
 */
    if (likely(PyList_CheckExact(__pyx_v_other)) || PyTuple_CheckExact(__pyx_v_other)) {
      __pyx_t_2 = __pyx_v_other; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __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 = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    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_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_4(__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 = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "pyredblack/redblack.pyx":310
 *         if other:
 *             for elem in other:
 *                 self.add(elem)             # <<<<<<<<<<<<<<
 *         for other in others:
 *             for elem in other:
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __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_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_elem); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
      } else {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_elem);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_elem);
        __Pyx_GIVEREF(__pyx_v_elem);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __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_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pyredblack/redblack.pyx":309
 *         '''Update the set, adding elements from all others.'''
 *         if other:
 *             for elem in other:             # <<<<<<<<<<<<<<
 *                 self.add(elem)
 *         for other in others:
 */
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":311
 *             for elem in other:
 *                 self.add(elem)
 *         for other in others:             # <<<<<<<<<<<<<<
 *             for elem in other:
 *                 self.add(elem)
 */
  __pyx_t_2 = __pyx_v_others; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pyredblack/redblack.pyx":312
 *                 self.add(elem)
 *         for other in others:
 *             for elem in other:             # <<<<<<<<<<<<<<
 *                 self.add(elem)
 * 
 */
    if (likely(PyList_CheckExact(__pyx_v_other)) || PyTuple_CheckExact(__pyx_v_other)) {
      __pyx_t_5 = __pyx_v_other; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        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_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_4(__pyx_t_5);
        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 = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "pyredblack/redblack.pyx":313
 *         for other in others:
 *             for elem in other:
 *                 self.add(elem)             # <<<<<<<<<<<<<<
 * 
 *     def __ior__(self, other):
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = NULL;
      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);
        }
      }
      if (!__pyx_t_7) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_elem); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_elem);
        PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_elem);
        __Pyx_GIVEREF(__pyx_v_elem);
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "pyredblack/redblack.pyx":312
 *                 self.add(elem)
 *         for other in others:
 *             for elem in other:             # <<<<<<<<<<<<<<
 *                 self.add(elem)
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyredblack/redblack.pyx":311
 *             for elem in other:
 *                 self.add(elem)
 *         for other in others:             # <<<<<<<<<<<<<<
 *             for elem in other:
 *                 self.add(elem)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyredblack/redblack.pyx":306
 *         return rbset(self)
 * 
 *     def update(self, other, *others):             # <<<<<<<<<<<<<<
 *         '''Update the set, adding elements from all others.'''
 *         if other:
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":315
 *                 self.add(elem)
 * 
 *     def __ior__(self, other):             # <<<<<<<<<<<<<<
 *         '''Update the set, adding elements from all others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_52__ior__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_51__ior__[] = "Update the set, adding elements from all others.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_5rbset_51__ior__;
#endif
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_52__ior__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__ior__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_51__ior__(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_51__ior__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_elem = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  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 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__ior__", 0);

  /* "pyredblack/redblack.pyx":317
 *     def __ior__(self, other):
 *         '''Update the set, adding elements from all others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             raise TypeError('unsupported operand type(s) for |=')
 *         for elem in other:
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":318
 *         '''Update the set, adding elements from all others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for |=')             # <<<<<<<<<<<<<<
 *         for elem in other:
 *             self.add(elem)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __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 = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyredblack/redblack.pyx":319
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for |=')
 *         for elem in other:             # <<<<<<<<<<<<<<
 *             self.add(elem)
 * 
 */
  if (likely(PyList_CheckExact(__pyx_v_other)) || PyTuple_CheckExact(__pyx_v_other)) {
    __pyx_t_4 = __pyx_v_other; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_other); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __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 = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  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_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_7 = __pyx_t_6(__pyx_t_4);
      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 = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "pyredblack/redblack.pyx":320
 *             raise TypeError('unsupported operand type(s) for |=')
 *         for elem in other:
 *             self.add(elem)             # <<<<<<<<<<<<<<
 * 
 *     def intersection_update(self, other, *others):
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __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_7 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_elem); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL;
      __Pyx_INCREF(__pyx_v_elem);
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_elem);
      __Pyx_GIVEREF(__pyx_v_elem);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyredblack/redblack.pyx":319
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for |=')
 *         for elem in other:             # <<<<<<<<<<<<<<
 *             self.add(elem)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyredblack/redblack.pyx":315
 *                 self.add(elem)
 * 
 *     def __ior__(self, other):             # <<<<<<<<<<<<<<
 *         '''Update the set, adding elements from all others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 */

  /* 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_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.__ior__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":322
 *             self.add(elem)
 * 
 *     def intersection_update(self, other, *others):             # <<<<<<<<<<<<<<
 *         '''
 *         Update the set, keeping only elements found in it and all others.
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_54intersection_update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_53intersection_update[] = "\n        Update the set, keeping only elements found in it and all others.\n        ";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_54intersection_update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_other = 0;
  PyObject *__pyx_v_others = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("intersection_update (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_others = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_others)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_others);
  } else {
    __pyx_v_others = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_other,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_other)) != 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, 0, values, used_pos_args, "intersection_update") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __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_other = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("intersection_update", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_others); __pyx_v_others = 0;
  __Pyx_AddTraceback("pyredblack.redblack.rbset.intersection_update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_53intersection_update(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), __pyx_v_other, __pyx_v_others);

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_53intersection_update(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_others) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("intersection_update", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "pyredblack/redblack.pyx":326
 *         Update the set, keeping only elements found in it and all others.
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             other = rbset(other)
 *         self.__iand__(other)
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":327
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)             # <<<<<<<<<<<<<<
 *         self.__iand__(other)
 *         for other in others:
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":328
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)
 *         self.__iand__(other)             # <<<<<<<<<<<<<<
 *         for other in others:
 *             if not isinstance(other, (set, frozenset, rbset)):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __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_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __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 = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __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 = 328; __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_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pyredblack/redblack.pyx":329
 *             other = rbset(other)
 *         self.__iand__(other)
 *         for other in others:             # <<<<<<<<<<<<<<
 *             if not isinstance(other, (set, frozenset, rbset)):
 *                 other = rbset(other)
 */
  __pyx_t_5 = __pyx_v_others; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
  for (;;) {
    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 = 329; __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 = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pyredblack/redblack.pyx":330
 *         self.__iand__(other)
 *         for other in others:
 *             if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *                 other = rbset(other)
 *             self.__iand__(other)
 */
    __pyx_t_1 = PySet_Check(__pyx_v_other); 
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_2 = PyFrozenSet_Check(__pyx_v_other); 
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (!__pyx_t_1) {
    } else {
      __pyx_t_3 = __pyx_t_1;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
    __pyx_t_2 = (__pyx_t_1 != 0);
    __pyx_t_3 = __pyx_t_2;
    __pyx_L10_bool_binop_done:;
    __pyx_t_2 = ((!(__pyx_t_3 != 0)) != 0);
    if (__pyx_t_2) {

      /* "pyredblack/redblack.pyx":331
 *         for other in others:
 *             if not isinstance(other, (set, frozenset, rbset)):
 *                 other = rbset(other)             # <<<<<<<<<<<<<<
 *             self.__iand__(other)
 * 
 */
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_7);
      __pyx_t_7 = 0;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pyredblack/redblack.pyx":332
 *             if not isinstance(other, (set, frozenset, rbset)):
 *                 other = rbset(other)
 *             self.__iand__(other)             # <<<<<<<<<<<<<<
 * 
 *     def __iand__(self, other):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __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_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __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 = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __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_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyredblack/redblack.pyx":329
 *             other = rbset(other)
 *         self.__iand__(other)
 *         for other in others:             # <<<<<<<<<<<<<<
 *             if not isinstance(other, (set, frozenset, rbset)):
 *                 other = rbset(other)
 */
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pyredblack/redblack.pyx":322
 *             self.add(elem)
 * 
 *     def intersection_update(self, other, *others):             # <<<<<<<<<<<<<<
 *         '''
 *         Update the set, keeping only elements found in it and all others.
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.intersection_update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":334
 *             self.__iand__(other)
 * 
 *     def __iand__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Update the set, keeping only elements found in it and all others.
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_56__iand__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_55__iand__[] = "\n        Update the set, keeping only elements found in it and all others.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_5rbset_55__iand__;
#endif
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_56__iand__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iand__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_55__iand__(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_55__iand__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("__iand__", 0);

  /* "pyredblack/redblack.pyx":338
 *         Update the set, keeping only elements found in it and all others.
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             raise TypeError('unsupported operand type(s) for &=')
 *         # TODO: with access to the iterator, this could be done in one
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":339
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for &=')             # <<<<<<<<<<<<<<
 *         # TODO: with access to the iterator, this could be done in one
 *         # traversal
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __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 = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyredblack/redblack.pyx":342
 *         # TODO: with access to the iterator, this could be done in one
 *         # traversal
 *         rv = self.__and__(other)             # <<<<<<<<<<<<<<
 *         self.clear()
 *         self.update(rv)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_and); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __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_other); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __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 = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __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 = 342; __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_v_rv = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyredblack/redblack.pyx":343
 *         # traversal
 *         rv = self.__and__(other)
 *         self.clear()             # <<<<<<<<<<<<<<
 *         self.update(rv)
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_clear); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = NULL;
  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);
    }
  }
  if (__pyx_t_7) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __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_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __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;

  /* "pyredblack/redblack.pyx":344
 *         rv = self.__and__(other)
 *         self.clear()
 *         self.update(rv)             # <<<<<<<<<<<<<<
 * 
 *     def difference_update(self, other, *others):
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = NULL;
  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);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_rv); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __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 = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_v_rv);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_rv);
    __Pyx_GIVEREF(__pyx_v_rv);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __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_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyredblack/redblack.pyx":334
 *             self.__iand__(other)
 * 
 *     def __iand__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Update the set, keeping only elements found in it and all others.
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.__iand__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":346
 *         self.update(rv)
 * 
 *     def difference_update(self, other, *others):             # <<<<<<<<<<<<<<
 *         '''Update the set, removing elements found in others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_58difference_update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_57difference_update[] = "Update the set, removing elements found in others.";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_58difference_update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_other = 0;
  PyObject *__pyx_v_others = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("difference_update (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_others = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_others)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_others);
  } else {
    __pyx_v_others = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_other,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_other)) != 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, 0, values, used_pos_args, "difference_update") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __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_other = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("difference_update", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_others); __pyx_v_others = 0;
  __Pyx_AddTraceback("pyredblack.redblack.rbset.difference_update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_57difference_update(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), __pyx_v_other, __pyx_v_others);

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_57difference_update(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_others) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("difference_update", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "pyredblack/redblack.pyx":348
 *     def difference_update(self, other, *others):
 *         '''Update the set, removing elements found in others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             other = rbset(other)
 *         self.__iand__(other)
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":349
 *         '''Update the set, removing elements found in others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)             # <<<<<<<<<<<<<<
 *         self.__iand__(other)
 *         for other in others:
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":350
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)
 *         self.__iand__(other)             # <<<<<<<<<<<<<<
 *         for other in others:
 *             if not isinstance(other, (set, frozenset, rbset)):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __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_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __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 = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __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 = 350; __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_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pyredblack/redblack.pyx":351
 *             other = rbset(other)
 *         self.__iand__(other)
 *         for other in others:             # <<<<<<<<<<<<<<
 *             if not isinstance(other, (set, frozenset, rbset)):
 *                 other = rbset(other)
 */
  __pyx_t_5 = __pyx_v_others; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
  for (;;) {
    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 = 351; __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 = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pyredblack/redblack.pyx":352
 *         self.__iand__(other)
 *         for other in others:
 *             if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *                 other = rbset(other)
 *             self.__iand__(other)
 */
    __pyx_t_1 = PySet_Check(__pyx_v_other); 
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_2 = PyFrozenSet_Check(__pyx_v_other); 
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (!__pyx_t_1) {
    } else {
      __pyx_t_3 = __pyx_t_1;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
    __pyx_t_2 = (__pyx_t_1 != 0);
    __pyx_t_3 = __pyx_t_2;
    __pyx_L10_bool_binop_done:;
    __pyx_t_2 = ((!(__pyx_t_3 != 0)) != 0);
    if (__pyx_t_2) {

      /* "pyredblack/redblack.pyx":353
 *         for other in others:
 *             if not isinstance(other, (set, frozenset, rbset)):
 *                 other = rbset(other)             # <<<<<<<<<<<<<<
 *             self.__iand__(other)
 * 
 */
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_7);
      __pyx_t_7 = 0;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pyredblack/redblack.pyx":354
 *             if not isinstance(other, (set, frozenset, rbset)):
 *                 other = rbset(other)
 *             self.__iand__(other)             # <<<<<<<<<<<<<<
 * 
 *     def __isub__(self, other):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __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_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __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 = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __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_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pyredblack/redblack.pyx":351
 *             other = rbset(other)
 *         self.__iand__(other)
 *         for other in others:             # <<<<<<<<<<<<<<
 *             if not isinstance(other, (set, frozenset, rbset)):
 *                 other = rbset(other)
 */
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pyredblack/redblack.pyx":346
 *         self.update(rv)
 * 
 *     def difference_update(self, other, *others):             # <<<<<<<<<<<<<<
 *         '''Update the set, removing elements found in others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.difference_update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":356
 *             self.__iand__(other)
 * 
 *     def __isub__(self, other):             # <<<<<<<<<<<<<<
 *         '''Update the set, removing elements found in others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_60__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_59__isub__[] = "Update the set, removing elements found in others.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_5rbset_59__isub__;
#endif
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_60__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__isub__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_59__isub__(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_59__isub__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("__isub__", 0);

  /* "pyredblack/redblack.pyx":358
 *     def __isub__(self, other):
 *         '''Update the set, removing elements found in others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             raise TypeError('unsupported operand type(s) for -=')
 *         # TODO: with access to the iterator, this could be done in one
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":359
 *         '''Update the set, removing elements found in others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for -=')             # <<<<<<<<<<<<<<
 *         # TODO: with access to the iterator, this could be done in one
 *         # traversal
 */
    __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 = 359; __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 = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyredblack/redblack.pyx":362
 *         # TODO: with access to the iterator, this could be done in one
 *         # traversal
 *         rv = self.__sub__(other)             # <<<<<<<<<<<<<<
 *         self.clear()
 *         self.update(rv)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_sub); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __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_other); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __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 = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __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 = 362; __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_v_rv = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyredblack/redblack.pyx":363
 *         # traversal
 *         rv = self.__sub__(other)
 *         self.clear()             # <<<<<<<<<<<<<<
 *         self.update(rv)
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_clear); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = NULL;
  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);
    }
  }
  if (__pyx_t_7) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __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_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __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;

  /* "pyredblack/redblack.pyx":364
 *         rv = self.__sub__(other)
 *         self.clear()
 *         self.update(rv)             # <<<<<<<<<<<<<<
 * 
 *     def symmetric_difference_update(self, other):
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = NULL;
  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);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_rv); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __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 = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_v_rv);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_rv);
    __Pyx_GIVEREF(__pyx_v_rv);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __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_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyredblack/redblack.pyx":356
 *             self.__iand__(other)
 * 
 *     def __isub__(self, other):             # <<<<<<<<<<<<<<
 *         '''Update the set, removing elements found in others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.__isub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":366
 *         self.update(rv)
 * 
 *     def symmetric_difference_update(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Update the set, keeping only elements found in either set, but not
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_62symmetric_difference_update(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_61symmetric_difference_update[] = "\n        Update the set, keeping only elements found in either set, but not\n        in both.\n        ";
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_62symmetric_difference_update(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("symmetric_difference_update (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_61symmetric_difference_update(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_61symmetric_difference_update(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("symmetric_difference_update", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "pyredblack/redblack.pyx":371
 *         in both.
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             other = rbset(other)
 *         self.__ixor__(other)
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":372
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)             # <<<<<<<<<<<<<<
 *         self.__ixor__(other)
 * 
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":373
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             other = rbset(other)
 *         self.__ixor__(other)             # <<<<<<<<<<<<<<
 * 
 *     def __ixor__(self, other):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ixor); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __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_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_other); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __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 = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __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 = 373; __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_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pyredblack/redblack.pyx":366
 *         self.update(rv)
 * 
 *     def symmetric_difference_update(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Update the set, keeping only elements found in either set, but not
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.symmetric_difference_update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":375
 *         self.__ixor__(other)
 * 
 *     def __ixor__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Update the set, keeping only elements found in either set, but not
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_64__ixor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_5rbset_63__ixor__[] = "\n        Update the set, keeping only elements found in either set, but not\n        in both.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_5rbset_63__ixor__;
#endif
static PyObject *__pyx_pw_10pyredblack_8redblack_5rbset_64__ixor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__ixor__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_5rbset_63__ixor__(((struct __pyx_obj_10pyredblack_8redblack_rbset *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_5rbset_63__ixor__(struct __pyx_obj_10pyredblack_8redblack_rbset *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("__ixor__", 0);

  /* "pyredblack/redblack.pyx":380
 *         in both.
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):             # <<<<<<<<<<<<<<
 *             raise TypeError('unsupported operand type(s) for ^=')
 *         # TODO: with access to the iterator, this could be done in one
 */
  __pyx_t_2 = PySet_Check(__pyx_v_other); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyFrozenSet_Check(__pyx_v_other); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbset)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":381
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for ^=')             # <<<<<<<<<<<<<<
 *         # TODO: with access to the iterator, this could be done in one
 *         # traversal
 */
    __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 = 381; __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 = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyredblack/redblack.pyx":384
 *         # TODO: with access to the iterator, this could be done in one
 *         # traversal
 *         rv = self.__xor__(other)             # <<<<<<<<<<<<<<
 *         self.clear()
 *         self.update(rv)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_xor); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __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_other); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __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 = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __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 = 384; __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_v_rv = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pyredblack/redblack.pyx":385
 *         # traversal
 *         rv = self.__xor__(other)
 *         self.clear()             # <<<<<<<<<<<<<<
 *         self.update(rv)
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_clear); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = NULL;
  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);
    }
  }
  if (__pyx_t_7) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __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_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __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;

  /* "pyredblack/redblack.pyx":386
 *         rv = self.__xor__(other)
 *         self.clear()
 *         self.update(rv)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = NULL;
  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);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_rv); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __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 = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_v_rv);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_rv);
    __Pyx_GIVEREF(__pyx_v_rv);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __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_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyredblack/redblack.pyx":375
 *         self.__ixor__(other)
 * 
 *     def __ixor__(self, other):             # <<<<<<<<<<<<<<
 *         '''
 *         Update the set, keeping only elements found in either set, but not
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyredblack.redblack.rbset.__ixor__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":395
 *     cdef int _num_nodes
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         '''C Constructor.'''
 *         self._tree = new PairRBTree()
 */

/* Python wrapper */
static int __pyx_pw_10pyredblack_8redblack_6rbdict_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_10pyredblack_8redblack_6rbdict_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict___cinit__(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self));

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

static int __pyx_pf_10pyredblack_8redblack_6rbdict___cinit__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PairRBTree *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pyredblack/redblack.pyx":397
 *     def __cinit__(self):
 *         '''C Constructor.'''
 *         self._tree = new PairRBTree()             # <<<<<<<<<<<<<<
 *         self._num_nodes = 0
 * 
 */
  try {
    __pyx_t_1 = new PairRBTree();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_self->_tree = __pyx_t_1;

  /* "pyredblack/redblack.pyx":398
 *         '''C Constructor.'''
 *         self._tree = new PairRBTree()
 *         self._num_nodes = 0             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, mapping = None, **kwargs):
 */
  __pyx_v_self->_num_nodes = 0;

  /* "pyredblack/redblack.pyx":395
 *     cdef int _num_nodes
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         '''C Constructor.'''
 *         self._tree = new PairRBTree()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":400
 *         self._num_nodes = 0
 * 
 *     def __init__(self, mapping = None, **kwargs):             # <<<<<<<<<<<<<<
 *         '''Python Constructor.'''
 *         self.update(mapping, **kwargs)
 */

/* Python wrapper */
static int __pyx_pw_10pyredblack_8redblack_6rbdict_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_2__init__[] = "Python Constructor.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_2__init__;
#endif
static int __pyx_pw_10pyredblack_8redblack_6rbdict_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mapping = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mapping,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mapping);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mapping = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_2__init__(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self), __pyx_v_mapping, __pyx_v_kwargs);

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

static int __pyx_pf_10pyredblack_8redblack_6rbdict_2__init__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_mapping, PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __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);

  /* "pyredblack/redblack.pyx":402
 *     def __init__(self, mapping = None, **kwargs):
 *         '''Python Constructor.'''
 *         self.update(mapping, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __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 = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_mapping);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_mapping);
  __Pyx_GIVEREF(__pyx_v_mapping);
  __pyx_t_3 = __pyx_v_kwargs;
  __Pyx_INCREF(__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 = 402; __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_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pyredblack/redblack.pyx":400
 *         self._num_nodes = 0
 * 
 *     def __init__(self, mapping = None, **kwargs):             # <<<<<<<<<<<<<<
 *         '''Python Constructor.'''
 *         self.update(mapping, **kwargs)
 */

  /* function exit code */
  __pyx_r = 0;
  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("pyredblack.redblack.rbdict.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":404
 *         self.update(mapping, **kwargs)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         '''Destructor.'''
 *         if self._tree is not NULL:
 */

/* Python wrapper */
static void __pyx_pw_10pyredblack_8redblack_6rbdict_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_10pyredblack_8redblack_6rbdict_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_10pyredblack_8redblack_6rbdict_4__dealloc__(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self));

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

static void __pyx_pf_10pyredblack_8redblack_6rbdict_4__dealloc__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "pyredblack/redblack.pyx":406
 *     def __dealloc__(self):
 *         '''Destructor.'''
 *         if self._tree is not NULL:             # <<<<<<<<<<<<<<
 *             self._tree.clear_objs()
 *             del self._tree
 */
  __pyx_t_1 = ((__pyx_v_self->_tree != NULL) != 0);
  if (__pyx_t_1) {

    /* "pyredblack/redblack.pyx":407
 *         '''Destructor.'''
 *         if self._tree is not NULL:
 *             self._tree.clear_objs()             # <<<<<<<<<<<<<<
 *             del self._tree
 * 
 */
    __pyx_v_self->_tree->clear_objs();

    /* "pyredblack/redblack.pyx":408
 *         if self._tree is not NULL:
 *             self._tree.clear_objs()
 *             del self._tree             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    delete __pyx_v_self->_tree;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":404
 *         self.update(mapping, **kwargs)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         '''Destructor.'''
 *         if self._tree is not NULL:
 */

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

/* "pyredblack/redblack.pyx":410
 *             del self._tree
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         '''Return the number of items in the dictionary.'''
 *         return self._num_nodes
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_10pyredblack_8redblack_6rbdict_7__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_6__len__[] = "Return the number of items in the dictionary.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_6__len__;
#endif
static Py_ssize_t __pyx_pw_10pyredblack_8redblack_6rbdict_7__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_6__len__(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_10pyredblack_8redblack_6rbdict_6__len__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "pyredblack/redblack.pyx":412
 *     def __len__(self):
 *         '''Return the number of items in the dictionary.'''
 *         return self._num_nodes             # <<<<<<<<<<<<<<
 * 
 *     def __missing__(self, key):
 */
  __pyx_r = __pyx_v_self->_num_nodes;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":410
 *             del self._tree
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         '''Return the number of items in the dictionary.'''
 *         return self._num_nodes
 */

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

/* "pyredblack/redblack.pyx":414
 *         return self._num_nodes
 * 
 *     def __missing__(self, key):             # <<<<<<<<<<<<<<
 *         '''
 *         Called by `__getitem__()` to implement `self[key]` for dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_9__missing__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_8__missing__[] = "\n        Called by `__getitem__()` to implement `self[key]` for dict\n        subclasses when `key` is not in the dictionary.\n        ";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_9__missing__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__missing__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_8__missing__(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_8__missing__(CYTHON_UNUSED struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED Py_hash_t __pyx_v__hash;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_hash_t __pyx_t_1;
  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("__missing__", 0);

  /* "pyredblack/redblack.pyx":419
 *         subclasses when `key` is not in the dictionary.
 *         '''
 *         _hash = hash(key)             # <<<<<<<<<<<<<<
 *         raise KeyError(key)
 * 
 */
  __pyx_t_1 = PyObject_Hash(__pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v__hash = __pyx_t_1;

  /* "pyredblack/redblack.pyx":420
 *         '''
 *         _hash = hash(key)
 *         raise KeyError(key)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_key);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key);
  __Pyx_GIVEREF(__pyx_v_key);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyredblack/redblack.pyx":414
 *         return self._num_nodes
 * 
 *     def __missing__(self, key):             # <<<<<<<<<<<<<<
 *         '''
 *         Called by `__getitem__()` to implement `self[key]` for dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.__missing__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":422
 *         raise KeyError(key)
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         '''
 *         Return the item of the dictionary with key `key`. Raises a
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_11__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_10__getitem__[] = "\n        Return the item of the dictionary with key `key`. Raises a\n        `KeyError` if `key` is not in the map.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_10__getitem__;
#endif
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_11__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_10__getitem__(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_10__getitem__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED Py_hash_t __pyx_v__hash;
  bool __pyx_v_found;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_hash_t __pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  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("__getitem__", 0);

  /* "pyredblack/redblack.pyx":427
 *         `KeyError` if `key` is not in the map.
 *         '''
 *         _hash = hash(key)             # <<<<<<<<<<<<<<
 *         cdef bool found = False
 *         value = <object>self._tree.get_value_for_key(key, found)
 */
  __pyx_t_1 = PyObject_Hash(__pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v__hash = __pyx_t_1;

  /* "pyredblack/redblack.pyx":428
 *         '''
 *         _hash = hash(key)
 *         cdef bool found = False             # <<<<<<<<<<<<<<
 *         value = <object>self._tree.get_value_for_key(key, found)
 *         if not found:
 */
  __pyx_v_found = 0;

  /* "pyredblack/redblack.pyx":429
 *         _hash = hash(key)
 *         cdef bool found = False
 *         value = <object>self._tree.get_value_for_key(key, found)             # <<<<<<<<<<<<<<
 *         if not found:
 *             return self.__missing__(key)
 */
  __pyx_t_2 = __pyx_v_self->_tree->get_value_for_key(__pyx_v_key, __pyx_v_found);
  __pyx_t_3 = ((PyObject *)__pyx_t_2);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_value = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyredblack/redblack.pyx":430
 *         cdef bool found = False
 *         value = <object>self._tree.get_value_for_key(key, found)
 *         if not found:             # <<<<<<<<<<<<<<
 *             return self.__missing__(key)
 *         return value
 */
  __pyx_t_4 = ((!(__pyx_v_found != 0)) != 0);
  if (__pyx_t_4) {

    /* "pyredblack/redblack.pyx":431
 *         value = <object>self._tree.get_value_for_key(key, found)
 *         if not found:
 *             return self.__missing__(key)             # <<<<<<<<<<<<<<
 *         return value
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_missing); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __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_v_key); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __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 = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_v_key);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_key);
      __Pyx_GIVEREF(__pyx_v_key);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __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_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":432
 *         if not found:
 *             return self.__missing__(key)
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, key, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":422
 *         raise KeyError(key)
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         '''
 *         Return the item of the dictionary with key `key`. Raises a
 */

  /* 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_7);
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":434
 *         return value
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         '''Associates `key` with `value`.'''
 *         _hash = hash(key)
 */

/* Python wrapper */
static int __pyx_pw_10pyredblack_8redblack_6rbdict_13__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_12__setitem__[] = "Associates `key` with `value`.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_12__setitem__;
#endif
static int __pyx_pw_10pyredblack_8redblack_6rbdict_13__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_12__setitem__(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_10pyredblack_8redblack_6rbdict_12__setitem__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  CYTHON_UNUSED Py_hash_t __pyx_v__hash;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_hash_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "pyredblack/redblack.pyx":436
 *     def __setitem__(self, key, value):
 *         '''Associates `key` with `value`.'''
 *         _hash = hash(key)             # <<<<<<<<<<<<<<
 *         if self._tree.set_key(key, value):
 *             self._num_nodes += 1
 */
  __pyx_t_1 = PyObject_Hash(__pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v__hash = __pyx_t_1;

  /* "pyredblack/redblack.pyx":437
 *         '''Associates `key` with `value`.'''
 *         _hash = hash(key)
 *         if self._tree.set_key(key, value):             # <<<<<<<<<<<<<<
 *             self._num_nodes += 1
 * 
 */
  __pyx_t_2 = (__pyx_v_self->_tree->set_key(__pyx_v_key, __pyx_v_value) != 0);
  if (__pyx_t_2) {

    /* "pyredblack/redblack.pyx":438
 *         _hash = hash(key)
 *         if self._tree.set_key(key, value):
 *             self._num_nodes += 1             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, key):
 */
    __pyx_v_self->_num_nodes = (__pyx_v_self->_num_nodes + 1);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":434
 *         return value
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         '''Associates `key` with `value`.'''
 *         _hash = hash(key)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":440
 *             self._num_nodes += 1
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         '''
 *         Removes `key` from the dictionary. Raises a `KeyError` if `key` is
 */

/* Python wrapper */
static int __pyx_pw_10pyredblack_8redblack_6rbdict_15__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_14__delitem__[] = "\n        Removes `key` from the dictionary. Raises a `KeyError` if `key` is\n        not in the map.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_14__delitem__;
#endif
static int __pyx_pw_10pyredblack_8redblack_6rbdict_15__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_14__delitem__(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_10pyredblack_8redblack_6rbdict_14__delitem__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED Py_hash_t __pyx_v__hash;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_hash_t __pyx_t_1;
  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("__delitem__", 0);

  /* "pyredblack/redblack.pyx":445
 *         not in the map.
 *         '''
 *         _hash = hash(key)             # <<<<<<<<<<<<<<
 *         if self._tree.del_key(key):
 *             self._num_nodes -= 1
 */
  __pyx_t_1 = PyObject_Hash(__pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v__hash = __pyx_t_1;

  /* "pyredblack/redblack.pyx":446
 *         '''
 *         _hash = hash(key)
 *         if self._tree.del_key(key):             # <<<<<<<<<<<<<<
 *             self._num_nodes -= 1
 *         else:
 */
  __pyx_t_2 = (__pyx_v_self->_tree->del_key(__pyx_v_key) != 0);
  if (__pyx_t_2) {

    /* "pyredblack/redblack.pyx":447
 *         _hash = hash(key)
 *         if self._tree.del_key(key):
 *             self._num_nodes -= 1             # <<<<<<<<<<<<<<
 *         else:
 *             raise KeyError(key)
 */
    __pyx_v_self->_num_nodes = (__pyx_v_self->_num_nodes - 1);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pyredblack/redblack.pyx":449
 *             self._num_nodes -= 1
 *         else:
 *             raise KeyError(key)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key);
    __Pyx_GIVEREF(__pyx_v_key);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":440
 *             self._num_nodes += 1
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         '''
 *         Removes `key` from the dictionary. Raises a `KeyError` if `key` is
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":451
 *             raise KeyError(key)
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         '''Return `True` if the dictionary has a key `key`, else `False`.'''
 *         _hash = hash(key)
 */

/* Python wrapper */
static int __pyx_pw_10pyredblack_8redblack_6rbdict_17__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_16__contains__[] = "Return `True` if the dictionary has a key `key`, else `False`.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_16__contains__;
#endif
static int __pyx_pw_10pyredblack_8redblack_6rbdict_17__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_16__contains__(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_10pyredblack_8redblack_6rbdict_16__contains__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED Py_hash_t __pyx_v__hash;
  pyobjpairw __pyx_v_probe;
  PairRBTreeIterator __pyx_v_it;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_hash_t __pyx_t_1;
  pyobjpairw __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "pyredblack/redblack.pyx":453
 *     def __contains__(self, key):
 *         '''Return `True` if the dictionary has a key `key`, else `False`.'''
 *         _hash = hash(key)             # <<<<<<<<<<<<<<
 *         cdef pyobjpairw probe
 *         probe = pyobjpairw(key, None)
 */
  __pyx_t_1 = PyObject_Hash(__pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v__hash = __pyx_t_1;

  /* "pyredblack/redblack.pyx":455
 *         _hash = hash(key)
 *         cdef pyobjpairw probe
 *         probe = pyobjpairw(key, None)             # <<<<<<<<<<<<<<
 *         cdef PairRBTreeIterator it = self._tree.find(probe)
 *         if it.valid() and it.getDir() == 0:
 */
  try {
    __pyx_t_2 = pyobjpairw(__pyx_v_key, Py_None);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_probe = __pyx_t_2;

  /* "pyredblack/redblack.pyx":456
 *         cdef pyobjpairw probe
 *         probe = pyobjpairw(key, None)
 *         cdef PairRBTreeIterator it = self._tree.find(probe)             # <<<<<<<<<<<<<<
 *         if it.valid() and it.getDir() == 0:
 *             return True
 */
  __pyx_v_it = __pyx_v_self->_tree->find(__pyx_v_probe);

  /* "pyredblack/redblack.pyx":457
 *         probe = pyobjpairw(key, None)
 *         cdef PairRBTreeIterator it = self._tree.find(probe)
 *         if it.valid() and it.getDir() == 0:             # <<<<<<<<<<<<<<
 *             return True
 *         return False
 */
  __pyx_t_4 = (__pyx_v_it.valid() != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = ((__pyx_v_it.getDir() == 0) != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pyredblack/redblack.pyx":458
 *         cdef PairRBTreeIterator it = self._tree.find(probe)
 *         if it.valid() and it.getDir() == 0:
 *             return True             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
    __pyx_r = 1;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":459
 *         if it.valid() and it.getDir() == 0:
 *             return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":451
 *             raise KeyError(key)
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         '''Return `True` if the dictionary has a key `key`, else `False`.'''
 *         _hash = hash(key)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":461
 *         return False
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         '''Return an iterator over the keys of the dictionary.'''
 *         return self.iterkeys()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_19__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_18__iter__[] = "Return an iterator over the keys of the dictionary.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_18__iter__;
#endif
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_19__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_18__iter__(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_18__iter__(struct __pyx_obj_10pyredblack_8redblack_rbdict *__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("__iter__", 0);

  /* "pyredblack/redblack.pyx":463
 *     def __iter__(self):
 *         '''Return an iterator over the keys of the dictionary.'''
 *         return self.iterkeys()             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iterkeys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __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 = 463; __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 = 463; __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;

  /* "pyredblack/redblack.pyx":461
 *         return False
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         '''Return an iterator over the keys of the dictionary.'''
 *         return self.iterkeys()
 */

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

/* "pyredblack/redblack.pyx":465
 *         return self.iterkeys()
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         '''Return a copy of the dictionarys list of keys.'''
 *         if PYTHON_VERSION2 == 1:
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_21keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_20keys[] = "Return a copy of the dictionary\342\200\231s list of keys.";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_21keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_20keys(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_20keys(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self) {
  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("keys", 0);

  /* "pyredblack/redblack.pyx":467
 *     def keys(self):
 *         '''Return a copy of the dictionarys list of keys.'''
 *         if PYTHON_VERSION2 == 1:             # <<<<<<<<<<<<<<
 *             return list(self.iterkeys())
 *         else:
 */
  __pyx_t_1 = ((PYTHON_VERSION2 == 1) != 0);
  if (__pyx_t_1) {

    /* "pyredblack/redblack.pyx":468
 *         '''Return a copy of the dictionarys list of keys.'''
 *         if PYTHON_VERSION2 == 1:
 *             return list(self.iterkeys())             # <<<<<<<<<<<<<<
 *         else:
 *             return self.iterkeys()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iterkeys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __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_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __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_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pyredblack/redblack.pyx":470
 *             return list(self.iterkeys())
 *         else:
 *             return self.iterkeys()             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iterkeys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __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_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __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_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":465
 *         return self.iterkeys()
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         '''Return a copy of the dictionarys list of keys.'''
 *         if PYTHON_VERSION2 == 1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":472
 *             return self.iterkeys()
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         '''Return a copy of the dictionarys list of values.'''
 *         if PYTHON_VERSION2 == 1:
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_23values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_22values[] = "Return a copy of the dictionary\342\200\231s list of values.";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_23values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_22values(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_22values(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self) {
  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("values", 0);

  /* "pyredblack/redblack.pyx":474
 *     def values(self):
 *         '''Return a copy of the dictionarys list of values.'''
 *         if PYTHON_VERSION2 == 1:             # <<<<<<<<<<<<<<
 *             return list(self.itervalues())
 *         else:
 */
  __pyx_t_1 = ((PYTHON_VERSION2 == 1) != 0);
  if (__pyx_t_1) {

    /* "pyredblack/redblack.pyx":475
 *         '''Return a copy of the dictionarys list of values.'''
 *         if PYTHON_VERSION2 == 1:
 *             return list(self.itervalues())             # <<<<<<<<<<<<<<
 *         else:
 *             return self.itervalues()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_itervalues); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __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_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __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_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pyredblack/redblack.pyx":477
 *             return list(self.itervalues())
 *         else:
 *             return self.itervalues()             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_itervalues); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __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_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __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_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":472
 *             return self.iterkeys()
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         '''Return a copy of the dictionarys list of values.'''
 *         if PYTHON_VERSION2 == 1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":479
 *             return self.itervalues()
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         '''Return a copy of the dictionarys list of `(key, value)` pairs.'''
 *         if PYTHON_VERSION2 == 1:
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_25items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_24items[] = "Return a copy of the dictionary\342\200\231s list of `(key, value)` pairs.";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_25items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_24items(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_24items(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self) {
  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("items", 0);

  /* "pyredblack/redblack.pyx":481
 *     def items(self):
 *         '''Return a copy of the dictionarys list of `(key, value)` pairs.'''
 *         if PYTHON_VERSION2 == 1:             # <<<<<<<<<<<<<<
 *             return list(self.iteritems())
 *         else:
 */
  __pyx_t_1 = ((PYTHON_VERSION2 == 1) != 0);
  if (__pyx_t_1) {

    /* "pyredblack/redblack.pyx":482
 *         '''Return a copy of the dictionarys list of `(key, value)` pairs.'''
 *         if PYTHON_VERSION2 == 1:
 *             return list(self.iteritems())             # <<<<<<<<<<<<<<
 *         else:
 *             return self.iteritems()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iteritems); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __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_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __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_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pyredblack/redblack.pyx":484
 *             return list(self.iteritems())
 *         else:
 *             return self.iteritems()             # <<<<<<<<<<<<<<
 * 
 *     def has_key(self, key):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iteritems); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __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_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __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_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":479
 *             return self.itervalues()
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         '''Return a copy of the dictionarys list of `(key, value)` pairs.'''
 *         if PYTHON_VERSION2 == 1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":486
 *             return self.iteritems()
 * 
 *     def has_key(self, key):             # <<<<<<<<<<<<<<
 *         '''Test for the presence of `key` in the dictionary.'''
 *         _hash = hash(key)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_27has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_26has_key[] = "Test for the presence of `key` in the dictionary.";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_27has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_key (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_26has_key(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_26has_key(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED Py_hash_t __pyx_v__hash;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_hash_t __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("has_key", 0);

  /* "pyredblack/redblack.pyx":488
 *     def has_key(self, key):
 *         '''Test for the presence of `key` in the dictionary.'''
 *         _hash = hash(key)             # <<<<<<<<<<<<<<
 *         return self.__contains__(key)
 * 
 */
  __pyx_t_1 = PyObject_Hash(__pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v__hash = __pyx_t_1;

  /* "pyredblack/redblack.pyx":489
 *         '''Test for the presence of `key` in the dictionary.'''
 *         _hash = hash(key)
 *         return self.__contains__(key)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_contains); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __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_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __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 = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_key);
    __Pyx_GIVEREF(__pyx_v_key);
    __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 = 489; __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_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":486
 *             return self.iteritems()
 * 
 *     def has_key(self, key):             # <<<<<<<<<<<<<<
 *         '''Test for the presence of `key` in the dictionary.'''
 *         _hash = hash(key)
 */

  /* 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("pyredblack.redblack.rbdict.has_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":491
 *         return self.__contains__(key)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         '''
 *         Return the value for `key` if `key` is in the dictionary, else
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_29get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_28get[] = "\n        Return the value for `key` if `key` is in the dictionary, else\n        `default`. If `default` is not given, it defaults to None, so\n        that this method never raises a `KeyError`.\n        ";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_29get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          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") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __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_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_28get(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_28get(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  CYTHON_UNUSED Py_hash_t __pyx_v__hash;
  bool __pyx_v_found;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_hash_t __pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);

  /* "pyredblack/redblack.pyx":497
 *         that this method never raises a `KeyError`.
 *         '''
 *         _hash = hash(key)             # <<<<<<<<<<<<<<
 *         cdef bool found = False
 *         value = <object>self._tree.get_value_for_key(key, found)
 */
  __pyx_t_1 = PyObject_Hash(__pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v__hash = __pyx_t_1;

  /* "pyredblack/redblack.pyx":498
 *         '''
 *         _hash = hash(key)
 *         cdef bool found = False             # <<<<<<<<<<<<<<
 *         value = <object>self._tree.get_value_for_key(key, found)
 *         if not found:
 */
  __pyx_v_found = 0;

  /* "pyredblack/redblack.pyx":499
 *         _hash = hash(key)
 *         cdef bool found = False
 *         value = <object>self._tree.get_value_for_key(key, found)             # <<<<<<<<<<<<<<
 *         if not found:
 *             return default
 */
  __pyx_t_2 = __pyx_v_self->_tree->get_value_for_key(__pyx_v_key, __pyx_v_found);
  __pyx_t_3 = ((PyObject *)__pyx_t_2);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_value = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pyredblack/redblack.pyx":500
 *         cdef bool found = False
 *         value = <object>self._tree.get_value_for_key(key, found)
 *         if not found:             # <<<<<<<<<<<<<<
 *             return default
 *         return value
 */
  __pyx_t_4 = ((!(__pyx_v_found != 0)) != 0);
  if (__pyx_t_4) {

    /* "pyredblack/redblack.pyx":501
 *         value = <object>self._tree.get_value_for_key(key, found)
 *         if not found:
 *             return default             # <<<<<<<<<<<<<<
 *         return value
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_default);
    __pyx_r = __pyx_v_default;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":502
 *         if not found:
 *             return default
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":491
 *         return self.__contains__(key)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         '''
 *         Return the value for `key` if `key` is in the dictionary, else
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":504
 *         return value
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         '''Remove all items from the dictionary.'''
 *         self._tree.clear_objs()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_31clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_30clear[] = "Remove all items from the dictionary.";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_31clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_30clear(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_30clear(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear", 0);

  /* "pyredblack/redblack.pyx":506
 *     def clear(self):
 *         '''Remove all items from the dictionary.'''
 *         self._tree.clear_objs()             # <<<<<<<<<<<<<<
 *         self._num_nodes = 0
 * 
 */
  __pyx_v_self->_tree->clear_objs();

  /* "pyredblack/redblack.pyx":507
 *         '''Remove all items from the dictionary.'''
 *         self._tree.clear_objs()
 *         self._num_nodes = 0             # <<<<<<<<<<<<<<
 * 
 *     def setdefault(self, key, default = None):
 */
  __pyx_v_self->_num_nodes = 0;

  /* "pyredblack/redblack.pyx":504
 *         return value
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         '''Remove all items from the dictionary.'''
 *         self._tree.clear_objs()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":509
 *         self._num_nodes = 0
 * 
 *     def setdefault(self, key, default = None):             # <<<<<<<<<<<<<<
 *         '''
 *         If `key` is in the dictionary, return its value. If not, insert
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_33setdefault(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_32setdefault[] = "\n        If `key` is in the dictionary, return its value. If not, insert\n        `key` with a value of `default` and return\n        `default`. `default` defaults to None.\n        ";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_33setdefault(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setdefault (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setdefault") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __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_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setdefault", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.setdefault", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_32setdefault(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_32setdefault(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  CYTHON_UNUSED Py_hash_t __pyx_v__hash;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_hash_t __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 = 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;
  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("setdefault", 0);

  /* "pyredblack/redblack.pyx":515
 *         `default`. `default` defaults to None.
 *         '''
 *         _hash = hash(key)             # <<<<<<<<<<<<<<
 *         # TODO: this could be one tree access instead of two
 *         try:
 */
  __pyx_t_1 = PyObject_Hash(__pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v__hash = __pyx_t_1;

  /* "pyredblack/redblack.pyx":517
 *         _hash = hash(key)
 *         # TODO: this could be one tree access instead of two
 *         try:             # <<<<<<<<<<<<<<
 *             return self.__getitem__(key)
 *         except KeyError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "pyredblack/redblack.pyx":518
 *         # TODO: this could be one tree access instead of two
 *         try:
 *             return self.__getitem__(key)             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             self.__setitem__(key, default)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getitem); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L3_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_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_key); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_5);
      } else {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_key);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_key);
        __Pyx_GIVEREF(__pyx_v_key);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_try_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pyredblack/redblack.pyx":519
 *         try:
 *             return self.__getitem__(key)
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             self.__setitem__(key, default)
 *             return default
 */
    __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_9) {
      __Pyx_AddTraceback("pyredblack.redblack.rbdict.setdefault", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_8);

      /* "pyredblack/redblack.pyx":520
 *             return self.__getitem__(key)
 *         except KeyError:
 *             self.__setitem__(key, default)             # <<<<<<<<<<<<<<
 *             return default
 * 
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setitem); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = NULL;
      __pyx_t_12 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, 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 = 520; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      if (__pyx_t_11) {
        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_INCREF(__pyx_v_key);
      PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_v_key);
      __Pyx_GIVEREF(__pyx_v_key);
      __Pyx_INCREF(__pyx_v_default);
      PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_v_default);
      __Pyx_GIVEREF(__pyx_v_default);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_13, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pyredblack/redblack.pyx":521
 *         except KeyError:
 *             self.__setitem__(key, default)
 *             return default             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_default);
      __pyx_r = __pyx_v_default;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":509
 *         self._num_nodes = 0
 * 
 *     def setdefault(self, key, default = None):             # <<<<<<<<<<<<<<
 *         '''
 *         If `key` is in the dictionary, return its value. If not, insert
 */

  /* function exit code */
  __pyx_L1_error:;
  __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_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.setdefault", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_10pyredblack_8redblack_6rbdict_36generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pyredblack/redblack.pyx":523
 *             return default
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         '''Return an iterator over the dictionarys keys.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_35iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_34iterkeys[] = "Return an iterator over the dictionary\342\200\231s keys.";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_35iterkeys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_34iterkeys(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_34iterkeys(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __pyx_cur_scope = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys *)__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys(__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys, __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((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_10pyredblack_8redblack_6rbdict_36generator1, (PyObject *) __pyx_cur_scope, __pyx_n_s_iterkeys, __pyx_n_s_rbdict_iterkeys); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __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("pyredblack.redblack.rbdict.iterkeys", __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_10pyredblack_8redblack_6rbdict_36generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys *__pyx_cur_scope = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2;
  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 = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyredblack/redblack.pyx":525
 *     def iterkeys(self):
 *         '''Return an iterator over the dictionarys keys.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()             # <<<<<<<<<<<<<<
 *         while it != self._tree.end():
 *             yield <object>dereference(it).getFirst()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->_tree->begin();

  /* "pyredblack/redblack.pyx":526
 *         '''Return an iterator over the dictionarys keys.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()
 *         while it != self._tree.end():             # <<<<<<<<<<<<<<
 *             yield <object>dereference(it).getFirst()
 *             preincrement(it)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->_tree->end()) != 0);
    if (!__pyx_t_1) break;

    /* "pyredblack/redblack.pyx":527
 *         cdef PairRBTreeIterator it = self._tree.begin()
 *         while it != self._tree.end():
 *             yield <object>dereference(it).getFirst()             # <<<<<<<<<<<<<<
 *             preincrement(it)
 * 
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).getFirst();
    __Pyx_INCREF(((PyObject *)__pyx_t_2));
    __pyx_r = ((PyObject *)__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pyredblack/redblack.pyx":528
 *         while it != self._tree.end():
 *             yield <object>dereference(it).getFirst()
 *             preincrement(it)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
 */
    (++__pyx_cur_scope->__pyx_v_it);
  }

  /* "pyredblack/redblack.pyx":523
 *             return default
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         '''Return an iterator over the dictionarys keys.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("iterkeys", __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_10pyredblack_8redblack_6rbdict_39generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pyredblack/redblack.pyx":530
 *             preincrement(it)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         '''Return an iterator over the dictionarys values.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_38itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_37itervalues[] = "Return an iterator over the dictionary\342\200\231s values.";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_38itervalues(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_37itervalues(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_37itervalues(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues *)__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_9_itervalues(__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_9_itervalues, __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((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_10pyredblack_8redblack_6rbdict_39generator2, (PyObject *) __pyx_cur_scope, __pyx_n_s_itervalues, __pyx_n_s_rbdict_itervalues); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __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("pyredblack.redblack.rbdict.itervalues", __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_10pyredblack_8redblack_6rbdict_39generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues *__pyx_cur_scope = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2;
  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 = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyredblack/redblack.pyx":532
 *     def itervalues(self):
 *         '''Return an iterator over the dictionarys values.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()             # <<<<<<<<<<<<<<
 *         while it != self._tree.end():
 *             yield <object>dereference(it).getSecond()
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->_tree->begin();

  /* "pyredblack/redblack.pyx":533
 *         '''Return an iterator over the dictionarys values.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()
 *         while it != self._tree.end():             # <<<<<<<<<<<<<<
 *             yield <object>dereference(it).getSecond()
 *             preincrement(it)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->_tree->end()) != 0);
    if (!__pyx_t_1) break;

    /* "pyredblack/redblack.pyx":534
 *         cdef PairRBTreeIterator it = self._tree.begin()
 *         while it != self._tree.end():
 *             yield <object>dereference(it).getSecond()             # <<<<<<<<<<<<<<
 *             preincrement(it)
 * 
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).getSecond();
    __Pyx_INCREF(((PyObject *)__pyx_t_2));
    __pyx_r = ((PyObject *)__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pyredblack/redblack.pyx":535
 *         while it != self._tree.end():
 *             yield <object>dereference(it).getSecond()
 *             preincrement(it)             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
 */
    (++__pyx_cur_scope->__pyx_v_it);
  }

  /* "pyredblack/redblack.pyx":530
 *             preincrement(it)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         '''Return an iterator over the dictionarys values.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("itervalues", __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_10pyredblack_8redblack_6rbdict_42generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "pyredblack/redblack.pyx":537
 *             preincrement(it)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         '''Return an iterator over the dictionarys `(key, value)` pairs.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_41iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_40iteritems[] = "Return an iterator over the dictionary\342\200\231s `(key, value)` pairs.";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_41iteritems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_40iteritems(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_40iteritems(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems *)__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_10_iteritems(__pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_10_iteritems, __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((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_10pyredblack_8redblack_6rbdict_42generator3, (PyObject *) __pyx_cur_scope, __pyx_n_s_iteritems, __pyx_n_s_rbdict_iteritems); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __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("pyredblack.redblack.rbdict.iteritems", __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_10pyredblack_8redblack_6rbdict_42generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems *__pyx_cur_scope = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
  PyObject *__pyx_t_4 = 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 = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyredblack/redblack.pyx":539
 *     def iteritems(self):
 *         '''Return an iterator over the dictionarys `(key, value)` pairs.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()             # <<<<<<<<<<<<<<
 *         while it != self._tree.end():
 *             yield (<object>dereference(it).getFirst(),
 */
  __pyx_cur_scope->__pyx_v_it = __pyx_cur_scope->__pyx_v_self->_tree->begin();

  /* "pyredblack/redblack.pyx":540
 *         '''Return an iterator over the dictionarys `(key, value)` pairs.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()
 *         while it != self._tree.end():             # <<<<<<<<<<<<<<
 *             yield (<object>dereference(it).getFirst(),
 *                    <object>dereference(it).getSecond())
 */
  while (1) {
    __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_it != __pyx_cur_scope->__pyx_v_self->_tree->end()) != 0);
    if (!__pyx_t_1) break;

    /* "pyredblack/redblack.pyx":541
 *         cdef PairRBTreeIterator it = self._tree.begin()
 *         while it != self._tree.end():
 *             yield (<object>dereference(it).getFirst(),             # <<<<<<<<<<<<<<
 *                    <object>dereference(it).getSecond())
 *             preincrement(it)
 */
    __pyx_t_2 = (*__pyx_cur_scope->__pyx_v_it).getFirst();

    /* "pyredblack/redblack.pyx":542
 *         while it != self._tree.end():
 *             yield (<object>dereference(it).getFirst(),
 *                    <object>dereference(it).getSecond())             # <<<<<<<<<<<<<<
 *             preincrement(it)
 * 
 */
    __pyx_t_3 = (*__pyx_cur_scope->__pyx_v_it).getSecond();

    /* "pyredblack/redblack.pyx":541
 *         cdef PairRBTreeIterator it = self._tree.begin()
 *         while it != self._tree.end():
 *             yield (<object>dereference(it).getFirst(),             # <<<<<<<<<<<<<<
 *                    <object>dereference(it).getSecond())
 *             preincrement(it)
 */
    __pyx_t_4 = PyTuple_New(2); 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_INCREF(((PyObject *)__pyx_t_2));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(((PyObject *)__pyx_t_3));
    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pyredblack/redblack.pyx":543
 *             yield (<object>dereference(it).getFirst(),
 *                    <object>dereference(it).getSecond())
 *             preincrement(it)             # <<<<<<<<<<<<<<
 * 
 *     def pop(self, key, default=None):
 */
    (++__pyx_cur_scope->__pyx_v_it);
  }

  /* "pyredblack/redblack.pyx":537
 *             preincrement(it)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         '''Return an iterator over the dictionarys `(key, value)` pairs.'''
 *         cdef PairRBTreeIterator it = self._tree.begin()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("iteritems", __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;
}

/* "pyredblack/redblack.pyx":545
 *             preincrement(it)
 * 
 *     def pop(self, key, default=None):             # <<<<<<<<<<<<<<
 *         '''
 *         If `key` is in the dictionary, remove it and return its value,
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_44pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_43pop[] = "\n        If `key` is in the dictionary, remove it and return its value,\n        else return `default`.\n        ";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_44pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pop") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __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_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_43pop(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_43pop(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  CYTHON_UNUSED Py_hash_t __pyx_v__hash;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_hash_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pop", 0);

  /* "pyredblack/redblack.pyx":550
 *         else return `default`.
 *         '''
 *         _hash = hash(key)             # <<<<<<<<<<<<<<
 *         cdef object value = default
 *         if self._tree.del_key_save_value(key, value):
 */
  __pyx_t_1 = PyObject_Hash(__pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v__hash = __pyx_t_1;

  /* "pyredblack/redblack.pyx":551
 *         '''
 *         _hash = hash(key)
 *         cdef object value = default             # <<<<<<<<<<<<<<
 *         if self._tree.del_key_save_value(key, value):
 *             self._num_nodes -= 1
 */
  __Pyx_INCREF(__pyx_v_default);
  __pyx_v_value = __pyx_v_default;

  /* "pyredblack/redblack.pyx":552
 *         _hash = hash(key)
 *         cdef object value = default
 *         if self._tree.del_key_save_value(key, value):             # <<<<<<<<<<<<<<
 *             self._num_nodes -= 1
 *         return value
 */
  __pyx_t_2 = (__pyx_v_self->_tree->del_key_save_value(__pyx_v_key, __pyx_v_value) != 0);
  if (__pyx_t_2) {

    /* "pyredblack/redblack.pyx":553
 *         cdef object value = default
 *         if self._tree.del_key_save_value(key, value):
 *             self._num_nodes -= 1             # <<<<<<<<<<<<<<
 *         return value
 * 
 */
    __pyx_v_self->_num_nodes = (__pyx_v_self->_num_nodes - 1);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":554
 *         if self._tree.del_key_save_value(key, value):
 *             self._num_nodes -= 1
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def popitem(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "pyredblack/redblack.pyx":545
 *             preincrement(it)
 * 
 *     def pop(self, key, default=None):             # <<<<<<<<<<<<<<
 *         '''
 *         If `key` is in the dictionary, remove it and return its value,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":556
 *         return value
 * 
 *     def popitem(self):             # <<<<<<<<<<<<<<
 *         '''
 *         Remove and return an arbitrary `(key, value)` pair from the
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_46popitem(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_45popitem[] = "\n        Remove and return an arbitrary `(key, value)` pair from the\n        dictionary.\n        ";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_46popitem(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("popitem (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_45popitem(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_45popitem(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("popitem", 0);

  /* "pyredblack/redblack.pyx":561
 *         dictionary.
 *         '''
 *         cdef object key = None             # <<<<<<<<<<<<<<
 *         cdef object value = None
 *         if self._tree.pop_first_save_item(key, value):
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_key = Py_None;

  /* "pyredblack/redblack.pyx":562
 *         '''
 *         cdef object key = None
 *         cdef object value = None             # <<<<<<<<<<<<<<
 *         if self._tree.pop_first_save_item(key, value):
 *             self._num_nodes -= 1
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_value = Py_None;

  /* "pyredblack/redblack.pyx":563
 *         cdef object key = None
 *         cdef object value = None
 *         if self._tree.pop_first_save_item(key, value):             # <<<<<<<<<<<<<<
 *             self._num_nodes -= 1
 *             return (key, value)
 */
  __pyx_t_1 = (__pyx_v_self->_tree->pop_first_save_item(__pyx_v_key, __pyx_v_value) != 0);
  if (__pyx_t_1) {

    /* "pyredblack/redblack.pyx":564
 *         cdef object value = None
 *         if self._tree.pop_first_save_item(key, value):
 *             self._num_nodes -= 1             # <<<<<<<<<<<<<<
 *             return (key, value)
 *         raise KeyError('popitem(): dictionary is empty')
 */
    __pyx_v_self->_num_nodes = (__pyx_v_self->_num_nodes - 1);

    /* "pyredblack/redblack.pyx":565
 *         if self._tree.pop_first_save_item(key, value):
 *             self._num_nodes -= 1
 *             return (key, value)             # <<<<<<<<<<<<<<
 *         raise KeyError('popitem(): dictionary is empty')
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key);
    __Pyx_GIVEREF(__pyx_v_key);
    __Pyx_INCREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "pyredblack/redblack.pyx":566
 *             self._num_nodes -= 1
 *             return (key, value)
 *         raise KeyError('popitem(): dictionary is empty')             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __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 = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyredblack/redblack.pyx":556
 *         return value
 * 
 *     def popitem(self):             # <<<<<<<<<<<<<<
 *         '''
 *         Remove and return an arbitrary `(key, value)` pair from the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.popitem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":568
 *         raise KeyError('popitem(): dictionary is empty')
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         '''Return a shallow copy of the dictionary.'''
 *         return rbdict(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_48copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_47copy[] = "Return a shallow copy of the dictionary.";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_48copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_47copy(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self));

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_47copy(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_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("copy", 0);

  /* "pyredblack/redblack.pyx":570
 *     def copy(self):
 *         '''Return a shallow copy of the dictionary.'''
 *         return rbdict(self)             # <<<<<<<<<<<<<<
 * 
 *     def update(self, mapping = None, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10pyredblack_8redblack_rbdict)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __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;

  /* "pyredblack/redblack.pyx":568
 *         raise KeyError('popitem(): dictionary is empty')
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         '''Return a shallow copy of the dictionary.'''
 *         return rbdict(self)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyredblack/redblack.pyx":572
 *         return rbdict(self)
 * 
 *     def update(self, mapping = None, **kwargs):             # <<<<<<<<<<<<<<
 *         '''
 *         Update the dictionary with the key/value pairs from `mapping`
 */

/* Python wrapper */
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_50update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_10pyredblack_8redblack_6rbdict_49update[] = "\n        Update the dictionary with the key/value pairs from `mapping`\n        and/or `kwargs`, overwriting existing keys.\n\n        `update()` accepts either another dictionary object or an\n        iterable of key/value pairs (as tuples or other iterables of\n        length two). If keyword arguments are specified, the\n        dictionary is then updated with those key/value pairs.\n        ";
static PyObject *__pyx_pw_10pyredblack_8redblack_6rbdict_50update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mapping = 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("update (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mapping,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mapping);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "update") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mapping = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_10pyredblack_8redblack_6rbdict_49update(((struct __pyx_obj_10pyredblack_8redblack_rbdict *)__pyx_v_self), __pyx_v_mapping, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_10pyredblack_8redblack_6rbdict_49update(struct __pyx_obj_10pyredblack_8redblack_rbdict *__pyx_v_self, PyObject *__pyx_v_mapping, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_items = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_val = NULL;
  PyObject *__pyx_v_item = 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;
  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;
  Py_ssize_t __pyx_t_16;
  PyObject *(*__pyx_t_17)(PyObject *);
  PyObject *(*__pyx_t_18)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update", 0);

  /* "pyredblack/redblack.pyx":582
 *         dictionary is then updated with those key/value pairs.
 *         '''
 *         if mapping is not None:             # <<<<<<<<<<<<<<
 *             # try mapping as a dict first
 *             items = None
 */
  __pyx_t_1 = (__pyx_v_mapping != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pyredblack/redblack.pyx":584
 *         if mapping is not None:
 *             # try mapping as a dict first
 *             items = None             # <<<<<<<<<<<<<<
 *             try:
 *                 items = mapping.iteritems()
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_items = Py_None;

    /* "pyredblack/redblack.pyx":585
 *             # try mapping as a dict first
 *             items = None
 *             try:             # <<<<<<<<<<<<<<
 *                 items = mapping.iteritems()
 *             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:*/ {

        /* "pyredblack/redblack.pyx":586
 *             items = None
 *             try:
 *                 items = mapping.iteritems()             # <<<<<<<<<<<<<<
 *             except AttributeError:
 *                 try:
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_mapping, __pyx_n_s_iteritems); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L4_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 = 586; __pyx_clineno = __LINE__; goto __pyx_L4_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 = 586; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        }
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF_SET(__pyx_v_items, __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_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "pyredblack/redblack.pyx":587
 *             try:
 *                 items = mapping.iteritems()
 *             except AttributeError:             # <<<<<<<<<<<<<<
 *                 try:
 *                     items = mapping.items()
 */
      __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
      if (__pyx_t_9) {
        __Pyx_AddTraceback("pyredblack.redblack.rbdict.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_8);

        /* "pyredblack/redblack.pyx":588
 *                 items = mapping.iteritems()
 *             except AttributeError:
 *                 try:             # <<<<<<<<<<<<<<
 *                     items = mapping.items()
 *                 except AttributeError:
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);
          /*try:*/ {

            /* "pyredblack/redblack.pyx":589
 *             except AttributeError:
 *                 try:
 *                     items = mapping.items()             # <<<<<<<<<<<<<<
 *                 except AttributeError:
 *                     pass
 */
            __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_mapping, __pyx_n_s_items); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
            __Pyx_GOTREF(__pyx_t_14);
            __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_13 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            } else {
              __pyx_t_13 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
            }
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_DECREF_SET(__pyx_v_items, __pyx_t_13);
            __pyx_t_13 = 0;
          }
          __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;
          goto __pyx_L21_try_end;
          __pyx_L14_error:;
          __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;

          /* "pyredblack/redblack.pyx":590
 *                 try:
 *                     items = mapping.items()
 *                 except AttributeError:             # <<<<<<<<<<<<<<
 *                     pass
 *             if items:
 */
          __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
          if (__pyx_t_9) {
            PyErr_Restore(0,0,0);
            goto __pyx_L15_exception_handled;
          }
          goto __pyx_L16_except_error;
          __pyx_L16_except_error:;
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
          goto __pyx_L6_except_error;
          __pyx_L15_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
          __pyx_L21_try_end:;
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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_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:;
    }

    /* "pyredblack/redblack.pyx":592
 *                 except AttributeError:
 *                     pass
 *             if items:             # <<<<<<<<<<<<<<
 *                 for key, val in items:
 *                     self[key] = val
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_items); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "pyredblack/redblack.pyx":593
 *                     pass
 *             if items:
 *                 for key, val in items:             # <<<<<<<<<<<<<<
 *                     self[key] = val
 *             else:
 */
      if (likely(PyList_CheckExact(__pyx_v_items)) || PyTuple_CheckExact(__pyx_v_items)) {
        __pyx_t_8 = __pyx_v_items; __Pyx_INCREF(__pyx_t_8); __pyx_t_16 = 0;
        __pyx_t_17 = NULL;
      } else {
        __pyx_t_16 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_items); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_17 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      for (;;) {
        if (likely(!__pyx_t_17)) {
          if (likely(PyList_CheckExact(__pyx_t_8))) {
            if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_8)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_16); __Pyx_INCREF(__pyx_t_7); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            #else
            __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            #endif
          } else {
            if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_16); __Pyx_INCREF(__pyx_t_7); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            #else
            __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            #endif
          }
        } else {
          __pyx_t_7 = __pyx_t_17(__pyx_t_8);
          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 = 593; __pyx_clineno = __LINE__; goto __pyx_L1_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 = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          #if CYTHON_COMPILING_IN_CPYTHON
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_13);
          #else
          __pyx_t_6 = PySequence_ITEM(sequence, 0); 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_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_13);
          #endif
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_14 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_18 = Py_TYPE(__pyx_t_14)->tp_iternext;
          index = 0; __pyx_t_6 = __pyx_t_18(__pyx_t_14); if (unlikely(!__pyx_t_6)) goto __pyx_L25_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_6);
          index = 1; __pyx_t_13 = __pyx_t_18(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L25_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_13);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_18(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_18 = NULL;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          goto __pyx_L26_unpacking_done;
          __pyx_L25_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_18 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_L26_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_13);
        __pyx_t_13 = 0;

        /* "pyredblack/redblack.pyx":594
 *             if items:
 *                 for key, val in items:
 *                     self[key] = val             # <<<<<<<<<<<<<<
 *             else:
 *                 # raises TypeError if not iterable
 */
        if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_key, __pyx_v_val) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "pyredblack/redblack.pyx":593
 *                     pass
 *             if items:
 *                 for key, val in items:             # <<<<<<<<<<<<<<
 *                     self[key] = val
 *             else:
 */
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L22;
    }
    /*else*/ {

      /* "pyredblack/redblack.pyx":597
 *             else:
 *                 # raises TypeError if not iterable
 *                 for item in mapping:             # <<<<<<<<<<<<<<
 *                     try:
 *                         key, val = item
 */
      if (likely(PyList_CheckExact(__pyx_v_mapping)) || PyTuple_CheckExact(__pyx_v_mapping)) {
        __pyx_t_8 = __pyx_v_mapping; __Pyx_INCREF(__pyx_t_8); __pyx_t_16 = 0;
        __pyx_t_17 = NULL;
      } else {
        __pyx_t_16 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_mapping); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_17 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      for (;;) {
        if (likely(!__pyx_t_17)) {
          if (likely(PyList_CheckExact(__pyx_t_8))) {
            if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_8)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_16); __Pyx_INCREF(__pyx_t_7); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            #else
            __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            #endif
          } else {
            if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_16); __Pyx_INCREF(__pyx_t_7); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            #else
            __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            #endif
          }
        } else {
          __pyx_t_7 = __pyx_t_17(__pyx_t_8);
          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 = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_7);
        }
        __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "pyredblack/redblack.pyx":598
 *                 # raises TypeError if not iterable
 *                 for item in mapping:
 *                     try:             # <<<<<<<<<<<<<<
 *                         key, val = item
 *                     except ValueError:
 */
        {
          __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:*/ {

            /* "pyredblack/redblack.pyx":599
 *                 for item in mapping:
 *                     try:
 *                         key, val = item             # <<<<<<<<<<<<<<
 *                     except ValueError:
 *                         raise ValueError('dictionary update sequence element '
 */
            if ((likely(PyTuple_CheckExact(__pyx_v_item))) || (PyList_CheckExact(__pyx_v_item))) {
              PyObject* sequence = __pyx_v_item;
              #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 = 599; __pyx_clineno = __LINE__; goto __pyx_L29_error;}
              }
              #if CYTHON_COMPILING_IN_CPYTHON
              if (likely(PyTuple_CheckExact(sequence))) {
                __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
                __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); 
              } else {
                __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
                __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
              }
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_13);
              #else
              __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L29_error;}
              __Pyx_GOTREF(__pyx_t_7);
              __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L29_error;}
              __Pyx_GOTREF(__pyx_t_13);
              #endif
            } else {
              Py_ssize_t index = -1;
              __pyx_t_6 = PyObject_GetIter(__pyx_v_item); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L29_error;}
              __Pyx_GOTREF(__pyx_t_6);
              __pyx_t_18 = Py_TYPE(__pyx_t_6)->tp_iternext;
              index = 0; __pyx_t_7 = __pyx_t_18(__pyx_t_6); if (unlikely(!__pyx_t_7)) goto __pyx_L37_unpacking_failed;
              __Pyx_GOTREF(__pyx_t_7);
              index = 1; __pyx_t_13 = __pyx_t_18(__pyx_t_6); if (unlikely(!__pyx_t_13)) goto __pyx_L37_unpacking_failed;
              __Pyx_GOTREF(__pyx_t_13);
              if (__Pyx_IternextUnpackEndCheck(__pyx_t_18(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L29_error;}
              __pyx_t_18 = NULL;
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              goto __pyx_L38_unpacking_done;
              __pyx_L37_unpacking_failed:;
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __pyx_t_18 = NULL;
              if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L29_error;}
              __pyx_L38_unpacking_done:;
            }
            __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_7);
            __pyx_t_7 = 0;
            __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_13);
            __pyx_t_13 = 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_L36_try_end;
          __pyx_L29_error:;
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;

          /* "pyredblack/redblack.pyx":600
 *                     try:
 *                         key, val = item
 *                     except ValueError:             # <<<<<<<<<<<<<<
 *                         raise ValueError('dictionary update sequence element '
 *                                          'must have length 2')
 */
          __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
          if (__pyx_t_9) {
            __Pyx_AddTraceback("pyredblack.redblack.rbdict.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_7, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L31_except_error;}
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GOTREF(__pyx_t_6);

            /* "pyredblack/redblack.pyx":601
 *                         key, val = item
 *                     except ValueError:
 *                         raise ValueError('dictionary update sequence element '             # <<<<<<<<<<<<<<
 *                                          'must have length 2')
 *                     except TypeError:
 */
            __pyx_t_14 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L31_except_error;}
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_Raise(__pyx_t_14, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L31_except_error;}
          }

          /* "pyredblack/redblack.pyx":603
 *                         raise ValueError('dictionary update sequence element '
 *                                          'must have length 2')
 *                     except TypeError:             # <<<<<<<<<<<<<<
 *                         raise TypeError('cannot convert dictionary update '
 *                                         'sequence element to a sequence')
 */
          __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
          if (__pyx_t_9) {
            __Pyx_AddTraceback("pyredblack.redblack.rbdict.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L31_except_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GOTREF(__pyx_t_13);

            /* "pyredblack/redblack.pyx":604
 *                                          'must have length 2')
 *                     except TypeError:
 *                         raise TypeError('cannot convert dictionary update '             # <<<<<<<<<<<<<<
 *                                         'sequence element to a sequence')
 *                     self[key] = val
 */
            __pyx_t_14 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L31_except_error;}
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_Raise(__pyx_t_14, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L31_except_error;}
          }
          goto __pyx_L31_except_error;
          __pyx_L31_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_L36_try_end:;
        }

        /* "pyredblack/redblack.pyx":606
 *                         raise TypeError('cannot convert dictionary update '
 *                                         'sequence element to a sequence')
 *                     self[key] = val             # <<<<<<<<<<<<<<
 *         for key, val in kwargs.items():
 *             self[key] = val
 */
        if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_key, __pyx_v_val) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "pyredblack/redblack.pyx":597
 *             else:
 *                 # raises TypeError if not iterable
 *                 for item in mapping:             # <<<<<<<<<<<<<<
 *                     try:
 *                         key, val = item
 */
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __pyx_L22:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyredblack/redblack.pyx":607
 *                                         'sequence element to a sequence')
 *                     self[key] = val
 *         for key, val in kwargs.items():             # <<<<<<<<<<<<<<
 *             self[key] = val
 */
  __pyx_t_8 = __Pyx_PyDict_Items(__pyx_v_kwargs); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __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_13 = __pyx_t_8; __Pyx_INCREF(__pyx_t_13); __pyx_t_16 = 0;
    __pyx_t_17 = NULL;
  } else {
    __pyx_t_16 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_17 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __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_13))) {
        if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_13)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_16); __Pyx_INCREF(__pyx_t_8); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_13, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_13)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_16); __Pyx_INCREF(__pyx_t_8); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_13, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_8 = __pyx_t_17(__pyx_t_13);
      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 = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_8);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
      PyObject* sequence = __pyx_t_8;
      #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 = 607; __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_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); 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);
      #endif
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_14 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_18 = Py_TYPE(__pyx_t_14)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_18(__pyx_t_14); if (unlikely(!__pyx_t_7)) goto __pyx_L45_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_6 = __pyx_t_18(__pyx_t_14); if (unlikely(!__pyx_t_6)) goto __pyx_L45_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_18(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_18 = NULL;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      goto __pyx_L46_unpacking_done;
      __pyx_L45_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_18 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L46_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pyredblack/redblack.pyx":608
 *                     self[key] = val
 *         for key, val in kwargs.items():
 *             self[key] = val             # <<<<<<<<<<<<<<
 */
    if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_key, __pyx_v_val) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pyredblack/redblack.pyx":607
 *                                         'sequence element to a sequence')
 *                     self[key] = val
 *         for key, val in kwargs.items():             # <<<<<<<<<<<<<<
 *             self[key] = val
 */
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "pyredblack/redblack.pyx":572
 *         return rbdict(self)
 * 
 *     def update(self, mapping = None, **kwargs):             # <<<<<<<<<<<<<<
 *         '''
 *         Update the dictionary with the key/value pairs from `mapping`
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("pyredblack.redblack.rbdict.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_items);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_10pyredblack_8redblack_rbset(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_10pyredblack_8redblack_5rbset_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_10pyredblack_8redblack_rbset(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_10pyredblack_8redblack_5rbset_5__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_10pyredblack_8redblack_rbset[] = {
  {"add", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_14add, METH_O, __pyx_doc_10pyredblack_8redblack_5rbset_13add},
  {"remove", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_16remove, METH_O, __pyx_doc_10pyredblack_8redblack_5rbset_15remove},
  {"discard", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_18discard, METH_O, __pyx_doc_10pyredblack_8redblack_5rbset_17discard},
  {"pop", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_20pop, METH_NOARGS, __pyx_doc_10pyredblack_8redblack_5rbset_19pop},
  {"clear", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_22clear, METH_NOARGS, __pyx_doc_10pyredblack_8redblack_5rbset_21clear},
  {"isdisjoint", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_24isdisjoint, METH_O, __pyx_doc_10pyredblack_8redblack_5rbset_23isdisjoint},
  {"issubset", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_26issubset, METH_O, __pyx_doc_10pyredblack_8redblack_5rbset_25issubset},
  {"issuperset", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_28issuperset, METH_O, __pyx_doc_10pyredblack_8redblack_5rbset_27issuperset},
  {"union", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_32union, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyredblack_8redblack_5rbset_31union},
  {"intersection", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_36intersection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyredblack_8redblack_5rbset_35intersection},
  {"difference", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_40difference, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyredblack_8redblack_5rbset_39difference},
  {"symmetric_difference", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_44symmetric_difference, METH_O, __pyx_doc_10pyredblack_8redblack_5rbset_43symmetric_difference},
  {"copy", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_48copy, METH_NOARGS, __pyx_doc_10pyredblack_8redblack_5rbset_47copy},
  {"update", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_50update, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyredblack_8redblack_5rbset_49update},
  {"intersection_update", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_54intersection_update, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyredblack_8redblack_5rbset_53intersection_update},
  {"difference_update", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_58difference_update, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyredblack_8redblack_5rbset_57difference_update},
  {"symmetric_difference_update", (PyCFunction)__pyx_pw_10pyredblack_8redblack_5rbset_62symmetric_difference_update, METH_O, __pyx_doc_10pyredblack_8redblack_5rbset_61symmetric_difference_update},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_rbset = {
  0, /*nb_add*/
  __pyx_pw_10pyredblack_8redblack_5rbset_42__sub__, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  __pyx_pw_10pyredblack_8redblack_5rbset_38__and__, /*nb_and*/
  __pyx_pw_10pyredblack_8redblack_5rbset_46__xor__, /*nb_xor*/
  __pyx_pw_10pyredblack_8redblack_5rbset_34__or__, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  __pyx_pw_10pyredblack_8redblack_5rbset_60__isub__, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  __pyx_pw_10pyredblack_8redblack_5rbset_56__iand__, /*nb_inplace_and*/
  __pyx_pw_10pyredblack_8redblack_5rbset_64__ixor__, /*nb_inplace_xor*/
  __pyx_pw_10pyredblack_8redblack_5rbset_52__ior__, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_rbset = {
  __pyx_pw_10pyredblack_8redblack_5rbset_7__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_10pyredblack_8redblack_5rbset_9__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_rbset = {
  __pyx_pw_10pyredblack_8redblack_5rbset_7__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_10pyredblack_8redblack_rbset = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyredblack.redblack.rbset", /*tp_name*/
  sizeof(struct __pyx_obj_10pyredblack_8redblack_rbset), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pyredblack_8redblack_rbset, /*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*/
  &__pyx_tp_as_number_rbset, /*tp_as_number*/
  &__pyx_tp_as_sequence_rbset, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_rbset, /*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_BASETYPE, /*tp_flags*/
  "Red-black-tree-based set.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_pw_10pyredblack_8redblack_5rbset_30__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_10pyredblack_8redblack_5rbset_11__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pyredblack_8redblack_rbset, /*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*/
  __pyx_pw_10pyredblack_8redblack_5rbset_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pyredblack_8redblack_rbset, /*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 PyObject *__pyx_tp_new_10pyredblack_8redblack_rbdict(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_10pyredblack_8redblack_6rbdict_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_10pyredblack_8redblack_rbdict(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_10pyredblack_8redblack_6rbdict_5__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_10pyredblack_8redblack_rbdict(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_10pyredblack_8redblack_rbdict(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_10pyredblack_8redblack_6rbdict_13__setitem__(o, i, v);
  }
  else {
    return __pyx_pw_10pyredblack_8redblack_6rbdict_15__delitem__(o, i);
  }
}

static PyMethodDef __pyx_methods_10pyredblack_8redblack_rbdict[] = {
  {"__missing__", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_9__missing__, METH_O, __pyx_doc_10pyredblack_8redblack_6rbdict_8__missing__},
  {"keys", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_21keys, METH_NOARGS, __pyx_doc_10pyredblack_8redblack_6rbdict_20keys},
  {"values", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_23values, METH_NOARGS, __pyx_doc_10pyredblack_8redblack_6rbdict_22values},
  {"items", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_25items, METH_NOARGS, __pyx_doc_10pyredblack_8redblack_6rbdict_24items},
  {"has_key", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_27has_key, METH_O, __pyx_doc_10pyredblack_8redblack_6rbdict_26has_key},
  {"get", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_29get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyredblack_8redblack_6rbdict_28get},
  {"clear", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_31clear, METH_NOARGS, __pyx_doc_10pyredblack_8redblack_6rbdict_30clear},
  {"setdefault", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_33setdefault, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyredblack_8redblack_6rbdict_32setdefault},
  {"iterkeys", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_35iterkeys, METH_NOARGS, __pyx_doc_10pyredblack_8redblack_6rbdict_34iterkeys},
  {"itervalues", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_38itervalues, METH_NOARGS, __pyx_doc_10pyredblack_8redblack_6rbdict_37itervalues},
  {"iteritems", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_41iteritems, METH_NOARGS, __pyx_doc_10pyredblack_8redblack_6rbdict_40iteritems},
  {"pop", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_44pop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyredblack_8redblack_6rbdict_43pop},
  {"popitem", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_46popitem, METH_NOARGS, __pyx_doc_10pyredblack_8redblack_6rbdict_45popitem},
  {"copy", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_48copy, METH_NOARGS, __pyx_doc_10pyredblack_8redblack_6rbdict_47copy},
  {"update", (PyCFunction)__pyx_pw_10pyredblack_8redblack_6rbdict_50update, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyredblack_8redblack_6rbdict_49update},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_rbdict = {
  __pyx_pw_10pyredblack_8redblack_6rbdict_7__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_10pyredblack_8redblack_rbdict, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_10pyredblack_8redblack_6rbdict_17__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_rbdict = {
  __pyx_pw_10pyredblack_8redblack_6rbdict_7__len__, /*mp_length*/
  __pyx_pw_10pyredblack_8redblack_6rbdict_11__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_10pyredblack_8redblack_rbdict, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_10pyredblack_8redblack_rbdict = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyredblack.redblack.rbdict", /*tp_name*/
  sizeof(struct __pyx_obj_10pyredblack_8redblack_rbdict), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pyredblack_8redblack_rbdict, /*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*/
  &__pyx_tp_as_sequence_rbdict, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_rbdict, /*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_BASETYPE, /*tp_flags*/
  "Red-black-tree-based associative array.", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_10pyredblack_8redblack_6rbdict_19__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_10pyredblack_8redblack_rbdict, /*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*/
  __pyx_pw_10pyredblack_8redblack_6rbdict_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_10pyredblack_8redblack_rbdict, /*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_10pyredblack_8redblack___pyx_scope_struct____iter__ *__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct____iter__[8];
static int __pyx_freecount_10pyredblack_8redblack___pyx_scope_struct____iter__ = 0;

static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__ *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__)))) {
    o = (PyObject*)__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct____iter__[--__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct____iter__];
    memset(o, 0, sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__ *)o);
  new((void*)&(p->__pyx_v_it)) ObjectRBTreeIterator();
  return o;
}

static void __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct____iter__(PyObject *o) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__ *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__ *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(&p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__)))) {
    __pyx_freelist_10pyredblack_8redblack___pyx_scope_struct____iter__[__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct____iter__++] = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_10pyredblack_8redblack___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__ *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct____iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__ *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_10pyredblack_8redblack_rbset *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_10pyredblack_8redblack___pyx_scope_struct____iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyredblack.redblack.__pyx_scope_struct____iter__", /*tp_name*/
  sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct____iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct____iter__, /*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_10pyredblack_8redblack___pyx_scope_struct____iter__, /*tp_traverse*/
  __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct____iter__, /*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_10pyredblack_8redblack___pyx_scope_struct____iter__, /*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_10pyredblack_8redblack___pyx_scope_struct_1___and__ *__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_1___and__[8];
static int __pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_1___and__ = 0;

static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_1___and__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_1___and__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__)))) {
    o = (PyObject*)__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_1___and__[--__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_1___and__];
    memset(o, 0, sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__));
    (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_10pyredblack_8redblack___pyx_scope_struct_1___and__(PyObject *o) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__ *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_bigger);
  Py_CLEAR(p->__pyx_v_smaller);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_1___and__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__)))) {
    __pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_1___and__[__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_1___and__++] = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_10pyredblack_8redblack___pyx_scope_struct_1___and__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__ *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__ *)o;
  if (p->__pyx_v_bigger) {
    e = (*v)(p->__pyx_v_bigger, a); if (e) return e;
  }
  if (p->__pyx_v_smaller) {
    e = (*v)(p->__pyx_v_smaller, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct_1___and__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__ *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__ *)o;
  tmp = ((PyObject*)p->__pyx_v_bigger);
  p->__pyx_v_bigger = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_smaller);
  p->__pyx_v_smaller = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_10pyredblack_8redblack___pyx_scope_struct_1___and__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyredblack.redblack.__pyx_scope_struct_1___and__", /*tp_name*/
  sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct_1___and__, /*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_10pyredblack_8redblack___pyx_scope_struct_1___and__, /*tp_traverse*/
  __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct_1___and__, /*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_10pyredblack_8redblack___pyx_scope_struct_1___and__, /*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_10pyredblack_8redblack___pyx_scope_struct_2_genexpr *__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_2_genexpr[8];
static int __pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_2_genexpr = 0;

static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_2_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_genexpr)))) {
    o = (PyObject*)__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_2_genexpr[--__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_2_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_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_10pyredblack_8redblack___pyx_scope_struct_2_genexpr(PyObject *o) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_elem);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_2_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_genexpr)))) {
    __pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_2_genexpr[__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_10pyredblack_8redblack___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_elem) {
    e = (*v)(p->__pyx_v_elem, 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_10pyredblack_8redblack___pyx_scope_struct_2_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_1___and__ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_elem);
  p->__pyx_v_elem = 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_10pyredblack_8redblack___pyx_scope_struct_2_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyredblack.redblack.__pyx_scope_struct_2_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_2_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct_2_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_10pyredblack_8redblack___pyx_scope_struct_2_genexpr, /*tp_traverse*/
  __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct_2_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_10pyredblack_8redblack___pyx_scope_struct_2_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_10pyredblack_8redblack___pyx_scope_struct_3___sub__ *__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_3___sub__[8];
static int __pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_3___sub__ = 0;

static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_3___sub__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_3___sub__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__)))) {
    o = (PyObject*)__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_3___sub__[--__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_3___sub__];
    memset(o, 0, sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__));
    (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_10pyredblack_8redblack___pyx_scope_struct_3___sub__(PyObject *o) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__ *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_other);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_3___sub__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__)))) {
    __pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_3___sub__[__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_3___sub__++] = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_10pyredblack_8redblack___pyx_scope_struct_3___sub__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__ *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__ *)o;
  if (p->__pyx_v_other) {
    e = (*v)(p->__pyx_v_other, 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_10pyredblack_8redblack___pyx_scope_struct_3___sub__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__ *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__ *)o;
  tmp = ((PyObject*)p->__pyx_v_other);
  p->__pyx_v_other = 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_10pyredblack_8redblack___pyx_scope_struct_3___sub__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyredblack.redblack.__pyx_scope_struct_3___sub__", /*tp_name*/
  sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct_3___sub__, /*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_10pyredblack_8redblack___pyx_scope_struct_3___sub__, /*tp_traverse*/
  __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct_3___sub__, /*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_10pyredblack_8redblack___pyx_scope_struct_3___sub__, /*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_10pyredblack_8redblack___pyx_scope_struct_4_genexpr *__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_4_genexpr[8];
static int __pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_4_genexpr = 0;

static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_4_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_genexpr)))) {
    o = (PyObject*)__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_4_genexpr[--__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_4_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_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_10pyredblack_8redblack___pyx_scope_struct_4_genexpr(PyObject *o) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_elem);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_4_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_genexpr)))) {
    __pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_4_genexpr[__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_10pyredblack_8redblack___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_elem) {
    e = (*v)(p->__pyx_v_elem, 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_10pyredblack_8redblack___pyx_scope_struct_4_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_3___sub__ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_elem);
  p->__pyx_v_elem = 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_10pyredblack_8redblack___pyx_scope_struct_4_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyredblack.redblack.__pyx_scope_struct_4_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_4_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct_4_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_10pyredblack_8redblack___pyx_scope_struct_4_genexpr, /*tp_traverse*/
  __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct_4_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_10pyredblack_8redblack___pyx_scope_struct_4_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_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_5___xor__[8];
static int __pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_5___xor__ = 0;

static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_5___xor__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_5___xor__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__)))) {
    o = (PyObject*)__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_5___xor__[--__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_5___xor__];
    memset(o, 0, sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__));
    (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_10pyredblack_8redblack___pyx_scope_struct_5___xor__(PyObject *o) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_other);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_5___xor__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__)))) {
    __pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_5___xor__[__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_5___xor__++] = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_10pyredblack_8redblack___pyx_scope_struct_5___xor__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *)o;
  if (p->__pyx_v_other) {
    e = (*v)(p->__pyx_v_other, 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_10pyredblack_8redblack___pyx_scope_struct_5___xor__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *)o;
  tmp = ((PyObject*)p->__pyx_v_other);
  p->__pyx_v_other = 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_10pyredblack_8redblack___pyx_scope_struct_5___xor__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyredblack.redblack.__pyx_scope_struct_5___xor__", /*tp_name*/
  sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct_5___xor__, /*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_10pyredblack_8redblack___pyx_scope_struct_5___xor__, /*tp_traverse*/
  __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct_5___xor__, /*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_10pyredblack_8redblack___pyx_scope_struct_5___xor__, /*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_10pyredblack_8redblack___pyx_scope_struct_6_genexpr *__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_6_genexpr[8];
static int __pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_6_genexpr = 0;

static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_6_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_genexpr)))) {
    o = (PyObject*)__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_6_genexpr[--__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_6_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_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_10pyredblack_8redblack___pyx_scope_struct_6_genexpr(PyObject *o) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_elem);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_6_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_genexpr)))) {
    __pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_6_genexpr[__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_6_genexpr++] = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_10pyredblack_8redblack___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_elem) {
    e = (*v)(p->__pyx_v_elem, 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_10pyredblack_8redblack___pyx_scope_struct_6_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_elem);
  p->__pyx_v_elem = 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_10pyredblack_8redblack___pyx_scope_struct_6_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyredblack.redblack.__pyx_scope_struct_6_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_6_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct_6_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_10pyredblack_8redblack___pyx_scope_struct_6_genexpr, /*tp_traverse*/
  __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct_6_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_10pyredblack_8redblack___pyx_scope_struct_6_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_10pyredblack_8redblack___pyx_scope_struct_7_genexpr *__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_7_genexpr[8];
static int __pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_7_genexpr = 0;

static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_7_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_genexpr)))) {
    o = (PyObject*)__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_7_genexpr[--__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_7_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_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_10pyredblack_8redblack___pyx_scope_struct_7_genexpr(PyObject *o) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_elem);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_7_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_genexpr)))) {
    __pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_7_genexpr[__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_7_genexpr++] = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_10pyredblack_8redblack___pyx_scope_struct_7_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_elem) {
    e = (*v)(p->__pyx_v_elem, 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_10pyredblack_8redblack___pyx_scope_struct_7_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_5___xor__ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_elem);
  p->__pyx_v_elem = 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_10pyredblack_8redblack___pyx_scope_struct_7_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyredblack.redblack.__pyx_scope_struct_7_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_7_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct_7_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_10pyredblack_8redblack___pyx_scope_struct_7_genexpr, /*tp_traverse*/
  __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct_7_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_10pyredblack_8redblack___pyx_scope_struct_7_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_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys *__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys[8];
static int __pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys = 0;

static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys)))) {
    o = (PyObject*)__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys[--__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys];
    memset(o, 0, sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys *)o);
  new((void*)&(p->__pyx_v_it)) PairRBTreeIterator();
  return o;
}

static void __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys(PyObject *o) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(&p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys)))) {
    __pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys[__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys++] = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_10pyredblack_8redblack_rbdict *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyredblack.redblack.__pyx_scope_struct_8_iterkeys", /*tp_name*/
  sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys, /*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_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys, /*tp_traverse*/
  __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys, /*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_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys, /*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_10pyredblack_8redblack___pyx_scope_struct_9_itervalues *__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_9_itervalues[8];
static int __pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_9_itervalues = 0;

static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_9_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_9_itervalues > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues)))) {
    o = (PyObject*)__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_9_itervalues[--__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_9_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues *)o);
  new((void*)&(p->__pyx_v_it)) PairRBTreeIterator();
  return o;
}

static void __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct_9_itervalues(PyObject *o) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(&p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_9_itervalues < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues)))) {
    __pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_9_itervalues[__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_9_itervalues++] = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_10pyredblack_8redblack___pyx_scope_struct_9_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct_9_itervalues(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_10pyredblack_8redblack_rbdict *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_10pyredblack_8redblack___pyx_scope_struct_9_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyredblack.redblack.__pyx_scope_struct_9_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_9_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct_9_itervalues, /*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_10pyredblack_8redblack___pyx_scope_struct_9_itervalues, /*tp_traverse*/
  __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct_9_itervalues, /*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_10pyredblack_8redblack___pyx_scope_struct_9_itervalues, /*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_10pyredblack_8redblack___pyx_scope_struct_10_iteritems *__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_10_iteritems[8];
static int __pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_10_iteritems = 0;

static PyObject *__pyx_tp_new_10pyredblack_8redblack___pyx_scope_struct_10_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_10_iteritems > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems)))) {
    o = (PyObject*)__pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_10_iteritems[--__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_10_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems *)o);
  new((void*)&(p->__pyx_v_it)) PairRBTreeIterator();
  return o;
}

static void __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct_10_iteritems(PyObject *o) {
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems *)o;
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(&p->__pyx_v_it);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_10_iteritems < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems)))) {
    __pyx_freelist_10pyredblack_8redblack___pyx_scope_struct_10_iteritems[__pyx_freecount_10pyredblack_8redblack___pyx_scope_struct_10_iteritems++] = ((struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_10pyredblack_8redblack___pyx_scope_struct_10_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct_10_iteritems(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems *p = (struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_10pyredblack_8redblack_rbdict *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_10pyredblack_8redblack___pyx_scope_struct_10_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyredblack.redblack.__pyx_scope_struct_10_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_10pyredblack_8redblack___pyx_scope_struct_10_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_10pyredblack_8redblack___pyx_scope_struct_10_iteritems, /*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_10pyredblack_8redblack___pyx_scope_struct_10_iteritems, /*tp_traverse*/
  __pyx_tp_clear_10pyredblack_8redblack___pyx_scope_struct_10_iteritems, /*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_10pyredblack_8redblack___pyx_scope_struct_10_iteritems, /*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
    "redblack",
    __pyx_k_redblack_pyx_c_Will_Roberts_25, /* 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_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
  {&__pyx_n_s_and, __pyx_k_and, sizeof(__pyx_k_and), 0, 0, 1, 1},
  {&__pyx_n_s_and___locals_genexpr, __pyx_k_and___locals_genexpr, sizeof(__pyx_k_and___locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_kp_s_cannot_convert_dictionary_update, __pyx_k_cannot_convert_dictionary_update, sizeof(__pyx_k_cannot_convert_dictionary_update), 0, 0, 1, 0},
  {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_contains, __pyx_k_contains, sizeof(__pyx_k_contains), 0, 0, 1, 1},
  {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
  {&__pyx_kp_s_dictionary_update_sequence_eleme, __pyx_k_dictionary_update_sequence_eleme, sizeof(__pyx_k_dictionary_update_sequence_eleme), 0, 0, 1, 0},
  {&__pyx_n_s_eq, __pyx_k_eq, sizeof(__pyx_k_eq), 0, 0, 1, 1},
  {&__pyx_n_s_ge, __pyx_k_ge, sizeof(__pyx_k_ge), 0, 0, 1, 1},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_getitem, __pyx_k_getitem, sizeof(__pyx_k_getitem), 0, 0, 1, 1},
  {&__pyx_n_s_iand, __pyx_k_iand, sizeof(__pyx_k_iand), 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_iterable, __pyx_k_iterable, sizeof(__pyx_k_iterable), 0, 0, 1, 1},
  {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1},
  {&__pyx_n_s_iterkeys, __pyx_k_iterkeys, sizeof(__pyx_k_iterkeys), 0, 0, 1, 1},
  {&__pyx_n_s_itervalues, __pyx_k_itervalues, sizeof(__pyx_k_itervalues), 0, 0, 1, 1},
  {&__pyx_n_s_ixor, __pyx_k_ixor, sizeof(__pyx_k_ixor), 0, 0, 1, 1},
  {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
  {&__pyx_n_s_le, __pyx_k_le, sizeof(__pyx_k_le), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_mapping, __pyx_k_mapping, sizeof(__pyx_k_mapping), 0, 0, 1, 1},
  {&__pyx_n_s_missing, __pyx_k_missing, sizeof(__pyx_k_missing), 0, 0, 1, 1},
  {&__pyx_n_s_other, __pyx_k_other, sizeof(__pyx_k_other), 0, 0, 1, 1},
  {&__pyx_kp_s_pop_from_an_empty_set, __pyx_k_pop_from_an_empty_set, sizeof(__pyx_k_pop_from_an_empty_set), 0, 0, 1, 0},
  {&__pyx_kp_s_popitem_dictionary_is_empty, __pyx_k_popitem_dictionary_is_empty, sizeof(__pyx_k_popitem_dictionary_is_empty), 0, 0, 1, 0},
  {&__pyx_n_s_rbdict_iteritems, __pyx_k_rbdict_iteritems, sizeof(__pyx_k_rbdict_iteritems), 0, 0, 1, 1},
  {&__pyx_n_s_rbdict_iterkeys, __pyx_k_rbdict_iterkeys, sizeof(__pyx_k_rbdict_iterkeys), 0, 0, 1, 1},
  {&__pyx_n_s_rbdict_itervalues, __pyx_k_rbdict_itervalues, sizeof(__pyx_k_rbdict_itervalues), 0, 0, 1, 1},
  {&__pyx_n_s_rbset___iter, __pyx_k_rbset___iter, sizeof(__pyx_k_rbset___iter), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_setitem, __pyx_k_setitem, sizeof(__pyx_k_setitem), 0, 0, 1, 1},
  {&__pyx_n_s_sorted, __pyx_k_sorted, sizeof(__pyx_k_sorted), 0, 0, 1, 1},
  {&__pyx_n_s_sub, __pyx_k_sub, sizeof(__pyx_k_sub), 0, 0, 1, 1},
  {&__pyx_n_s_sub___locals_genexpr, __pyx_k_sub___locals_genexpr, sizeof(__pyx_k_sub___locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_kp_s_unsupported_operand_type_s_for, __pyx_k_unsupported_operand_type_s_for, sizeof(__pyx_k_unsupported_operand_type_s_for), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operand_type_s_for_2, __pyx_k_unsupported_operand_type_s_for_2, sizeof(__pyx_k_unsupported_operand_type_s_for_2), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operand_type_s_for_3, __pyx_k_unsupported_operand_type_s_for_3, sizeof(__pyx_k_unsupported_operand_type_s_for_3), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operand_type_s_for_4, __pyx_k_unsupported_operand_type_s_for_4, sizeof(__pyx_k_unsupported_operand_type_s_for_4), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operand_type_s_for_5, __pyx_k_unsupported_operand_type_s_for_5, sizeof(__pyx_k_unsupported_operand_type_s_for_5), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operand_type_s_for_6, __pyx_k_unsupported_operand_type_s_for_6, sizeof(__pyx_k_unsupported_operand_type_s_for_6), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operand_type_s_for_7, __pyx_k_unsupported_operand_type_s_for_7, sizeof(__pyx_k_unsupported_operand_type_s_for_7), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operand_type_s_for_8, __pyx_k_unsupported_operand_type_s_for_8, sizeof(__pyx_k_unsupported_operand_type_s_for_8), 0, 0, 1, 0},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_xor, __pyx_k_xor, sizeof(__pyx_k_xor), 0, 0, 1, 1},
  {&__pyx_n_s_xor___locals_genexpr, __pyx_k_xor___locals_genexpr, sizeof(__pyx_k_xor___locals_genexpr), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_n_s_sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __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 = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __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 = 241; __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 = 587; __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 = 600; __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);

  /* "pyredblack/redblack.pyx":143
 *             return obj
 *         else:
 *             raise KeyError('pop from an empty set')             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_pop_from_an_empty_set); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "pyredblack/redblack.pyx":241
 *         '''Return a new set with elements from the set and all others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for |')             # <<<<<<<<<<<<<<
 *         rv = rbset(self)
 *         rv.update(other)
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_unsupported_operand_type_s_for); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "pyredblack/redblack.pyx":259
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for &')             # <<<<<<<<<<<<<<
 *         (_d, smaller), (_d, bigger) = sorted([(len(self), self),
 *                                               (len(other), other)])
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_unsupported_operand_type_s_for_2); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "pyredblack/redblack.pyx":279
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for -')             # <<<<<<<<<<<<<<
 *         return rbset(elem for elem in self if elem not in other)
 * 
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_unsupported_operand_type_s_for_3); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "pyredblack/redblack.pyx":297
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for ^')             # <<<<<<<<<<<<<<
 *         rv = rbset(elem for elem in self if elem not in other)
 *         rv.update(elem for elem in other if elem not in self)
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_unsupported_operand_type_s_for_4); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "pyredblack/redblack.pyx":318
 *         '''Update the set, adding elements from all others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for |=')             # <<<<<<<<<<<<<<
 *         for elem in other:
 *             self.add(elem)
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_unsupported_operand_type_s_for_5); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "pyredblack/redblack.pyx":339
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for &=')             # <<<<<<<<<<<<<<
 *         # TODO: with access to the iterator, this could be done in one
 *         # traversal
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_unsupported_operand_type_s_for_6); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "pyredblack/redblack.pyx":359
 *         '''Update the set, removing elements found in others.'''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for -=')             # <<<<<<<<<<<<<<
 *         # TODO: with access to the iterator, this could be done in one
 *         # traversal
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_unsupported_operand_type_s_for_7); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "pyredblack/redblack.pyx":381
 *         '''
 *         if not isinstance(other, (set, frozenset, rbset)):
 *             raise TypeError('unsupported operand type(s) for ^=')             # <<<<<<<<<<<<<<
 *         # TODO: with access to the iterator, this could be done in one
 *         # traversal
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_unsupported_operand_type_s_for_8); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "pyredblack/redblack.pyx":566
 *             self._num_nodes -= 1
 *             return (key, value)
 *         raise KeyError('popitem(): dictionary is empty')             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_popitem_dictionary_is_empty); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "pyredblack/redblack.pyx":601
 *                         key, val = item
 *                     except ValueError:
 *                         raise ValueError('dictionary update sequence element '             # <<<<<<<<<<<<<<
 *                                          'must have length 2')
 *                     except TypeError:
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_dictionary_update_sequence_eleme); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "pyredblack/redblack.pyx":604
 *                                          'must have length 2')
 *                     except TypeError:
 *                         raise TypeError('cannot convert dictionary update '             # <<<<<<<<<<<<<<
 *                                         'sequence element to a sequence')
 *                     self[key] = val
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_cannot_convert_dictionary_update); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
  __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_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;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initredblack(void); /*proto*/
PyMODINIT_FUNC initredblack(void)
#else
PyMODINIT_FUNC PyInit_redblack(void); /*proto*/
PyMODINIT_FUNC PyInit_redblack(void)
#endif
{
  PyObject *__pyx_t_1 = 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_redblack(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("redblack", __pyx_methods, __pyx_k_redblack_pyx_c_Will_Roberts_25, 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_pyredblack__redblack) {
    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, "pyredblack.redblack")) {
      if (unlikely(PyDict_SetItemString(modules, "pyredblack.redblack", __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_10pyredblack_8redblack_rbset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_10pyredblack_8redblack_rbset.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbset, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_2__init__.doc = __pyx_doc_10pyredblack_8redblack_5rbset_2__init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_5rbset_2__init__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbset, "__len__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_6__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_6__len__.doc = __pyx_doc_10pyredblack_8redblack_5rbset_6__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_5rbset_6__len__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbset, "__contains__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_8__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_8__contains__.doc = __pyx_doc_10pyredblack_8redblack_5rbset_8__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_5rbset_8__contains__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbset, "__iter__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_10__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_10__iter__.doc = __pyx_doc_10pyredblack_8redblack_5rbset_10__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_5rbset_10__iter__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbset, "__or__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_33__or__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_33__or__.doc = __pyx_doc_10pyredblack_8redblack_5rbset_33__or__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_5rbset_33__or__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbset, "__and__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_37__and__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_37__and__.doc = __pyx_doc_10pyredblack_8redblack_5rbset_37__and__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_5rbset_37__and__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbset, "__sub__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_41__sub__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_41__sub__.doc = __pyx_doc_10pyredblack_8redblack_5rbset_41__sub__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_5rbset_41__sub__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbset, "__xor__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_45__xor__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_45__xor__.doc = __pyx_doc_10pyredblack_8redblack_5rbset_45__xor__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_5rbset_45__xor__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbset, "__ior__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_51__ior__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_51__ior__.doc = __pyx_doc_10pyredblack_8redblack_5rbset_51__ior__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_5rbset_51__ior__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbset, "__iand__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_55__iand__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_55__iand__.doc = __pyx_doc_10pyredblack_8redblack_5rbset_55__iand__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_5rbset_55__iand__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbset, "__isub__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_59__isub__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_59__isub__.doc = __pyx_doc_10pyredblack_8redblack_5rbset_59__isub__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_5rbset_59__isub__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbset, "__ixor__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_63__ixor__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_5rbset_63__ixor__.doc = __pyx_doc_10pyredblack_8redblack_5rbset_63__ixor__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_5rbset_63__ixor__;
    }
  }
  #endif
  if (PyObject_SetAttrString(__pyx_m, "rbset", (PyObject *)&__pyx_type_10pyredblack_8redblack_rbset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_10pyredblack_8redblack_rbset = &__pyx_type_10pyredblack_8redblack_rbset;
  if (PyType_Ready(&__pyx_type_10pyredblack_8redblack_rbdict) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_10pyredblack_8redblack_rbdict.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbdict, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_2__init__.doc = __pyx_doc_10pyredblack_8redblack_6rbdict_2__init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_6rbdict_2__init__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbdict, "__len__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_6__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_6__len__.doc = __pyx_doc_10pyredblack_8redblack_6rbdict_6__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_6rbdict_6__len__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbdict, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_10__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_10__getitem__.doc = __pyx_doc_10pyredblack_8redblack_6rbdict_10__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_6rbdict_10__getitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbdict, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_12__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_12__setitem__.doc = __pyx_doc_10pyredblack_8redblack_6rbdict_12__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_6rbdict_12__setitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbdict, "__delitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_14__delitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_14__delitem__.doc = __pyx_doc_10pyredblack_8redblack_6rbdict_14__delitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_6rbdict_14__delitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbdict, "__contains__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_16__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_16__contains__.doc = __pyx_doc_10pyredblack_8redblack_6rbdict_16__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_6rbdict_16__contains__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_10pyredblack_8redblack_rbdict, "__iter__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_18__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_10pyredblack_8redblack_6rbdict_18__iter__.doc = __pyx_doc_10pyredblack_8redblack_6rbdict_18__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10pyredblack_8redblack_6rbdict_18__iter__;
    }
  }
  #endif
  if (PyObject_SetAttrString(__pyx_m, "rbdict", (PyObject *)&__pyx_type_10pyredblack_8redblack_rbdict) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_10pyredblack_8redblack_rbdict = &__pyx_type_10pyredblack_8redblack_rbdict;
  if (PyType_Ready(&__pyx_type_10pyredblack_8redblack___pyx_scope_struct____iter__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_10pyredblack_8redblack___pyx_scope_struct____iter__.tp_print = 0;
  __pyx_ptype_10pyredblack_8redblack___pyx_scope_struct____iter__ = &__pyx_type_10pyredblack_8redblack___pyx_scope_struct____iter__;
  if (PyType_Ready(&__pyx_type_10pyredblack_8redblack___pyx_scope_struct_1___and__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_10pyredblack_8redblack___pyx_scope_struct_1___and__.tp_print = 0;
  __pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_1___and__ = &__pyx_type_10pyredblack_8redblack___pyx_scope_struct_1___and__;
  if (PyType_Ready(&__pyx_type_10pyredblack_8redblack___pyx_scope_struct_2_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_10pyredblack_8redblack___pyx_scope_struct_2_genexpr.tp_print = 0;
  __pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_2_genexpr = &__pyx_type_10pyredblack_8redblack___pyx_scope_struct_2_genexpr;
  if (PyType_Ready(&__pyx_type_10pyredblack_8redblack___pyx_scope_struct_3___sub__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_10pyredblack_8redblack___pyx_scope_struct_3___sub__.tp_print = 0;
  __pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_3___sub__ = &__pyx_type_10pyredblack_8redblack___pyx_scope_struct_3___sub__;
  if (PyType_Ready(&__pyx_type_10pyredblack_8redblack___pyx_scope_struct_4_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_10pyredblack_8redblack___pyx_scope_struct_4_genexpr.tp_print = 0;
  __pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_4_genexpr = &__pyx_type_10pyredblack_8redblack___pyx_scope_struct_4_genexpr;
  if (PyType_Ready(&__pyx_type_10pyredblack_8redblack___pyx_scope_struct_5___xor__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_10pyredblack_8redblack___pyx_scope_struct_5___xor__.tp_print = 0;
  __pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_5___xor__ = &__pyx_type_10pyredblack_8redblack___pyx_scope_struct_5___xor__;
  if (PyType_Ready(&__pyx_type_10pyredblack_8redblack___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_10pyredblack_8redblack___pyx_scope_struct_6_genexpr.tp_print = 0;
  __pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_6_genexpr = &__pyx_type_10pyredblack_8redblack___pyx_scope_struct_6_genexpr;
  if (PyType_Ready(&__pyx_type_10pyredblack_8redblack___pyx_scope_struct_7_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_10pyredblack_8redblack___pyx_scope_struct_7_genexpr.tp_print = 0;
  __pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_7_genexpr = &__pyx_type_10pyredblack_8redblack___pyx_scope_struct_7_genexpr;
  if (PyType_Ready(&__pyx_type_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys.tp_print = 0;
  __pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys = &__pyx_type_10pyredblack_8redblack___pyx_scope_struct_8_iterkeys;
  if (PyType_Ready(&__pyx_type_10pyredblack_8redblack___pyx_scope_struct_9_itervalues) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_10pyredblack_8redblack___pyx_scope_struct_9_itervalues.tp_print = 0;
  __pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_9_itervalues = &__pyx_type_10pyredblack_8redblack___pyx_scope_struct_9_itervalues;
  if (PyType_Ready(&__pyx_type_10pyredblack_8redblack___pyx_scope_struct_10_iteritems) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_10pyredblack_8redblack___pyx_scope_struct_10_iteritems.tp_print = 0;
  __pyx_ptype_10pyredblack_8redblack___pyx_scope_struct_10_iteritems = &__pyx_type_10pyredblack_8redblack___pyx_scope_struct_10_iteritems;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "pyredblack/redblack.pyx":1
 * # -*- coding: utf-8 -*-             # <<<<<<<<<<<<<<
 * 
 * '''
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init pyredblack.redblack", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init pyredblack.redblack");
  }
  __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 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 CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
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
    return 0;
}

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_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

#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

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) {
                if (PyObject_IsSubclass(instance_class, type)) {
                    type = instance_class;
                } else {
                    instance_class = NULL;
                }
            }
        }
        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 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 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 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 CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

#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 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 PyObject* __Pyx_PyDict_Items(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_PyObject_CallMethod1((PyObject*)&PyDict_Type, __pyx_n_s_items, d);
    else
        return PyDict_Items(d);
}

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 CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(int) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

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 long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(long long)) {
            return PyLong_FromLongLong((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 (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(long) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned 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(long long)) {
                __PYX_VERIFY_RETURN_INT(long, 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 (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(int) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned 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(long long)) {
                __PYX_VERIFY_RETURN_INT(int, 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 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 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 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;
    __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)) {
        if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) {
            if (!ev) {
                Py_INCREF(Py_None);
                ev = Py_None;
            }
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = ev;
            return 0;
        }
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_IsInstance(ev, PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#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 = PyObject_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_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) {
    __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;
        }
        return __Pyx_Generator_FinishDelegation(gen);
    }
    return __Pyx_Generator_SendEx(gen, value);
}
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_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 ret;
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __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_type);
    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 */
