/* Generated by Cython 0.13 on Tue Dec  7 09:54:00 2010 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#else

#include <stddef.h> /* For offsetof */
#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

#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
#endif

#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#endif

#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif

#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif

#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif

#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#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_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif

#ifndef PySet_CheckExact
#  define PySet_CheckExact(obj)          (Py_TYPE(obj) == &PySet_Type)
#endif

#if PY_MAJOR_VERSION >= 3
  #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
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject PyLongObject
#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

#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif

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

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE_API__treedict__treedict
#include "py_new_wrapper.h"

/* inline attribute */
#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

/* unused attribute */
#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)
#   define CYTHON_UNUSED __attribute__ ((__unused__)) 
# else
#   define CYTHON_UNUSED 
# endif
#endif

typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/


/* Type Conversion Predeclarations */

#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))

#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);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
#define likely(x)   __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
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[] = {
  "treedict.pyx",
  "name_matching.pxd",
};

typedef unsigned long __pyx_t_8treedict_8treedict_flagtype;

/* Type declarations */

/* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":34
 *     void free "PyMem_Free" (void *p)
 * 
 * cdef struct size_t_v:             # <<<<<<<<<<<<<<
 *     size_t *d
 *     size_t size
 */

struct __pyx_t_8treedict_10membuffers_size_t_v {
  size_t *d;
  size_t size;
};

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1230
 *     # Methods that freeze the state of the tree
 * 
 *     cpdef freeze(self, str branch=None, bint quiet = True):             # <<<<<<<<<<<<<<
 *         """
 *         Freezes the tree and all branches so no further manipulations
 */

struct __pyx_opt_args_8treedict_8treedict_8TreeDict_freeze {
  int __pyx_n;
  PyObject *branch;
  int quiet;
};

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2078
 *         return self.rootNode()._branchName(True, True)
 * 
 *     cpdef str branchName(self, bint add_path = False, bint add_tree_name = False):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the name of the branch.
 */

struct __pyx_opt_args_8treedict_8treedict_8TreeDict_branchName {
  int __pyx_n;
  int add_path;
  int add_tree_name;
};

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2276
 *             raise e
 * 
 *     cpdef get(self, str key, default_value = _NoDefault):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the value/branch associated with the key `key`.  If
 */

struct __pyx_opt_args_8treedict_8treedict_8TreeDict_get {
  int __pyx_n;
  PyObject *default_value;
};

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2741
 *     # Hashes that handle mutability, for things like database lookups, etc.
 * 
 *     cpdef hash(self, str key=None, bint add_name = False, keys=None):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a hash of the current tree / branch and all
 */

struct __pyx_opt_args_8treedict_8treedict_8TreeDict_hash {
  int __pyx_n;
  PyObject *key;
  int add_name;
  PyObject *keys;
};

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3503
 *         return newTreeDictIterator(self, recursive, branch_mode, valuetype)
 * 
 *     cpdef TreeDictIterator iteritems(self, bint recursive = True, branch_mode = 'none'):             # <<<<<<<<<<<<<<
 *         """
 *         Returns an iterator that returns (key, value) pairs.  If
 */

struct __pyx_opt_args_8treedict_8treedict_8TreeDict_iteritems {
  int __pyx_n;
  int recursive;
  PyObject *branch_mode;
};

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3545
 *         return self._getIter(recursive, self._getBranchMode(branch_mode), i_Items)
 * 
 *     cpdef TreeDictIterator itervalues(self, bint recursive = True, branch_mode = 'none'):             # <<<<<<<<<<<<<<
 *         """
 *         Returns an iterator that returns values in the tree.  If
 */

struct __pyx_opt_args_8treedict_8treedict_8TreeDict_itervalues {
  int __pyx_n;
  int recursive;
  PyObject *branch_mode;
};

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3589
 *         return self.iterkeys()
 * 
 *     cpdef TreeDictIterator iterkeys(self, bint recursive = True, branch_mode = 'none'):             # <<<<<<<<<<<<<<
 *         """
 *         Returns an iterator that returns keys for nodes in the tree.
 */

struct __pyx_opt_args_8treedict_8treedict_8TreeDict_iterkeys {
  int __pyx_n;
  int recursive;
  PyObject *branch_mode;
};

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":69
 * 
 * cdef class TreeDict(object)
 * cdef class TreeDictIterator(object)             # <<<<<<<<<<<<<<
 * cdef class _PTreeNode(object)
 * 
 */

struct __pyx_obj_8treedict_8treedict_TreeDictIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *__pyx_vtab;
  int _recursive;
  int _branch_mode;
  int _itertype;
  PyObject *_key_stack;
  Py_ssize_t *_pos_array;
  size_t _pos_array_size;
  struct __pyx_obj_8treedict_8treedict_TreeDict *_cur_pt;
  size_t _cur_depth;
  PyObject *_last_key;
  PyObject *_current_key;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *_last_pn;
  PyObject *_next_return_value;
  int _base_treedict_referenced;
  int _stop_on_next;
  int _first_iter_run_yet;
};

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":70
 * cdef class TreeDict(object)
 * cdef class TreeDictIterator(object)
 * cdef class _PTreeNode(object)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */

struct __pyx_obj_8treedict_8treedict__PTreeNode {
  PyObject_HEAD
  struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *__pyx_vtab;
  PyObject *_v;
  int _t;
  size_t _order_position;
  PyObject *_aux_dict;
};

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":68
 * cdef object new_weakref = weakref.ref
 * 
 * cdef class TreeDict(object)             # <<<<<<<<<<<<<<
 * cdef class TreeDictIterator(object)
 * cdef class _PTreeNode(object)
 */

struct __pyx_obj_8treedict_8treedict_TreeDict {
  PyObject_HEAD
  struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *__pyx_vtab;
  PyObject *_param_dict;
  PyObject *_branches;
  struct __pyx_obj_8treedict_8treedict_TreeDict *_parent;
  PyObject *_name;
  __pyx_t_8treedict_8treedict_flagtype _flags;
  size_t _n_mutable;
  size_t _next_item_order_position;
  size_t _n_dangling;
  PyObject *_aux_dict;
  PyObject *__weakref__;
};

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":167
 * # A unique value that never needs to be stored in a node.
 * 
 * cdef class _NoDefault(object): pass             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */

struct __pyx_obj_8treedict_8treedict__NoDefault {
  PyObject_HEAD
};


/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":533
 * cdef object _branch_mode_error_msg = "branch_mode must be one of 'all', 'only' or 'none'"
 * 
 * cdef class TreeDictIterator(object):             # <<<<<<<<<<<<<<
 *     cdef bint _recursive
 * 
 */

struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator {
  void (*_init)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, struct __pyx_obj_8treedict_8treedict_TreeDict *, int, int, int);
  void (*_ensurePosArraySized)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, size_t);
  PyObject *(*_next)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *);
  int (*_loadNext)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *);
  void (*goUpStack)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, PyObject *, struct __pyx_obj_8treedict_8treedict_TreeDict *);
  int (*goDownStack)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *);
  PyObject *(*currentKey)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *);
  void (*_setCurrentKey)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *);
  void (*_decRefToCurTree)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, size_t);
  void (*_incRefToCurTree)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, size_t);
  struct __pyx_obj_8treedict_8treedict__PTreeNode *(*currentPTreeNode)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *);
  PyObject *(*_currentRetValue)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *);
  PyObject *(*_fullKey)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, PyObject *);
};
static struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *__pyx_vtabptr_8treedict_8treedict_TreeDictIterator;


/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":764
 * # Now the actual parameter tree structure
 * 
 * cdef class TreeDict(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_8treedict_8treedict_TreeDict {
  PyObject *(*_run__cinit__)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  PyObject *(*_run__init__)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  PyObject *(*_setRegistered)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  PyObject *(*_setAll)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, PyObject *, __pyx_t_8treedict_8treedict_flagtype);
  PyObject *(*_set)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, PyObject *, __pyx_t_8treedict_8treedict_flagtype);
  PyObject *(*_ensureWriteable)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  PyObject *(*_setLocal)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, PyObject *, __pyx_t_8treedict_8treedict_flagtype);
  PyObject *(*_checkNodeAvailability)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  size_t (*_getNextOrderValue)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  PyObject *(*_reworkOrderValues)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  PyObject *(*freeze)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_freeze *__pyx_optional_args);
  PyObject *(*_freeze_tree)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  PyObject *(*_cut)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  PyObject *(*_raiseAttributeError)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  PyObject *(*_raiseErrorAtFirstNonDanglingBranch)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int);
  PyObject *(*_pop)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int, int);
  PyObject *(*_prune)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int);
  PyObject *(*_attach)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, struct __pyx_obj_8treedict_8treedict_TreeDict *, __pyx_t_8treedict_8treedict_flagtype);
  PyObject *(*_recursiveAttach)(struct __pyx_obj_8treedict_8treedict_TreeDict *, __pyx_t_8treedict_8treedict_flagtype);
  int (*_inPathToRoot)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDict *);
  void (*_resetParentNode)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDict *);
  PyObject *(*_shortKeyName)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  int (*isFrozen)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch);
  void (*_setFrozen)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int);
  int (*isDangling)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch);
  void (*_setDangling)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int);
  int (*_isDetachedDangling)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch);
  void (*_setDetachedDangling)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int);
  int (*isRegistered)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch);
  void (*_setRegisteredFlag)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int);
  int (*hasBeenCopied)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  void (*_setHasBeenCopiedFlag)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int);
  int (*isCopyReferenced)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  void (*_setCopyReferencedFlag)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int);
  int (*isIterReferenced)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  void (*iteratorIncRef)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  void (*iteratorDecRef)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  struct __pyx_obj_8treedict_8treedict_TreeDict *(*parentNode)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch);
  struct __pyx_obj_8treedict_8treedict_TreeDict *(*rootNode)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch);
  int (*isRoot)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch);
  int (*isEmpty)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch);
  int (*nodeInSameTree)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch);
  PyObject *(*interactiveTree)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch);
  PyObject *(*_fullNameOf)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_branchNameOf)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*treeName)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch);
  PyObject *(*branchName)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_branchName *__pyx_optional_args);
  PyObject *(*_branchName)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int, int);
  PyObject *(*_getSettingOrderPosition)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*get)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_get *__pyx_optional_args);
  int (*exists)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  struct __pyx_obj_8treedict_8treedict__PTreeNode *(*_getPTNode)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  struct __pyx_obj_8treedict_8treedict__PTreeNode *(*_getLocalPTNode)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  PyObject *(*_get)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int);
  PyObject *(*_getLocal)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int);
  int (*_exists)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int);
  int (*_existsLocal)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int);
  struct __pyx_obj_8treedict_8treedict_TreeDict *(*_getLocalBranch)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, __pyx_t_8treedict_8treedict_flagtype);
  struct __pyx_obj_8treedict_8treedict_TreeDict *(*_getBranch)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, __pyx_t_8treedict_8treedict_flagtype);
  struct __pyx_obj_8treedict_8treedict_TreeDict *(*_getBaseOf)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, __pyx_t_8treedict_8treedict_flagtype);
  struct __pyx_obj_8treedict_8treedict_TreeDict *(*_getBottomNode)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  struct __pyx_obj_8treedict_8treedict_TreeDict *(*_newLocalBranch)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, __pyx_t_8treedict_8treedict_flagtype);
  PyObject *(*_setLocalBranch)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDict *, __pyx_t_8treedict_8treedict_flagtype);
  PyObject *(*_attachDanglingSelf)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  int (*_isEqual)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDict *);
  PyObject *(*_firstMutableType)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  int (*isMutable)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch);
  PyObject *(*hash)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_hash *__pyx_optional_args);
  PyObject *(*_reportable_hash)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, PyObject *);
  PyObject *(*_encode_hash)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  PyObject *(*_item_set_hash)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  PyObject *(*_item_hash)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  PyObject *(*_self_hash)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  PyObject *(*_self_immutable_hash)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  PyObject *(*_runFullHash)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  PyObject *(*_runImmutableHash)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  PyObject *(*_getImmutableItemsHash)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  PyObject *(*_update_hash_with_key)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, PyObject *);
  PyObject *(*_update_hash_with_context)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  void (*_keyDeleted)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  PyObject *(*_keyInserted)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  void (*_resetImmutableHashes)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  PyObject *(*_update)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDict *, __pyx_t_8treedict_8treedict_flagtype);
  struct __pyx_obj_8treedict_8treedict_TreeDict *(*_copy)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int, int);
  PyObject *(*_clearHasBeenCopiedFlags)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  struct __pyx_obj_8treedict_8treedict_TreeDict *(*_recursiveCopy)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int);
  PyObject *(*_copyValue)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, struct __pyx_obj_8treedict_8treedict__PTreeNode *, int);
  PyObject *(*_reset_branches)(struct __pyx_obj_8treedict_8treedict_TreeDict *);
  size_t (*_local_size)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int);
  size_t (*_size)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int, int);
  PyObject *(*_getBranchMode)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *);
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *(*_getIter)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int, int, int);
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *(*iteritems)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_iteritems *__pyx_optional_args);
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *(*itervalues)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_itervalues *__pyx_optional_args);
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *(*iterkeys)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_iterkeys *__pyx_optional_args);
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *(*iterbranches)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch);
  PyObject *(*_getListFromIter)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDictIterator *);
  PyObject *(*_getListOfClosest)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, size_t, struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, struct __pyx_t_8treedict_10membuffers_size_t_v *);
  PyObject *(*_getSingleClosest)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, struct __pyx_t_8treedict_10membuffers_size_t_v *);
};
static struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *__pyx_vtabptr_8treedict_8treedict_TreeDict;


/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":368
 * cdef size_t _orderNodeMaxNum = <size_t>( (<double>2)**(8*sizeof(size_t) - 1)) - 2
 * 
 * cdef class _PTreeNode(object):             # <<<<<<<<<<<<<<
 *     cdef object    _v
 *     cdef int       _t
 */

struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode {
  PyObject *(*_set_it)(struct __pyx_obj_8treedict_8treedict__PTreeNode *, struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, PyObject *, size_t);
  PyObject *(*value)(struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  PyObject *(*orderPosition)(struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  PyObject *(*setOrderPostion)(struct __pyx_obj_8treedict_8treedict__PTreeNode *, size_t);
  int (*type)(struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  int (*isMutable)(struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  int (*isImmutable)(struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  int (*isBranch)(struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  int (*isNonBranchTree)(struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  int (*isDanglingBranch)(struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  int (*isTree)(struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  int (*isDanglingTree)(struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  struct __pyx_obj_8treedict_8treedict_TreeDict *(*tree)(struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  int (*isChildOf)(struct __pyx_obj_8treedict_8treedict__PTreeNode *, struct __pyx_obj_8treedict_8treedict_TreeDict *);
  PyObject *(*fullHash)(struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  PyObject *(*runFullHash)(struct __pyx_obj_8treedict_8treedict__PTreeNode *, PyObject *);
  PyObject *(*runImmutableHash)(struct __pyx_obj_8treedict_8treedict__PTreeNode *, PyObject *);
  PyObject *(*_immutableHash)(struct __pyx_obj_8treedict_8treedict__PTreeNode *);
  int (*isEqual)(struct __pyx_obj_8treedict_8treedict__PTreeNode *, struct __pyx_obj_8treedict_8treedict__PTreeNode *);
};
static struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *__pyx_vtabptr_8treedict_8treedict__PTreeNode;

#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) {
    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;
  }
  #define __Pyx_RefNannySetupContext(name)           void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  #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_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
#else
  #define __Pyx_RefNannySetupContext(name)
  #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_XDECREF(r) Py_XDECREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);


#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    if (unlikely(d == Py_None)) {
        __Pyx_RaiseNoneIndexingError();
        return NULL;
    }
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred())
            PyErr_SetObject(PyExc_KeyError, key);
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/

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

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/

static CYTHON_INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; }
static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
    return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/

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

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

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

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
    const char* function_name, int kw_allowed); /*proto*/

static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) {
    PyObject *r, *m;
#if PY_VERSION_HEX >= 0x02040000
    if (likely(PyList_CheckExact(L))
            /* Check that both the size is positive and no reallocation shrinking needs to be done. */
            && likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
        Py_SIZE(L) -= 1;
        return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
    }
#endif
    m = __Pyx_GetAttrString(L, "pop");
    if (!m) return NULL;
    r = PyObject_CallObject(m, NULL);
    Py_DECREF(m);
    return r;
}


static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}


#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
            PyObject *r = PyList_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}


#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
    PyObject *r;
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
        r = PySequence_GetItem(o, i);
    }
    else {
        r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
    }
    return r;
}

static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */

#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_SetItemInt_Fast(o, i, v) : \
                                                    __Pyx_SetItemInt_Generic(o, to_py_func(i), v))

static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}

static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) {
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        Py_INCREF(v);
        Py_DECREF(PyList_GET_ITEM(o, i));
        PyList_SET_ITEM(o, i, v);
        return 1;
    }
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0)))
        return PySequence_SetItem(o, i, v);
    else {
        PyObject *j = PyInt_FromSsize_t(i);
        return __Pyx_SetItemInt_Generic(o, j, v);
    }
}

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

#define __Pyx_DelItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_DelItemInt_Fast(o, i) : \
                                                    __Pyx_DelItem_Generic(o, to_py_func(i)))

static CYTHON_INLINE int __Pyx_DelItem_Generic(PyObject *o, PyObject *j) {
    int r;
    if (!j) return -1;
    r = PyObject_DelItem(o, j);
    Py_DECREF(j);
    return r;
}

static CYTHON_INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i) {
    if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && likely(i >= 0))
        return PySequence_DelItem(o, i);
    else {
        PyObject *j = PyInt_FromSsize_t(i);
        return __Pyx_DelItem_Generic(o, j);
    }
}

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

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, const char *modname); /*proto*/

#if PY_VERSION_HEX < 0x02050000
#ifndef PyAnySet_CheckExact

#define PyAnySet_CheckExact(ob) \
    ((ob)->ob_type == &PySet_Type || \
     (ob)->ob_type == &PyFrozenSet_Type)

#define PySet_New(iterable) \
    PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL)

#define Pyx_PyFrozenSet_New(iterable) \
    PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL)

#define PySet_Size(anyset) \
    PyObject_Size((anyset))

#define PySet_Contains(anyset, key) \
    PySequence_Contains((anyset), (key))

#define PySet_Pop(set) \
    PyObject_CallMethod(set, (char *)"pop", NULL)

static CYTHON_INLINE int PySet_Clear(PyObject *set) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}

static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}

static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}

#endif /* PyAnySet_CheckExact (<= Py2.4) */

#if PY_VERSION_HEX < 0x02040000
#ifndef Py_SETOBJECT_H
#define Py_SETOBJECT_H

static PyTypeObject *__Pyx_PySet_Type = NULL;
static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL;

#define PySet_Type (*__Pyx_PySet_Type)
#define PyFrozenSet_Type (*__Pyx_PyFrozenSet_Type)

#define PyAnySet_Check(ob) \
    (PyAnySet_CheckExact(ob) || \
     PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \
     PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type))

#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type)

static int __Pyx_Py23SetsImport(void) {
    PyObject *sets=0, *Set=0, *ImmutableSet=0;

    sets = PyImport_ImportModule((char *)"sets");
    if (!sets) goto bad;
    Set = PyObject_GetAttrString(sets, (char *)"Set");
    if (!Set) goto bad;
    ImmutableSet = PyObject_GetAttrString(sets, (char *)"ImmutableSet");
    if (!ImmutableSet) goto bad;
    Py_DECREF(sets);

    __Pyx_PySet_Type       = (PyTypeObject*) Set;
    __Pyx_PyFrozenSet_Type = (PyTypeObject*) ImmutableSet;

    return 0;

 bad:
    Py_XDECREF(sets);
    Py_XDECREF(Set);
    Py_XDECREF(ImmutableSet);
    return -1;
}

#else
static int __Pyx_Py23SetsImport(void) { return 0; }
#endif /* !Py_SETOBJECT_H */
#endif /* < Py2.4  */
#endif /* < Py2.5  */

#include "descrobject.h"
static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /*proto*/

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

static CYTHON_INLINE size_t __Pyx_pow_size_t(size_t, size_t); /* proto */

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static void __Pyx_WriteUnraisable(const char *name); /*proto*/

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

static void __Pyx_AddTraceback(const char *funcname); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Module declarations from treedict.minsmaxes */

static CYTHON_INLINE size_t __pyx_f_8treedict_9minsmaxes_min3(size_t, size_t, size_t); /*proto*/
static CYTHON_INLINE size_t __pyx_f_8treedict_9minsmaxes_min2(size_t, size_t); /*proto*/
static CYTHON_INLINE size_t __pyx_f_8treedict_9minsmaxes_max2(size_t, size_t); /*proto*/
static CYTHON_INLINE int __pyx_f_8treedict_9minsmaxes_min2_int(int, int); /*proto*/
static CYTHON_INLINE int __pyx_f_8treedict_9minsmaxes_max2_int(int, int); /*proto*/
static CYTHON_INLINE long __pyx_f_8treedict_9minsmaxes_min2_long(long, long); /*proto*/
static CYTHON_INLINE long __pyx_f_8treedict_9minsmaxes_max2_long(long, long); /*proto*/
/* Module declarations from treedict.membuffers */

static CYTHON_INLINE struct __pyx_t_8treedict_10membuffers_size_t_v __pyx_f_8treedict_10membuffers_new_size_t_v(size_t); /*proto*/
static CYTHON_INLINE void __pyx_f_8treedict_10membuffers_resize_size_t_v(struct __pyx_t_8treedict_10membuffers_size_t_v *, size_t); /*proto*/
static CYTHON_INLINE void __pyx_f_8treedict_10membuffers_free_size_t_v(struct __pyx_t_8treedict_10membuffers_size_t_v *); /*proto*/
/* Module declarations from treedict.name_matching */

static CYTHON_INLINE long __pyx_f_8treedict_13name_matching__combine_scores(long, long, long, long, long, long); /*proto*/
static CYTHON_INLINE long __pyx_f_8treedict_13name_matching_name_match_distance(struct __pyx_t_8treedict_10membuffers_size_t_v *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE long __pyx_f_8treedict_13name_matching_editDistance(struct __pyx_t_8treedict_10membuffers_size_t_v *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE long __pyx_f_8treedict_13name_matching__editDistanceDirect(struct __pyx_t_8treedict_10membuffers_size_t_v *, char *, long, char *, long); /*proto*/
/* Module declarations from treedict.treedict */

static PyTypeObject *__pyx_ptype_8treedict_8treedict_TreeDict = 0;
static PyTypeObject *__pyx_ptype_8treedict_8treedict_TreeDictIterator = 0;
static PyTypeObject *__pyx_ptype_8treedict_8treedict__PTreeNode = 0;
static PyTypeObject *__pyx_ptype_8treedict_8treedict__NoDefault = 0;
static PyObject *__pyx_v_8treedict_8treedict_md5 = 0;
static PyObject *__pyx_v_8treedict_8treedict_dumps = 0;
static PyObject *__pyx_v_8treedict_8treedict_PicklingError = 0;
static PyObject *__pyx_v_8treedict_8treedict_copy_f = 0;
static PyObject *__pyx_v_8treedict_8treedict_deepcopy_f = 0;
static PyObject *__pyx_v_8treedict_8treedict_b64encode = 0;
static PyObject *__pyx_v_8treedict_8treedict_heappop = 0;
static PyObject *__pyx_v_8treedict_8treedict_heappush = 0;
static PyObject *__pyx_v_8treedict_8treedict_heapreplace = 0;
static PyObject *__pyx_v_8treedict_8treedict_strfind = 0;
static PyObject *__pyx_v_8treedict_8treedict_strrfind = 0;
static PyObject *__pyx_v_8treedict_8treedict_strlower = 0;
static PyObject *__pyx_v_8treedict_8treedict_strsplit = 0;
static PyObject *__pyx_v_8treedict_8treedict_new_weakref = 0;
static PyObject *__pyx_v_8treedict_8treedict_s_IterReferenceCount = 0;
static PyObject *__pyx_v_8treedict_8treedict_s_registration_tree_name = 0;
static PyObject *__pyx_v_8treedict_8treedict_s_registration_branch_name = 0;
static PyObject *__pyx_v_8treedict_8treedict_s_dangling_node_dependents = 0;
static PyObject *__pyx_v_8treedict_8treedict_s_cached_hash = 0;
static PyObject *__pyx_v_8treedict_8treedict_s_auth_key = 0;
static PyObject *__pyx_v_8treedict_8treedict_s_hit_flag = 0;
static PyObject *__pyx_v_8treedict_8treedict_s_immutable_items_hash = 0;
static PyObject *__pyx_v_8treedict_8treedict_s_protect_structure = 0;
static PyObject *__pyx_v_8treedict_8treedict_s_copied_node = 0;
static PyObject *__pyx_v_8treedict_8treedict_s_copy_referencing_keys = 0;
static PyObject *__pyx_v_8treedict_8treedict_s_dangling_reference_queue = 0;
static PyObject *__pyx_v_8treedict_8treedict__string_name_validator = 0;
static PyObject *__pyx_v_8treedict_8treedict__string_name_validator_match = 0;
static PyObject *__pyx_v_8treedict_8treedict__tree_lookup_dict = 0;
static PyObject *__pyx_v_8treedict_8treedict__fast_type_determination = 0;
static size_t __pyx_v_8treedict_8treedict__orderNodeMaxNum;
static PyObject *__pyx_v_8treedict_8treedict__branch_mode_lookup = 0;
static PyObject *__pyx_v_8treedict_8treedict__branch_mode_error_msg = 0;
static CYTHON_INLINE struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_f_8treedict_8treedict_newTreeDict(PyObject *, int); /*proto*/
static CYTHON_INLINE struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_f_8treedict_8treedict_newTreeDictIterator(struct __pyx_obj_8treedict_8treedict_TreeDict *, int, int, int); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8treedict_8treedict_checkKeyNotNone(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8treedict_8treedict_checkNameValidity(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_8treedict_8treedict_isValidName(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8treedict_8treedict_catNames(PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8treedict_8treedict_registerTree(struct __pyx_obj_8treedict_8treedict_TreeDict *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8treedict_8treedict_registerTreeByName(PyObject *, struct __pyx_obj_8treedict_8treedict_TreeDict *); /*proto*/
static struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_f_8treedict_8treedict_getTree(PyObject *, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_8treedict_8treedict_treeExists(PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_8treedict_8treedict__runValueHash(PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE void __pyx_f_8treedict_8treedict__setFlagOn(__pyx_t_8treedict_8treedict_flagtype *, __pyx_t_8treedict_8treedict_flagtype); /*proto*/
static CYTHON_INLINE void __pyx_f_8treedict_8treedict__setFlagOff(__pyx_t_8treedict_8treedict_flagtype *, __pyx_t_8treedict_8treedict_flagtype); /*proto*/
static CYTHON_INLINE void __pyx_f_8treedict_8treedict__setFlag(__pyx_t_8treedict_8treedict_flagtype *, __pyx_t_8treedict_8treedict_flagtype, int); /*proto*/
static CYTHON_INLINE int __pyx_f_8treedict_8treedict__flagOn(__pyx_t_8treedict_8treedict_flagtype *, __pyx_t_8treedict_8treedict_flagtype); /*proto*/
static CYTHON_INLINE int __pyx_f_8treedict_8treedict_itemType(PyObject *); /*proto*/
static CYTHON_INLINE struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_f_8treedict_8treedict_newPTreeNode(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, PyObject *, size_t); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8treedict_8treedict_newPTreeNodeExact(PyObject *, int, size_t); /*proto*/
#define __Pyx_MODULE_NAME "treedict.treedict"
int __pyx_module_is_main_treedict__treedict = 0;

/* Implementation of treedict.treedict */
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_NameError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_sorted;
static PyObject *__pyx_builtin_getattr;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_eval;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_OverflowError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_max;
static PyObject *__pyx_builtin_reversed;
static PyObject *__pyx_builtin_range;
static char __pyx_k_1[] = "Expected string or unicode for name, got NoneType.";
static char __pyx_k_2[] = "'%s' not a valid branch name.";
static char __pyx_k_3[] = ".";
static char __pyx_k_4[] = "$$$DICT";
static char __pyx_k_5[] = ":";
static char __pyx_k_6[] = "$$$SET";
static char __pyx_k_7[] = "$$$LIST";
static char __pyx_k_8[] = "$$$TUPLE";
static char __pyx_k_9[] = "_PTreeNode_unpickler";
static char __pyx_k_10[] = "_ensurePosArraySized";
static char __pyx_k_11[] = "_base_treedict_referenced";
static char __pyx_k_12[] = "_next_item_order_position";
static char __pyx_k_14[] = "Even number of non-keyword arguments expected.";
static char __pyx_k_15[] = "Name argument (%d, '%s') not string.";
static char __pyx_k_16[] = "Name argument (%d) empty string.";
static char __pyx_k_17[] = "Name argument '%s' not string.";
static char __pyx_k_18[] = "%s frozen; cannot modify '%s'";
static char __pyx_k_19[] = "%s frozen; cannot modify.";
static char __pyx_k_20[] = "%s cannot be changed while being iterated over.";
static char __pyx_k_21[] = "_checkNodeAvailability";
static char __pyx_k_22[] = "Branch/Tree '%s' would be overwritten by value.";
static char __pyx_k_23[] = "Value '%s' would be overwritten by Branch/Tree.";
static char __pyx_k_24[] = "Maximum number of branches/leaves (%d) exceeded.";
static char __pyx_k_25[] = "Cannot freeze non-branch value at key '%s'";
static char __pyx_k_26[] = "_setDetachedDangling";
static char __pyx_k_27[] = "_raiseErrorAtFirstNonDanglingBranch";
static char __pyx_k_28[] = "branch/value/method '%s' does not exist in tree/branch '%s'.";
static char __pyx_k_29[] = "_raiseAttributeError";
static char __pyx_k_30[] = "Cannot detach root node.";
static char __pyx_k_31[] = "Either `recursive` must be True or a tree or key must be given.";
static char __pyx_k_32[] = "Only one TreeDict instance can be given to attach.";
static char __pyx_k_33[] = "`tree_or_key` must be either a string or TreeDict instance.";
static char __pyx_k_34[] = "TreeDict instance expected, got NoneType.";
static char __pyx_k_35[] = "Name of tree to be attached in ('%s') not valid branch name, so alternate name must be given.";
static char __pyx_k_36[] = "Attaching to a child or parent node forbidden.";
static char __pyx_k_37[] = "Attaching a tree with same root requires copy.";
static char __pyx_k_38[] = "Tree to be attached (%s) must be copied or be a root tree.";
static char __pyx_k_39[] = "Dangling TreeDict <%s>";
static char __pyx_k_40[] = "TreeDict <%s>";
static char __pyx_k_41[] = "";
static char __pyx_k_42[] = "%s";
static char __pyx_k_43[] = "_getSettingOrderPosition";
static char __pyx_k_44[] = "\n";
static char __pyx_k_45[] = " ";
static char __pyx_k_46[] = " = ";
static char __pyx_k_47[] = "Programming Error: Multiple (recursive?) __getattr__ with '%s'";
static char __pyx_k_48[] = "'%s' (Indexing keys must be strings, not %s)";
static char __pyx_k_50[] = "Node \"%s\" is not a branch as required.";
static char __pyx_k_51[] = "'%s' already exists as non-branch key; cannot create new branch.";
static char __pyx_k_52[] = "'%s' already exists; cannot create new branch.";
static char __pyx_k_53[] = "_getImmutableItemsHash";
static char __pyx_k_54[] = "Only frozen trees are python hashable.";
static char __pyx_k_55[] = "Node '%s' (and possibly more) not hashable.";
static char __pyx_k_56[] = "_self_immutable_hash";
static char __pyx_k_57[] = "'add_name=True' not available for set of keys.";
static char __pyx_k_58[] = "-";
static char __pyx_k_59[] = "=";
static char __pyx_k_60[] = "+";
static char __pyx_k_61[] = "/";
static char __pyx_k_62[] = "Infinite recusion encountered in hashing.";
static char __pyx_k_63[] = "Dangling nodes not hashable.";
static char __pyx_k_64[] = "_update_hash_with_key";
static char __pyx_k_65[] = "_update_hash_with_context";
static char __pyx_k_66[] = "$S$";
static char __pyx_k_67[] = "$E$";
static char __pyx_k_68[] = "$BRANCH$";
static char __pyx_k_69[] = "_resetImmutableHashes";
static char __pyx_k_71[] = "Value '%s' would get implicitly overwritten by branch on merge; ";
static char __pyx_k_72[] = "set protect_structure=False to allow overwriting.";
static char __pyx_k_73[] = "Tree/Branch '%s' would get implicitly overwritten by value on merge; ";
static char __pyx_k_74[] = "_clearHasBeenCopiedFlags";
static char __pyx_k_75[] = "_setHasBeenCopiedFlag";
static char __pyx_k_76[] = "_setCopyReferencedFlag";
static char __pyx_k_77[] = "_original_param_tree";
static char __pyx_k_78[] = "Out-of-memory error allocating buffer array.";
static char __pyx_k_79[] = "IteratorReferenceCount";
static char __pyx_k_80[] = "_registration_tree_name";
static char __pyx_k_81[] = "_registration_branch_name";
static char __pyx_k_82[] = "_dangling_node_dependents";
static char __pyx_k_83[] = "_immutable_items_hash";
static char __pyx_k_84[] = "copy_referencing_keys";
static char __pyx_k_85[] = "dangling_reference_queue";
static char __pyx_k_86[] = "\\A[a-zA-Z_]\\w*\\Z";
static char __pyx_k_87[] = "branch_mode must be one of 'all', 'only' or 'none'";
static char __pyx_k_88[] = "\n    An interactive version of the TreeDict for use in an interpreted\n    shell.  While the branch, node, and leaf values in a TreeDict\n    instance are stored in an internal dictionary, they are the\n    attributes in an InteractiveTreeDict.  This allows one to use tab\n    completion in Ipython to interact with the tree more easily.\n\n    The :meth:`treeDict()` method returns the original TreeDict\n    instance.\n\n    Example::\n\n            In [1]: from treedict import TreeDict\n\n            In [2]: t = TreeDict(a=1,b=2,c=3,d=4)\n\n            In [3]: t.\n            t.__class__                 t.__setattr__               t.isDangling\n            t.__contains__              t.__setitem__               t.isEmpty\n            t.__copy__                  t.__sizeof__                t.isFrozen\n            t.__deepcopy__              t.__str__                   t.isMutable\n            t.__delattr__               t.__subclasshook__          t.isRegistered\n            t.__delitem__               t._branchNameOf             t.isRoot\n            t.__doc__                   t._fullNameOf               t.items\n            t.__eq__                    t._getSettingOrderPosition  t.iterbranches\n            t.__format__                t._isDetachedDangling       t.iteritems\n            t.__ge__                    t._iteratorRefCount         t.iterkeys\n            t.__getattr__               t._numDangling              t.itervalues\n            t.__getattribute__          t._numMutable               t.keys\n            t.__getitem__               t.attach                    t.makeBranch\n            t.__gt__                    t.branchName                t.makeReport\n            t.__hash__                  t.branches                  t.nodeInSameTree\n            t.__init__                  t.clear                     t.parentNode\n            t.__iter__                  t.copy                      t.pop\n            t.__le__                    t.checkset       ""           t.popitem\n            t.__len__                   t.freeze                    t.rootNode\n            t.__lt__                    t.fromdict                  t.set\n            t.__ne__                    t.fromkeys                  t.setFromString\n            t.__new__                   t.get                       t.setdefault\n            t.__pyx_vtable__            t.getClosestKey             t.size\n            t.__reduce__                t.has_key                   t.treeName\n            t.__reduce_ex__             t.hash                      t.update\n            t.__repr__                  t.interactiveTree           t.values\n\n            In [3]: ti = t.interactiveTree()\n\n            In [4]: ti.\n            ti.__class__             ti.__module__            ti.__weakref__\n            ti.__delattr__           ti.__new__               ti._original_param_tree\n            ti.__dict__              ti.__reduce__            ti._setAttrDirect\n            ti.__doc__               ti.__reduce_ex__         ti.a\n            ti.__eq__                ti.__repr__              ti.b\n            ti.__format__            ti.__setattr__           ti.c\n            ti.__getattribute__      ti.__sizeof__            ti.d\n            ti.__hash__              ti.__str__               ti.treeDict\n            ti.__init__              ti.__subclasshook__      \n\n            In [4]: ti.a\n            Out[4]: 1\n\n            In [5]: ti.treeDict() is t\n            Out[5]: True\n\n    ";
static char __pyx_k_89[] = "getTree (line 181)";
static char __pyx_k_90[] = "treeExists (line 211)";
static char __pyx_k_91[] = "TreeDict.setFromString (line 831)";
static char __pyx_k_92[] = "TreeDict.fromkeys (line 884)";
static char __pyx_k_93[] = "TreeDict.fromdict (line 917)";
static char __pyx_k_94[] = "TreeDict.setdefault (line 948)";
static char __pyx_k_95[] = "TreeDict.set (line 981)";
static char __pyx_k_96[] = "TreeDict.checkset (line 1047)";
static char __pyx_k_97[] = "TreeDict.freeze (line 1230)";
static char __pyx_k_98[] = "TreeDict.clear (line 1311)";
static char __pyx_k_99[] = "TreeDict.pop (line 1404)";
static char __pyx_k__d[] = "d";
static char __pyx_k__m[] = "m";
static char __pyx_k__n[] = "n";
static char __pyx_k__t[] = "t";
static char __pyx_k__v[] = "v";
static char __pyx_k_100[] = "TreeDict.popitem (line 1468)";
static char __pyx_k_101[] = "TreeDict.attach (line 1565)";
static char __pyx_k_102[] = "TreeDict.isFrozen (line 1785)";
static char __pyx_k_103[] = "TreeDict.isDangling (line 1798)";
static char __pyx_k_104[] = "TreeDict.isRegistered (line 1825)";
static char __pyx_k_105[] = "TreeDict.parentNode (line 1918)";
static char __pyx_k_106[] = "TreeDict.rootNode (line 1924)";
static char __pyx_k_107[] = "TreeDict.isRoot (line 1934)";
static char __pyx_k_108[] = "TreeDict.isEmpty (line 1941)";
static char __pyx_k_109[] = "TreeDict.nodeInSameTree (line 1957)";
static char __pyx_k_110[] = "TreeDict.interactiveTree (line 1968)";
static char __pyx_k_111[] = "TreeDict._fullNameOf (line 2043)";
static char __pyx_k_112[] = "TreeDict._branchNameOf (line 2051)";
static char __pyx_k_113[] = "TreeDict.treeName (line 2058)";
static char __pyx_k_114[] = "TreeDict.branchName (line 2078)";
static char __pyx_k_115[] = "TreeDict.makeReport (line 2128)";
static char __pyx_k_116[] = "TreeDict.get (line 2276)";
static char __pyx_k_117[] = "TreeDict.has_key (line 2316)";
static char __pyx_k_118[] = "TreeDict.makeBranch (line 2471)";
static char __pyx_k_119[] = "TreeDict.isMutable (line 2711)";
static char __pyx_k_120[] = "TreeDict.hash (line 2741)";
static char __pyx_k_121[] = "TreeDict.copy (line 3059)";
static char __pyx_k_122[] = "TreeDict.update (line 3072)";
static char __pyx_k_123[] = "TreeDict.size (line 3417)";
static char __pyx_k_124[] = "TreeDict.iteritems (line 3503)";
static char __pyx_k_125[] = "TreeDict.itervalues (line 3545)";
static char __pyx_k_126[] = "TreeDict.iterkeys (line 3589)";
static char __pyx_k_127[] = "TreeDict.iterbranches (line 3631)";
static char __pyx_k_128[] = "TreeDict.items (line 3686)";
static char __pyx_k_129[] = "TreeDict.values (line 3694)";
static char __pyx_k_130[] = "TreeDict.keys (line 3702)";
static char __pyx_k_131[] = "TreeDict.branches (line 3710)";
static char __pyx_k_132[] = "TreeDict.getClosestKey (line 3735)";
static char __pyx_k___t[] = "_t";
static char __pyx_k___v[] = "_v";
static char __pyx_k__re[] = "re";
static char __pyx_k__s1[] = "s1";
static char __pyx_k__s2[] = "s2";
static char __pyx_k__all[] = "all";
static char __pyx_k__get[] = "get";
static char __pyx_k__key[] = "key";
static char __pyx_k__max[] = "max";
static char __pyx_k__md5[] = "md5";
static char __pyx_k__pop[] = "pop";
static char __pyx_k__ref[] = "ref";
static char __pyx_k__set[] = "set";
static char __pyx_k___cut[] = "_cut";
static char __pyx_k___get[] = "_get";
static char __pyx_k___pop[] = "_pop";
static char __pyx_k___set[] = "_set";
static char __pyx_k__copy[] = "copy";
static char __pyx_k__deep[] = "deep";
static char __pyx_k__eval[] = "eval";
static char __pyx_k__find[] = "find";
static char __pyx_k__hash[] = "hash";
static char __pyx_k__ipt1[] = "ipt1";
static char __pyx_k__ipt2[] = "ipt2";
static char __pyx_k__join[] = "join";
static char __pyx_k__keys[] = "keys";
static char __pyx_k__name[] = "name";
static char __pyx_k__none[] = "none";
static char __pyx_k__only[] = "only";
static char __pyx_k__root[] = "root";
static char __pyx_k__self[] = "self";
static char __pyx_k__size[] = "size";
static char __pyx_k__tree[] = "tree";
static char __pyx_k__type[] = "type";
static char __pyx_k__warn[] = "warn";
static char __pyx_k___copy[] = "_copy";
static char __pyx_k___init[] = "_init";
static char __pyx_k___name[] = "_name";
static char __pyx_k___next[] = "_next";
static char __pyx_k___size[] = "_size";
static char __pyx_k__clear[] = "clear";
static char __pyx_k__dumps[] = "dumps";
static char __pyx_k__heapq[] = "heapq";
static char __pyx_k__items[] = "items";
static char __pyx_k__lower[] = "lower";
static char __pyx_k__match[] = "match";
static char __pyx_k__ptree[] = "ptree";
static char __pyx_k__quiet[] = "quiet";
static char __pyx_k__range[] = "range";
static char __pyx_k__rfind[] = "rfind";
static char __pyx_k__split[] = "split";
static char __pyx_k__strip[] = "strip";
static char __pyx_k__value[] = "value";
static char __pyx_k____eq__[] = "__eq__";
static char __pyx_k___flags[] = "_flags";
static char __pyx_k___prune[] = "_prune";
static char __pyx_k__attach[] = "attach";
static char __pyx_k__base64[] = "base64";
static char __pyx_k__branch[] = "branch";
static char __pyx_k__digest[] = "digest";
static char __pyx_k__exists[] = "exists";
static char __pyx_k__freeze[] = "freeze";
static char __pyx_k__isRoot[] = "isRoot";
static char __pyx_k__isTree[] = "isTree";
static char __pyx_k__object[] = "object";
static char __pyx_k__silent[] = "silent";
static char __pyx_k__sorted[] = "sorted";
static char __pyx_k__source[] = "source";
static char __pyx_k__update[] = "update";
static char __pyx_k__values[] = "values";
static char __pyx_k___attach[] = "_attach";
static char __pyx_k___cur_pt[] = "_cur_pt";
static char __pyx_k___exists[] = "_exists";
static char __pyx_k___parent[] = "_parent";
static char __pyx_k___setAll[] = "_setAll";
static char __pyx_k___set_it[] = "_set_it";
static char __pyx_k___update[] = "_update";
static char __pyx_k__cPickle[] = "cPickle";
static char __pyx_k__compile[] = "compile";
static char __pyx_k__getTree[] = "getTree";
static char __pyx_k__getattr[] = "getattr";
static char __pyx_k__has_key[] = "has_key";
static char __pyx_k__hashlib[] = "hashlib";
static char __pyx_k__heappop[] = "heappop";
static char __pyx_k__inspect[] = "inspect";
static char __pyx_k__isEmpty[] = "isEmpty";
static char __pyx_k__isEqual[] = "isEqual";
static char __pyx_k__popitem[] = "popitem";
static char __pyx_k__replace[] = "replace";
static char __pyx_k__weakref[] = "weakref";
static char __pyx_k__KeyError[] = "KeyError";
static char __pyx_k__TreeDict[] = "TreeDict";
static char __pyx_k____init__[] = "__init__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k___fullKey[] = "_fullKey";
static char __pyx_k___getIter[] = "_getIter";
static char __pyx_k___isEqual[] = "_isEqual";
static char __pyx_k___last_pn[] = "_last_pn";
static char __pyx_k__add_name[] = "add_name";
static char __pyx_k__add_path[] = "add_path";
static char __pyx_k__aux_dict[] = "aux_dict";
static char __pyx_k__branches[] = "branches";
static char __pyx_k__checkset[] = "checkset";
static char __pyx_k__deepcopy[] = "deepcopy";
static char __pyx_k__fromdict[] = "fromdict";
static char __pyx_k__fromkeys[] = "fromkeys";
static char __pyx_k__fullHash[] = "fullHash";
static char __pyx_k__heappush[] = "heappush";
static char __pyx_k__isBranch[] = "isBranch";
static char __pyx_k__isFrozen[] = "isFrozen";
static char __pyx_k__iterkeys[] = "iterkeys";
static char __pyx_k__only_new[] = "only_new";
static char __pyx_k__protocol[] = "protocol";
static char __pyx_k__reversed[] = "reversed";
static char __pyx_k__rootNode[] = "rootNode";
static char __pyx_k__treeDict[] = "treeDict";
static char __pyx_k__treeName[] = "treeName";
static char __pyx_k__warnings[] = "warnings";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k__HashError[] = "HashError";
static char __pyx_k__NameError[] = "NameError";
static char __pyx_k__TypeError[] = "TypeError";
static char __pyx_k___auth_key[] = "_auth_key";
static char __pyx_k___aux_dict[] = "_aux_dict";
static char __pyx_k___branches[] = "_branches";
static char __pyx_k___getLocal[] = "_getLocal";
static char __pyx_k___hit_flag[] = "_hit_flag";
static char __pyx_k___itertype[] = "_itertype";
static char __pyx_k___last_key[] = "_last_key";
static char __pyx_k___loadNext[] = "_loadNext";
static char __pyx_k___setLocal[] = "_setLocal";
static char __pyx_k__b64encode[] = "b64encode";
static char __pyx_k__enumerate[] = "enumerate";
static char __pyx_k__goUpStack[] = "goUpStack";
static char __pyx_k__hexdigest[] = "hexdigest";
static char __pyx_k__isMutable[] = "isMutable";
static char __pyx_k__iteritems[] = "iteritems";
static char __pyx_k__order_pos[] = "order_pos";
static char __pyx_k__overwrite[] = "overwrite";
static char __pyx_k__recursive[] = "recursive";
static char __pyx_k__tree_name[] = "tree_name";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k____reduce__[] = "__reduce__";
static char __pyx_k___copyValue[] = "_copyValue";
static char __pyx_k___cur_depth[] = "_cur_depth";
static char __pyx_k___getBaseOf[] = "_getBaseOf";
static char __pyx_k___getBranch[] = "_getBranch";
static char __pyx_k___getPTNode[] = "_getPTNode";
static char __pyx_k___item_hash[] = "_item_hash";
static char __pyx_k___key_stack[] = "_key_stack";
static char __pyx_k___n_mutable[] = "_n_mutable";
static char __pyx_k___pos_array[] = "_pos_array";
static char __pyx_k___recursive[] = "_recursive";
static char __pyx_k___self_hash[] = "_self_hash";
static char __pyx_k___setFrozen[] = "_setFrozen";
static char __pyx_k__branchName[] = "branchName";
static char __pyx_k__currentKey[] = "currentKey";
static char __pyx_k__isDangling[] = "isDangling";
static char __pyx_k__itervalues[] = "itervalues";
static char __pyx_k__makeBranch[] = "makeBranch";
static char __pyx_k__makeReport[] = "makeReport";
static char __pyx_k__param_dict[] = "param_dict";
static char __pyx_k__parentNode[] = "parentNode";
static char __pyx_k__setdefault[] = "setdefault";
static char __pyx_k__treeExists[] = "treeExists";
static char __pyx_k__MemoryError[] = "MemoryError";
static char __pyx_k____setattr__[] = "__setattr__";
static char __pyx_k___branchName[] = "_branchName";
static char __pyx_k___fullNameOf[] = "_fullNameOf";
static char __pyx_k___keyDeleted[] = "_keyDeleted";
static char __pyx_k___local_size[] = "_local_size";
static char __pyx_k___n_dangling[] = "_n_dangling";
static char __pyx_k___param_dict[] = "_param_dict";
static char __pyx_k__branch_mode[] = "branch_mode";
static char __pyx_k__copied_node[] = "copied_node";
static char __pyx_k__copy_module[] = "copy_module";
static char __pyx_k__goDownStack[] = "goDownStack";
static char __pyx_k__heapreplace[] = "heapreplace";
static char __pyx_k__isImmutable[] = "isImmutable";
static char __pyx_k__prune_empty[] = "prune_empty";
static char __pyx_k__runFullHash[] = "runFullHash";
static char __pyx_k__tree_or_key[] = "tree_or_key";
static char __pyx_k__RuntimeError[] = "RuntimeError";
static char __pyx_k___branch_mode[] = "_branch_mode";
static char __pyx_k___cached_hash[] = "_cached_hash";
static char __pyx_k___current_key[] = "_current_key";
static char __pyx_k___encode_hash[] = "_encode_hash";
static char __pyx_k___existsLocal[] = "_existsLocal";
static char __pyx_k___freeze_tree[] = "_freeze_tree";
static char __pyx_k___keyInserted[] = "_keyInserted";
static char __pyx_k___runFullHash[] = "_runFullHash";
static char __pyx_k___run__init__[] = "_run__init__";
static char __pyx_k___setDangling[] = "_setDangling";
static char __pyx_k__isRegistered[] = "isRegistered";
static char __pyx_k__iterbranches[] = "iterbranches";
static char __pyx_k__key_iterable[] = "key_iterable";
static char __pyx_k__OverflowError[] = "OverflowError";
static char __pyx_k__PicklingError[] = "PicklingError";
static char __pyx_k__StopIteration[] = "StopIteration";
static char __pyx_k___branchNameOf[] = "_branchNameOf";
static char __pyx_k___inPathToRoot[] = "_inPathToRoot";
static char __pyx_k___run__cinit__[] = "_run__cinit__";
static char __pyx_k___shortKeyName[] = "_shortKeyName";
static char __pyx_k___stop_on_next[] = "_stop_on_next";
static char __pyx_k__add_tree_name[] = "add_tree_name";
static char __pyx_k__default_value[] = "default_value";
static char __pyx_k__getClosestKey[] = "getClosestKey";
static char __pyx_k__hasBeenCopied[] = "hasBeenCopied";
static char __pyx_k__orderPosition[] = "orderPosition";
static char __pyx_k__setFromString[] = "setFromString";
static char __pyx_k__AttributeError[] = "AttributeError";
static char __pyx_k___getBottomNode[] = "_getBottomNode";
static char __pyx_k___getBranchMode[] = "_getBranchMode";
static char __pyx_k___immutableHash[] = "_immutableHash";
static char __pyx_k___item_set_hash[] = "_item_set_hash";
static char __pyx_k___recursiveCopy[] = "_recursiveCopy";
static char __pyx_k___setAttrDirect[] = "_setAttrDirect";
static char __pyx_k___setCurrentKey[] = "_setCurrentKey";
static char __pyx_k___setRegistered[] = "_setRegistered";
static char __pyx_k__isDanglingTree[] = "isDanglingTree";
static char __pyx_k__iteratorDecRef[] = "iteratorDecRef";
static char __pyx_k__iteratorIncRef[] = "iteratorIncRef";
static char __pyx_k__nodeInSameTree[] = "nodeInSameTree";
static char __pyx_k___getLocalBranch[] = "_getLocalBranch";
static char __pyx_k___getLocalPTNode[] = "_getLocalPTNode";
static char __pyx_k___newLocalBranch[] = "_newLocalBranch";
static char __pyx_k___order_position[] = "_order_position";
static char __pyx_k___pos_array_size[] = "_pos_array_size";
static char __pyx_k___reset_branches[] = "_reset_branches";
static char __pyx_k___setLocalBranch[] = "_setLocalBranch";
static char __pyx_k__extra_variables[] = "extra_variables";
static char __pyx_k__interactiveTree[] = "interactiveTree";
static char __pyx_k__isNonBranchTree[] = "isNonBranchTree";
static char __pyx_k__setOrderPostion[] = "setOrderPostion";
static char __pyx_k___currentRetValue[] = "_currentRetValue";
static char __pyx_k___decRefToCurTree[] = "_decRefToCurTree";
static char __pyx_k___ensureWriteable[] = "_ensureWriteable";
static char __pyx_k___getListFromIter[] = "_getListFromIter";
static char __pyx_k___incRefToCurTree[] = "_incRefToCurTree";
static char __pyx_k___recursiveAttach[] = "_recursiveAttach";
static char __pyx_k___reportable_hash[] = "_reportable_hash";
static char __pyx_k___resetParentNode[] = "_resetParentNode";
static char __pyx_k__currentPTreeNode[] = "currentPTreeNode";
static char __pyx_k__isCopyReferenced[] = "isCopyReferenced";
static char __pyx_k__isDanglingBranch[] = "isDanglingBranch";
static char __pyx_k__isIterReferenced[] = "isIterReferenced";
static char __pyx_k__runImmutableHash[] = "runImmutableHash";
static char __pyx_k___firstMutableType[] = "_firstMutableType";
static char __pyx_k___getListOfClosest[] = "_getListOfClosest";
static char __pyx_k___getSingleClosest[] = "_getSingleClosest";
static char __pyx_k___runImmutableHash[] = "_runImmutableHash";
static char __pyx_k__protect_structure[] = "protect_structure";
static char __pyx_k___getNextOrderValue[] = "_getNextOrderValue";
static char __pyx_k___next_return_value[] = "_next_return_value";
static char __pyx_k___reworkOrderValues[] = "_reworkOrderValues";
static char __pyx_k___setRegisteredFlag[] = "_setRegisteredFlag";
static char __pyx_k__InteractiveTreeDict[] = "InteractiveTreeDict";
static char __pyx_k___TreeDict_unpickler[] = "_TreeDict_unpickler";
static char __pyx_k___attachDanglingSelf[] = "_attachDanglingSelf";
static char __pyx_k___first_iter_run_yet[] = "_first_iter_run_yet";
static char __pyx_k___isDetachedDangling[] = "_isDetachedDangling";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_n_s_10;
static PyObject *__pyx_kp_u_100;
static PyObject *__pyx_kp_u_101;
static PyObject *__pyx_kp_u_102;
static PyObject *__pyx_kp_u_103;
static PyObject *__pyx_kp_u_104;
static PyObject *__pyx_kp_u_105;
static PyObject *__pyx_kp_u_106;
static PyObject *__pyx_kp_u_107;
static PyObject *__pyx_kp_u_108;
static PyObject *__pyx_kp_u_109;
static PyObject *__pyx_n_s_11;
static PyObject *__pyx_kp_u_110;
static PyObject *__pyx_kp_u_111;
static PyObject *__pyx_kp_u_112;
static PyObject *__pyx_kp_u_113;
static PyObject *__pyx_kp_u_114;
static PyObject *__pyx_kp_u_115;
static PyObject *__pyx_kp_u_116;
static PyObject *__pyx_kp_u_117;
static PyObject *__pyx_kp_u_118;
static PyObject *__pyx_kp_u_119;
static PyObject *__pyx_n_s_12;
static PyObject *__pyx_kp_u_120;
static PyObject *__pyx_kp_u_121;
static PyObject *__pyx_kp_u_122;
static PyObject *__pyx_kp_u_123;
static PyObject *__pyx_kp_u_124;
static PyObject *__pyx_kp_u_125;
static PyObject *__pyx_kp_u_126;
static PyObject *__pyx_kp_u_127;
static PyObject *__pyx_kp_u_128;
static PyObject *__pyx_kp_u_129;
static PyObject *__pyx_kp_u_130;
static PyObject *__pyx_kp_u_131;
static PyObject *__pyx_kp_u_132;
static PyObject *__pyx_kp_s_14;
static PyObject *__pyx_kp_s_15;
static PyObject *__pyx_kp_s_16;
static PyObject *__pyx_kp_s_17;
static PyObject *__pyx_kp_s_18;
static PyObject *__pyx_kp_s_19;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_s_20;
static PyObject *__pyx_n_s_21;
static PyObject *__pyx_kp_s_22;
static PyObject *__pyx_kp_s_23;
static PyObject *__pyx_kp_s_24;
static PyObject *__pyx_kp_s_25;
static PyObject *__pyx_n_s_26;
static PyObject *__pyx_n_s_27;
static PyObject *__pyx_kp_s_28;
static PyObject *__pyx_n_s_29;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_30;
static PyObject *__pyx_kp_s_31;
static PyObject *__pyx_kp_s_32;
static PyObject *__pyx_kp_s_33;
static PyObject *__pyx_kp_s_34;
static PyObject *__pyx_kp_s_35;
static PyObject *__pyx_kp_s_36;
static PyObject *__pyx_kp_s_37;
static PyObject *__pyx_kp_s_38;
static PyObject *__pyx_kp_s_39;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_kp_s_40;
static PyObject *__pyx_kp_s_41;
static PyObject *__pyx_kp_s_42;
static PyObject *__pyx_n_s_43;
static PyObject *__pyx_kp_s_44;
static PyObject *__pyx_kp_s_45;
static PyObject *__pyx_kp_s_46;
static PyObject *__pyx_kp_s_47;
static PyObject *__pyx_kp_s_48;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_kp_s_50;
static PyObject *__pyx_kp_s_51;
static PyObject *__pyx_kp_s_52;
static PyObject *__pyx_n_s_53;
static PyObject *__pyx_kp_s_54;
static PyObject *__pyx_kp_s_55;
static PyObject *__pyx_n_s_56;
static PyObject *__pyx_kp_s_57;
static PyObject *__pyx_kp_s_58;
static PyObject *__pyx_kp_s_59;
static PyObject *__pyx_kp_s_6;
static PyObject *__pyx_kp_s_60;
static PyObject *__pyx_kp_s_61;
static PyObject *__pyx_kp_s_62;
static PyObject *__pyx_kp_s_63;
static PyObject *__pyx_n_s_64;
static PyObject *__pyx_n_s_65;
static PyObject *__pyx_kp_s_66;
static PyObject *__pyx_kp_s_67;
static PyObject *__pyx_kp_s_68;
static PyObject *__pyx_n_s_69;
static PyObject *__pyx_kp_s_7;
static PyObject *__pyx_kp_s_71;
static PyObject *__pyx_kp_s_72;
static PyObject *__pyx_kp_s_73;
static PyObject *__pyx_n_s_74;
static PyObject *__pyx_n_s_75;
static PyObject *__pyx_n_s_76;
static PyObject *__pyx_n_s_77;
static PyObject *__pyx_kp_s_78;
static PyObject *__pyx_n_s_79;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_n_s_80;
static PyObject *__pyx_n_s_81;
static PyObject *__pyx_n_s_82;
static PyObject *__pyx_n_s_83;
static PyObject *__pyx_n_s_84;
static PyObject *__pyx_n_s_85;
static PyObject *__pyx_kp_s_86;
static PyObject *__pyx_kp_s_87;
static PyObject *__pyx_kp_s_88;
static PyObject *__pyx_kp_u_89;
static PyObject *__pyx_n_s_9;
static PyObject *__pyx_kp_u_90;
static PyObject *__pyx_kp_u_91;
static PyObject *__pyx_kp_u_92;
static PyObject *__pyx_kp_u_93;
static PyObject *__pyx_kp_u_94;
static PyObject *__pyx_kp_u_95;
static PyObject *__pyx_kp_u_96;
static PyObject *__pyx_kp_u_97;
static PyObject *__pyx_kp_u_98;
static PyObject *__pyx_kp_u_99;
static PyObject *__pyx_n_s__AttributeError;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__HashError;
static PyObject *__pyx_n_s__InteractiveTreeDict;
static PyObject *__pyx_n_s__KeyError;
static PyObject *__pyx_n_s__MemoryError;
static PyObject *__pyx_n_s__NameError;
static PyObject *__pyx_n_s__OverflowError;
static PyObject *__pyx_n_s__PicklingError;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s__StopIteration;
static PyObject *__pyx_n_s__TreeDict;
static PyObject *__pyx_n_s__TypeError;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s___TreeDict_unpickler;
static PyObject *__pyx_n_s____eq__;
static PyObject *__pyx_n_s____init__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____reduce__;
static PyObject *__pyx_n_s____setattr__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s___attach;
static PyObject *__pyx_n_s___attachDanglingSelf;
static PyObject *__pyx_n_s___auth_key;
static PyObject *__pyx_n_s___aux_dict;
static PyObject *__pyx_n_s___branchName;
static PyObject *__pyx_n_s___branchNameOf;
static PyObject *__pyx_n_s___branch_mode;
static PyObject *__pyx_n_s___branches;
static PyObject *__pyx_n_s___cached_hash;
static PyObject *__pyx_n_s___copy;
static PyObject *__pyx_n_s___copyValue;
static PyObject *__pyx_n_s___cur_depth;
static PyObject *__pyx_n_s___cur_pt;
static PyObject *__pyx_n_s___currentRetValue;
static PyObject *__pyx_n_s___current_key;
static PyObject *__pyx_n_s___cut;
static PyObject *__pyx_n_s___decRefToCurTree;
static PyObject *__pyx_n_s___encode_hash;
static PyObject *__pyx_n_s___ensureWriteable;
static PyObject *__pyx_n_s___exists;
static PyObject *__pyx_n_s___existsLocal;
static PyObject *__pyx_n_s___firstMutableType;
static PyObject *__pyx_n_s___first_iter_run_yet;
static PyObject *__pyx_n_s___flags;
static PyObject *__pyx_n_s___freeze_tree;
static PyObject *__pyx_n_s___fullKey;
static PyObject *__pyx_n_s___fullNameOf;
static PyObject *__pyx_n_s___get;
static PyObject *__pyx_n_s___getBaseOf;
static PyObject *__pyx_n_s___getBottomNode;
static PyObject *__pyx_n_s___getBranch;
static PyObject *__pyx_n_s___getBranchMode;
static PyObject *__pyx_n_s___getIter;
static PyObject *__pyx_n_s___getListFromIter;
static PyObject *__pyx_n_s___getListOfClosest;
static PyObject *__pyx_n_s___getLocal;
static PyObject *__pyx_n_s___getLocalBranch;
static PyObject *__pyx_n_s___getLocalPTNode;
static PyObject *__pyx_n_s___getNextOrderValue;
static PyObject *__pyx_n_s___getPTNode;
static PyObject *__pyx_n_s___getSingleClosest;
static PyObject *__pyx_n_s___hit_flag;
static PyObject *__pyx_n_s___immutableHash;
static PyObject *__pyx_n_s___inPathToRoot;
static PyObject *__pyx_n_s___incRefToCurTree;
static PyObject *__pyx_n_s___init;
static PyObject *__pyx_n_s___isDetachedDangling;
static PyObject *__pyx_n_s___isEqual;
static PyObject *__pyx_n_s___item_hash;
static PyObject *__pyx_n_s___item_set_hash;
static PyObject *__pyx_n_s___itertype;
static PyObject *__pyx_n_s___keyDeleted;
static PyObject *__pyx_n_s___keyInserted;
static PyObject *__pyx_n_s___key_stack;
static PyObject *__pyx_n_s___last_key;
static PyObject *__pyx_n_s___last_pn;
static PyObject *__pyx_n_s___loadNext;
static PyObject *__pyx_n_s___local_size;
static PyObject *__pyx_n_s___n_dangling;
static PyObject *__pyx_n_s___n_mutable;
static PyObject *__pyx_n_s___name;
static PyObject *__pyx_n_s___newLocalBranch;
static PyObject *__pyx_n_s___next;
static PyObject *__pyx_n_s___next_return_value;
static PyObject *__pyx_n_s___order_position;
static PyObject *__pyx_n_s___param_dict;
static PyObject *__pyx_n_s___parent;
static PyObject *__pyx_n_s___pop;
static PyObject *__pyx_n_s___pos_array;
static PyObject *__pyx_n_s___pos_array_size;
static PyObject *__pyx_n_s___prune;
static PyObject *__pyx_n_s___recursive;
static PyObject *__pyx_n_s___recursiveAttach;
static PyObject *__pyx_n_s___recursiveCopy;
static PyObject *__pyx_n_s___reportable_hash;
static PyObject *__pyx_n_s___resetParentNode;
static PyObject *__pyx_n_s___reset_branches;
static PyObject *__pyx_n_s___reworkOrderValues;
static PyObject *__pyx_n_s___runFullHash;
static PyObject *__pyx_n_s___runImmutableHash;
static PyObject *__pyx_n_s___run__cinit__;
static PyObject *__pyx_n_s___run__init__;
static PyObject *__pyx_n_s___self_hash;
static PyObject *__pyx_n_s___set;
static PyObject *__pyx_n_s___setAll;
static PyObject *__pyx_n_s___setAttrDirect;
static PyObject *__pyx_n_s___setCurrentKey;
static PyObject *__pyx_n_s___setDangling;
static PyObject *__pyx_n_s___setFrozen;
static PyObject *__pyx_n_s___setLocal;
static PyObject *__pyx_n_s___setLocalBranch;
static PyObject *__pyx_n_s___setRegistered;
static PyObject *__pyx_n_s___setRegisteredFlag;
static PyObject *__pyx_n_s___set_it;
static PyObject *__pyx_n_s___shortKeyName;
static PyObject *__pyx_n_s___size;
static PyObject *__pyx_n_s___stop_on_next;
static PyObject *__pyx_n_s___t;
static PyObject *__pyx_n_s___update;
static PyObject *__pyx_n_s___v;
static PyObject *__pyx_n_s__add_name;
static PyObject *__pyx_n_s__add_path;
static PyObject *__pyx_n_s__add_tree_name;
static PyObject *__pyx_n_s__all;
static PyObject *__pyx_n_s__attach;
static PyObject *__pyx_n_s__aux_dict;
static PyObject *__pyx_n_s__b64encode;
static PyObject *__pyx_n_s__base64;
static PyObject *__pyx_n_s__branch;
static PyObject *__pyx_n_s__branchName;
static PyObject *__pyx_n_s__branch_mode;
static PyObject *__pyx_n_s__branches;
static PyObject *__pyx_n_s__cPickle;
static PyObject *__pyx_n_s__checkset;
static PyObject *__pyx_n_s__clear;
static PyObject *__pyx_n_s__compile;
static PyObject *__pyx_n_s__copied_node;
static PyObject *__pyx_n_s__copy;
static PyObject *__pyx_n_s__copy_module;
static PyObject *__pyx_n_s__currentKey;
static PyObject *__pyx_n_s__currentPTreeNode;
static PyObject *__pyx_n_s__d;
static PyObject *__pyx_n_s__deep;
static PyObject *__pyx_n_s__deepcopy;
static PyObject *__pyx_n_s__default_value;
static PyObject *__pyx_n_s__digest;
static PyObject *__pyx_n_s__dumps;
static PyObject *__pyx_n_s__enumerate;
static PyObject *__pyx_n_s__eval;
static PyObject *__pyx_n_s__exists;
static PyObject *__pyx_n_s__extra_variables;
static PyObject *__pyx_n_s__find;
static PyObject *__pyx_n_s__freeze;
static PyObject *__pyx_n_s__fromdict;
static PyObject *__pyx_n_s__fromkeys;
static PyObject *__pyx_n_s__fullHash;
static PyObject *__pyx_n_s__get;
static PyObject *__pyx_n_s__getClosestKey;
static PyObject *__pyx_n_s__getTree;
static PyObject *__pyx_n_s__getattr;
static PyObject *__pyx_n_s__goDownStack;
static PyObject *__pyx_n_s__goUpStack;
static PyObject *__pyx_n_s__hasBeenCopied;
static PyObject *__pyx_n_s__has_key;
static PyObject *__pyx_n_s__hash;
static PyObject *__pyx_n_s__hashlib;
static PyObject *__pyx_n_s__heappop;
static PyObject *__pyx_n_s__heappush;
static PyObject *__pyx_n_s__heapq;
static PyObject *__pyx_n_s__heapreplace;
static PyObject *__pyx_n_s__hexdigest;
static PyObject *__pyx_n_s__inspect;
static PyObject *__pyx_n_s__interactiveTree;
static PyObject *__pyx_n_s__ipt1;
static PyObject *__pyx_n_s__ipt2;
static PyObject *__pyx_n_s__isBranch;
static PyObject *__pyx_n_s__isCopyReferenced;
static PyObject *__pyx_n_s__isDangling;
static PyObject *__pyx_n_s__isDanglingBranch;
static PyObject *__pyx_n_s__isDanglingTree;
static PyObject *__pyx_n_s__isEmpty;
static PyObject *__pyx_n_s__isEqual;
static PyObject *__pyx_n_s__isFrozen;
static PyObject *__pyx_n_s__isImmutable;
static PyObject *__pyx_n_s__isIterReferenced;
static PyObject *__pyx_n_s__isMutable;
static PyObject *__pyx_n_s__isNonBranchTree;
static PyObject *__pyx_n_s__isRegistered;
static PyObject *__pyx_n_s__isRoot;
static PyObject *__pyx_n_s__isTree;
static PyObject *__pyx_n_s__items;
static PyObject *__pyx_n_s__iteratorDecRef;
static PyObject *__pyx_n_s__iteratorIncRef;
static PyObject *__pyx_n_s__iterbranches;
static PyObject *__pyx_n_s__iteritems;
static PyObject *__pyx_n_s__iterkeys;
static PyObject *__pyx_n_s__itervalues;
static PyObject *__pyx_n_s__join;
static PyObject *__pyx_n_s__key;
static PyObject *__pyx_n_s__key_iterable;
static PyObject *__pyx_n_s__keys;
static PyObject *__pyx_n_s__lower;
static PyObject *__pyx_n_s__m;
static PyObject *__pyx_n_s__makeBranch;
static PyObject *__pyx_n_s__makeReport;
static PyObject *__pyx_n_s__match;
static PyObject *__pyx_n_s__max;
static PyObject *__pyx_n_s__md5;
static PyObject *__pyx_n_s__n;
static PyObject *__pyx_n_s__name;
static PyObject *__pyx_n_s__nodeInSameTree;
static PyObject *__pyx_n_s__none;
static PyObject *__pyx_n_s__object;
static PyObject *__pyx_n_s__only;
static PyObject *__pyx_n_s__only_new;
static PyObject *__pyx_n_s__orderPosition;
static PyObject *__pyx_n_s__order_pos;
static PyObject *__pyx_n_s__overwrite;
static PyObject *__pyx_n_s__param_dict;
static PyObject *__pyx_n_s__parentNode;
static PyObject *__pyx_n_s__pop;
static PyObject *__pyx_n_s__popitem;
static PyObject *__pyx_n_s__protect_structure;
static PyObject *__pyx_n_s__protocol;
static PyObject *__pyx_n_s__prune_empty;
static PyObject *__pyx_n_s__ptree;
static PyObject *__pyx_n_s__quiet;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__re;
static PyObject *__pyx_n_s__recursive;
static PyObject *__pyx_n_s__ref;
static PyObject *__pyx_n_s__replace;
static PyObject *__pyx_n_s__reversed;
static PyObject *__pyx_n_s__rfind;
static PyObject *__pyx_n_s__root;
static PyObject *__pyx_n_s__rootNode;
static PyObject *__pyx_n_s__runFullHash;
static PyObject *__pyx_n_s__runImmutableHash;
static PyObject *__pyx_n_s__s1;
static PyObject *__pyx_n_s__s2;
static PyObject *__pyx_n_s__self;
static PyObject *__pyx_n_s__set;
static PyObject *__pyx_n_s__setFromString;
static PyObject *__pyx_n_s__setOrderPostion;
static PyObject *__pyx_n_s__setdefault;
static PyObject *__pyx_n_s__silent;
static PyObject *__pyx_n_s__size;
static PyObject *__pyx_n_s__sorted;
static PyObject *__pyx_n_s__source;
static PyObject *__pyx_n_s__split;
static PyObject *__pyx_n_s__strip;
static PyObject *__pyx_n_s__t;
static PyObject *__pyx_n_s__tree;
static PyObject *__pyx_n_s__treeDict;
static PyObject *__pyx_n_s__treeExists;
static PyObject *__pyx_n_s__treeName;
static PyObject *__pyx_n_s__tree_name;
static PyObject *__pyx_n_s__tree_or_key;
static PyObject *__pyx_n_s__type;
static PyObject *__pyx_n_s__update;
static PyObject *__pyx_n_s__v;
static PyObject *__pyx_n_s__value;
static PyObject *__pyx_n_s__values;
static PyObject *__pyx_n_s__warn;
static PyObject *__pyx_n_s__warnings;
static PyObject *__pyx_n_s__weakref;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_k_13;
static PyObject *__pyx_k_49;
static PyObject *__pyx_k_70;

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":111
 *     cdef TreeDict createBlankTreeDict "PY_NEW" (object t)
 * 
 * cdef inline TreeDict newTreeDict(str name, bint registered):             # <<<<<<<<<<<<<<
 *     cdef TreeDict p = createBlankTreeDict(TreeDict)
 *     p._run__cinit__()
 */

static CYTHON_INLINE struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_f_8treedict_8treedict_newTreeDict(PyObject *__pyx_v_name, int __pyx_v_registered) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p = 0;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("newTreeDict");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":112
 * 
 * cdef inline TreeDict newTreeDict(str name, bint registered):
 *     cdef TreeDict p = createBlankTreeDict(TreeDict)             # <<<<<<<<<<<<<<
 *     p._run__cinit__()
 *     p._run__init__(name)
 */
  __pyx_t_1 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict_TreeDict)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":113
 * cdef inline TreeDict newTreeDict(str name, bint registered):
 *     cdef TreeDict p = createBlankTreeDict(TreeDict)
 *     p._run__cinit__()             # <<<<<<<<<<<<<<
 *     p._run__init__(name)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_run__cinit__(__pyx_v_p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":114
 *     cdef TreeDict p = createBlankTreeDict(TreeDict)
 *     p._run__cinit__()
 *     p._run__init__(name)             # <<<<<<<<<<<<<<
 * 
 *     if registered:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_run__init__(__pyx_v_p, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":116
 *     p._run__init__(name)
 * 
 *     if registered:             # <<<<<<<<<<<<<<
 *         p._setRegistered()
 * 
 */
  if (__pyx_v_registered) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":117
 * 
 *     if registered:
 *         p._setRegistered()             # <<<<<<<<<<<<<<
 * 
 *     return p
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_setRegistered(__pyx_v_p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":119
 *         p._setRegistered()
 * 
 *     return p             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "py_new_wrapper.h":
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_p));
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.newTreeDict");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_p);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":124
 *     cdef TreeDictIterator createBlankTreeDictIterator "PY_NEW" (object t)
 * 
 * cdef inline TreeDictIterator newTreeDictIterator(             # <<<<<<<<<<<<<<
 *     TreeDict p, bint _recursive, int _branch_mode, int _itertype):
 * 
 */

static CYTHON_INLINE struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_f_8treedict_8treedict_newTreeDictIterator(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p, int __pyx_v__recursive, int __pyx_v__branch_mode, int __pyx_v__itertype) {
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_pti = 0;
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("newTreeDictIterator");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":127
 *     TreeDict p, bint _recursive, int _branch_mode, int _itertype):
 * 
 *     cdef TreeDictIterator pti = createBlankTreeDictIterator(TreeDictIterator)             # <<<<<<<<<<<<<<
 *     pti._init(p, _recursive, _branch_mode, _itertype)
 *     return pti
 */
  __pyx_t_1 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict_TreeDictIterator)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pti = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":128
 * 
 *     cdef TreeDictIterator pti = createBlankTreeDictIterator(TreeDictIterator)
 *     pti._init(p, _recursive, _branch_mode, _itertype)             # <<<<<<<<<<<<<<
 *     return pti
 * 
 */
  ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_pti->__pyx_vtab)->_init(__pyx_v_pti, __pyx_v_p, __pyx_v__recursive, __pyx_v__branch_mode, __pyx_v__itertype);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":129
 *     cdef TreeDictIterator pti = createBlankTreeDictIterator(TreeDictIterator)
 *     pti._init(p, _recursive, _branch_mode, _itertype)
 *     return pti             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_pti));
  __pyx_r = __pyx_v_pti;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.newTreeDictIterator");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pti);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":138
 * cdef object _string_name_validator_match = _string_name_validator.match
 * 
 * cdef inline checkKeyNotNone(str n):             # <<<<<<<<<<<<<<
 *     if n is None:
 *         raise TypeError("Expected string or unicode for name, got NoneType.")
 */

static CYTHON_INLINE PyObject *__pyx_f_8treedict_8treedict_checkKeyNotNone(PyObject *__pyx_v_n) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("checkKeyNotNone");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":139
 * 
 * cdef inline checkKeyNotNone(str n):
 *     if n is None:             # <<<<<<<<<<<<<<
 *         raise TypeError("Expected string or unicode for name, got NoneType.")
 * 
 */
  __pyx_t_1 = (__pyx_v_n == ((PyObject *)Py_None));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":140
 * cdef inline checkKeyNotNone(str n):
 *     if n is None:
 *         raise TypeError("Expected string or unicode for name, got NoneType.")             # <<<<<<<<<<<<<<
 * 
 * cdef inline checkNameValidity(str n):
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
    __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __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);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.checkKeyNotNone");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":142
 *         raise TypeError("Expected string or unicode for name, got NoneType.")
 * 
 * cdef inline checkNameValidity(str n):             # <<<<<<<<<<<<<<
 *     checkKeyNotNone(n)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_8treedict_8treedict_checkNameValidity(PyObject *__pyx_v_n) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("checkNameValidity");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":143
 * 
 * cdef inline checkNameValidity(str n):
 *     checkKeyNotNone(n)             # <<<<<<<<<<<<<<
 * 
 *     if not isValidName(n):
 */
  __pyx_t_1 = __pyx_f_8treedict_8treedict_checkKeyNotNone(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":145
 *     checkKeyNotNone(n)
 * 
 *     if not isValidName(n):             # <<<<<<<<<<<<<<
 *         raise NameError("'%s' not a valid branch name." % n)
 * 
 */
  __pyx_t_2 = (!__pyx_f_8treedict_8treedict_isValidName(__pyx_v_n));
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":146
 * 
 *     if not isValidName(n):
 *         raise NameError("'%s' not a valid branch name." % n)             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint isValidName(str n):
 */
    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_v_n)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_builtin_NameError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.checkNameValidity");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":148
 *         raise NameError("'%s' not a valid branch name." % n)
 * 
 * cdef inline bint isValidName(str n):             # <<<<<<<<<<<<<<
 * 
 *     if n is None:
 */

static CYTHON_INLINE int __pyx_f_8treedict_8treedict_isValidName(PyObject *__pyx_v_n) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("isValidName");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":150
 * cdef inline bint isValidName(str n):
 * 
 *     if n is None:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_1 = (__pyx_v_n == ((PyObject *)Py_None));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":151
 * 
 *     if n is None:
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     return (_string_name_validator_match(n) is not None)
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":153
 *         return False
 * 
 *     return (_string_name_validator_match(n) is not None)             # <<<<<<<<<<<<<<
 * 
 * cdef inline str catNames(str s1, str s2):
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_n));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_n));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_n));
  __pyx_t_3 = PyObject_Call(__pyx_v_8treedict_8treedict__string_name_validator_match, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = (__pyx_t_3 != Py_None);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("treedict.treedict.isValidName");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":155
 *     return (_string_name_validator_match(n) is not None)
 * 
 * cdef inline str catNames(str s1, str s2):             # <<<<<<<<<<<<<<
 *     if len(s1) == 0:
 *         return s2
 */

static CYTHON_INLINE PyObject *__pyx_f_8treedict_8treedict_catNames(PyObject *__pyx_v_s1, PyObject *__pyx_v_s2) {
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("catNames");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":156
 * 
 * cdef inline str catNames(str s1, str s2):
 *     if len(s1) == 0:             # <<<<<<<<<<<<<<
 *         return s2
 *     elif len(s2) == 0:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_s1)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 == 0);
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":157
 * cdef inline str catNames(str s1, str s2):
 *     if len(s1) == 0:
 *         return s2             # <<<<<<<<<<<<<<
 *     elif len(s2) == 0:
 *         return s1
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_s2));
    __pyx_r = __pyx_v_s2;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":158
 *     if len(s1) == 0:
 *         return s2
 *     elif len(s2) == 0:             # <<<<<<<<<<<<<<
 *         return s1
 *     else:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_s2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 == 0);
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":159
 *         return s2
 *     elif len(s2) == 0:
 *         return s1             # <<<<<<<<<<<<<<
 *     else:
 *         return s1 + '.' + s2
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_s1));
    __pyx_r = __pyx_v_s1;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":161
 *         return s1
 *     else:
 *         return s1 + '.' + s2             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_v_s1), ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_v_s2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.catNames");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":175
 * cdef dict _tree_lookup_dict = {}
 * 
 * cdef inline registerTree(TreeDict tree):             # <<<<<<<<<<<<<<
 *     registerTreeByName(tree._branchName(False, True), tree)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_8treedict_8treedict_registerTree(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_tree) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("registerTree");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":176
 * 
 * cdef inline registerTree(TreeDict tree):
 *     registerTreeByName(tree._branchName(False, True), tree)             # <<<<<<<<<<<<<<
 * 
 * cdef inline registerTreeByName(str name, TreeDict tree):
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_tree->__pyx_vtab)->_branchName(__pyx_v_tree, 0, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_8treedict_8treedict_registerTreeByName(((PyObject *)__pyx_t_1), __pyx_v_tree); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.registerTree");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":178
 *     registerTreeByName(tree._branchName(False, True), tree)
 * 
 * cdef inline registerTreeByName(str name, TreeDict tree):             # <<<<<<<<<<<<<<
 *     _tree_lookup_dict[name] = tree
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_8treedict_8treedict_registerTreeByName(PyObject *__pyx_v_name, struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_tree) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("registerTreeByName");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":179
 * 
 * cdef inline registerTreeByName(str name, TreeDict tree):
 *     _tree_lookup_dict[name] = tree             # <<<<<<<<<<<<<<
 * 
 * cpdef TreeDict getTree(str name):
 */
  if (PyDict_SetItem(((PyObject *)__pyx_v_8treedict_8treedict__tree_lookup_dict), ((PyObject *)__pyx_v_name), ((PyObject *)__pyx_v_tree)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("treedict.treedict.registerTreeByName");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":181
 *     _tree_lookup_dict[name] = tree
 * 
 * cpdef TreeDict getTree(str name):             # <<<<<<<<<<<<<<
 *     """
 *     Retrieves or creates a parameter tree with the given name.  This
 */

static PyObject *__pyx_pf_8treedict_8treedict_getTree(PyObject *__pyx_self, PyObject *__pyx_v_name); /*proto*/
static  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_f_8treedict_8treedict_getTree(PyObject *__pyx_v_name, int __pyx_skip_dispatch) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_t;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("getTree");
  __pyx_v_t = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":194
 *     """
 * 
 *     checkKeyNotNone(name)             # <<<<<<<<<<<<<<
 * 
 *     cdef TreeDict t
 */
  __pyx_t_1 = __pyx_f_8treedict_8treedict_checkKeyNotNone(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":198
 *     cdef TreeDict t
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         return _tree_lookup_dict[name]
 *     except KeyError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":199
 * 
 *     try:
 *         return _tree_lookup_dict[name]             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         t = newTreeDict(name, True)
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_8treedict_8treedict__tree_lookup_dict), ((PyObject *)__pyx_v_name)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8treedict_8treedict_TreeDict))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L10_try_end;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":200
 *     try:
 *         return _tree_lookup_dict[name]
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         t = newTreeDict(name, True)
 *         registerTree(t)
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.getTree");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":201
 *         return _tree_lookup_dict[name]
 *     except KeyError:
 *         t = newTreeDict(name, True)             # <<<<<<<<<<<<<<
 *         registerTree(t)
 *         return t
 */
      __pyx_t_5 = ((PyObject *)__pyx_f_8treedict_8treedict_newTreeDict(__pyx_v_name, 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_v_t));
      __pyx_v_t = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":202
 *     except KeyError:
 *         t = newTreeDict(name, True)
 *         registerTree(t)             # <<<<<<<<<<<<<<
 *         return t
 * 
 */
      __pyx_t_5 = __pyx_f_8treedict_8treedict_registerTree(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":203
 *         t = newTreeDict(name, True)
 *         registerTree(t)
 *         return t             # <<<<<<<<<<<<<<
 * 
 *     # *NOTE: This module may be removed in the future do to the 'only
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(((PyObject *)__pyx_v_t));
      __pyx_r = __pyx_v_t;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_except_return;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L10_try_end:;
  }

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("treedict.treedict.getTree");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_t);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":181
 *     _tree_lookup_dict[name] = tree
 * 
 * cpdef TreeDict getTree(str name):             # <<<<<<<<<<<<<<
 *     """
 *     Retrieves or creates a parameter tree with the given name.  This
 */

static PyObject *__pyx_pf_8treedict_8treedict_getTree(PyObject *__pyx_self, PyObject *__pyx_v_name); /*proto*/
static char __pyx_doc_8treedict_8treedict_getTree[] = "\n    Retrieves or creates a parameter tree with the given name.  This\n    is the recommended way to create a new treedict instance if it is\n    used to hold global parameter settings.  Creating the tree this\n    way allows other modules to also access the same tree through this\n    method -- if the tree already exists in the global tree registry,\n    the same tree is returned.\n\n    A tree is considered 'registered' and can be retrieved in this way\n    if and only if it is instantiated through this function.\n    ";
static PyObject *__pyx_pf_8treedict_8treedict_getTree(PyObject *__pyx_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getTree");
  __pyx_self = __pyx_self;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), &PyString_Type, 1, "name", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8treedict_8treedict_getTree(__pyx_v_name, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.getTree");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":211
 *     # system.  Feedback on this is welcome; for now, I'll leave it in - HK.*
 * 
 * cpdef bint treeExists(str name):             # <<<<<<<<<<<<<<
 *     """
 *     Returns True if a registered tree with name `name` exists, and
 */

static PyObject *__pyx_pf_8treedict_8treedict_treeExists(PyObject *__pyx_self, PyObject *__pyx_v_name); /*proto*/
static  int __pyx_f_8treedict_8treedict_treeExists(PyObject *__pyx_v_name, int __pyx_skip_dispatch) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("treeExists");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":217
 *     """
 * 
 *     return name in _tree_lookup_dict             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  if (unlikely(((PyObject *)__pyx_v_8treedict_8treedict__tree_lookup_dict) == Py_None)) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else {
    __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_8treedict_8treedict__tree_lookup_dict), ((PyObject *)__pyx_v_name)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("treedict.treedict.treeExists");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":211
 *     # system.  Feedback on this is welcome; for now, I'll leave it in - HK.*
 * 
 * cpdef bint treeExists(str name):             # <<<<<<<<<<<<<<
 *     """
 *     Returns True if a registered tree with name `name` exists, and
 */

static PyObject *__pyx_pf_8treedict_8treedict_treeExists(PyObject *__pyx_self, PyObject *__pyx_v_name); /*proto*/
static char __pyx_doc_8treedict_8treedict_treeExists[] = "\n    Returns True if a registered tree with name `name` exists, and\n    False otherwise.\n    ";
static PyObject *__pyx_pf_8treedict_8treedict_treeExists(PyObject *__pyx_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("treeExists");
  __pyx_self = __pyx_self;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), &PyString_Type, 1, "name", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_8treedict_8treedict_treeExists(__pyx_v_name, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.treeExists");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":229
 * ########################################
 * # First -- hashing functionality
 * cdef _runValueHash(hf, value):             # <<<<<<<<<<<<<<
 *     if type(value) is dict:
 *         hf("$$$DICT")
 */

static  PyObject *__pyx_f_8treedict_8treedict__runValueHash(PyObject *__pyx_v_hf, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_k;
  PyObject *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("_runValueHash");
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":230
 * # First -- hashing functionality
 * cdef _runValueHash(hf, value):
 *     if type(value) is dict:             # <<<<<<<<<<<<<<
 *         hf("$$$DICT")
 *         for k, v in sorted((<dict>value).iteritems()):
 */
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_value)) == ((PyObject *)((PyObject*)&PyDict_Type)));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":231
 * cdef _runValueHash(hf, value):
 *     if type(value) is dict:
 *         hf("$$$DICT")             # <<<<<<<<<<<<<<
 *         for k, v in sorted((<dict>value).iteritems()):
 *             _runValueHash(hf, k)
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
    __pyx_t_3 = PyObject_Call(__pyx_v_hf, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":232
 *     if type(value) is dict:
 *         hf("$$$DICT")
 *         for k, v in sorted((<dict>value).iteritems()):             # <<<<<<<<<<<<<<
 *             _runValueHash(hf, k)
 *             hf(":")
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __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 = 232; __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 = PyObject_Call(__pyx_builtin_sorted, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_4 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
      } else {
        __pyx_t_2 = PyIter_Next(__pyx_t_3);
        if (!__pyx_t_2) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
        PyObject* tuple = __pyx_t_2;
        __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_v_k);
        __pyx_v_k = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_v_v);
        __pyx_v_v = __pyx_t_6;
        __pyx_t_6 = 0;
      } else {
        __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_v_k);
        __pyx_v_k = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_v_v);
        __pyx_v_v = __pyx_t_6;
        __pyx_t_6 = 0;
      }

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":233
 *         hf("$$$DICT")
 *         for k, v in sorted((<dict>value).iteritems()):
 *             _runValueHash(hf, k)             # <<<<<<<<<<<<<<
 *             hf(":")
 *             _runValueHash(hf, v)
 */
      __pyx_t_2 = __pyx_f_8treedict_8treedict__runValueHash(__pyx_v_hf, __pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":234
 *         for k, v in sorted((<dict>value).iteritems()):
 *             _runValueHash(hf, k)
 *             hf(":")             # <<<<<<<<<<<<<<
 *             _runValueHash(hf, v)
 * 
 */
      __pyx_t_2 = PyTuple_New(1); 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_INCREF(((PyObject *)__pyx_kp_s_5));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
      __pyx_t_6 = PyObject_Call(__pyx_v_hf, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":235
 *             _runValueHash(hf, k)
 *             hf(":")
 *             _runValueHash(hf, v)             # <<<<<<<<<<<<<<
 * 
 *     elif type(value) is set:
 */
      __pyx_t_6 = __pyx_f_8treedict_8treedict__runValueHash(__pyx_v_hf, __pyx_v_v); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":237
 *             _runValueHash(hf, v)
 * 
 *     elif type(value) is set:             # <<<<<<<<<<<<<<
 *         hf("$$$SET")
 *         for v in sorted(value):
 */
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_value)) == ((PyObject *)((PyObject*)&PySet_Type)));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":238
 * 
 *     elif type(value) is set:
 *         hf("$$$SET")             # <<<<<<<<<<<<<<
 *         for v in sorted(value):
 *             _runValueHash(hf, v)
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
    __pyx_t_6 = PyObject_Call(__pyx_v_hf, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":239
 *     elif type(value) is set:
 *         hf("$$$SET")
 *         for v in sorted(value):             # <<<<<<<<<<<<<<
 *             _runValueHash(hf, v)
 * 
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_sorted, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_4 = 0; __pyx_t_6 = __pyx_t_3; __Pyx_INCREF(__pyx_t_6);
    } else {
      __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_6))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_6)) break;
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_6))) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
      } else {
        __pyx_t_3 = PyIter_Next(__pyx_t_6);
        if (!__pyx_t_3) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":240
 *         hf("$$$SET")
 *         for v in sorted(value):
 *             _runValueHash(hf, v)             # <<<<<<<<<<<<<<
 * 
 *     elif type(value) is list:
 */
      __pyx_t_3 = __pyx_f_8treedict_8treedict__runValueHash(__pyx_v_hf, __pyx_v_v); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":242
 *             _runValueHash(hf, v)
 * 
 *     elif type(value) is list:             # <<<<<<<<<<<<<<
 *         hf("$$$LIST")
 *         for v in (<list>value):
 */
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_value)) == ((PyObject *)((PyObject*)&PyList_Type)));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":243
 * 
 *     elif type(value) is list:
 *         hf("$$$LIST")             # <<<<<<<<<<<<<<
 *         for v in (<list>value):
 *             _runValueHash(hf, v)
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_7));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
    __pyx_t_3 = PyObject_Call(__pyx_v_hf, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":244
 *     elif type(value) is list:
 *         hf("$$$LIST")
 *         for v in (<list>value):             # <<<<<<<<<<<<<<
 *             _runValueHash(hf, v)
 * 
 */
    if (likely(__pyx_v_value != Py_None)) {
      __pyx_t_4 = 0; __pyx_t_3 = __pyx_v_value; __Pyx_INCREF(__pyx_t_3);
    } else {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    for (;;) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":245
 *         hf("$$$LIST")
 *         for v in (<list>value):
 *             _runValueHash(hf, v)             # <<<<<<<<<<<<<<
 * 
 *     elif type(value) is tuple:
 */
      __pyx_t_6 = __pyx_f_8treedict_8treedict__runValueHash(__pyx_v_hf, __pyx_v_v); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":247
 *             _runValueHash(hf, v)
 * 
 *     elif type(value) is tuple:             # <<<<<<<<<<<<<<
 *         hf("$$$TUPLE")
 *         for v in (<tuple>value):
 */
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_value)) == ((PyObject *)((PyObject*)&PyTuple_Type)));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":248
 * 
 *     elif type(value) is tuple:
 *         hf("$$$TUPLE")             # <<<<<<<<<<<<<<
 *         for v in (<tuple>value):
 *             _runValueHash(hf, v)
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_8));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
    __pyx_t_6 = PyObject_Call(__pyx_v_hf, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":249
 *     elif type(value) is tuple:
 *         hf("$$$TUPLE")
 *         for v in (<tuple>value):             # <<<<<<<<<<<<<<
 *             _runValueHash(hf, v)
 * 
 */
    if (likely(__pyx_v_value != Py_None)) {
      __pyx_t_4 = 0; __pyx_t_6 = __pyx_v_value; __Pyx_INCREF(__pyx_t_6);
    } else {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    for (;;) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":250
 *         hf("$$$TUPLE")
 *         for v in (<tuple>value):
 *             _runValueHash(hf, v)             # <<<<<<<<<<<<<<
 * 
 *     elif type(value) is TreeDict:
 */
      __pyx_t_3 = __pyx_f_8treedict_8treedict__runValueHash(__pyx_v_hf, __pyx_v_v); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":252
 *             _runValueHash(hf, v)
 * 
 *     elif type(value) is TreeDict:             # <<<<<<<<<<<<<<
 *         hf( (<TreeDict>value)._self_hash() )
 * 
 */
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_value)) == ((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict_TreeDict)));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":253
 * 
 *     elif type(value) is TreeDict:
 *         hf( (<TreeDict>value)._self_hash() )             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
    __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_value)->__pyx_vtab)->_self_hash(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_value))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_v_hf, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":256
 * 
 *     else:
 *         try:             # <<<<<<<<<<<<<<
 *             hf(dumps(value, protocol=2))
 *         except PicklingError:
 */
    {
      PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
      __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
      __Pyx_XGOTREF(__pyx_save_exc_type);
      __Pyx_XGOTREF(__pyx_save_exc_value);
      __Pyx_XGOTREF(__pyx_save_exc_tb);
      /*try:*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":257
 *     else:
 *         try:
 *             hf(dumps(value, protocol=2))             # <<<<<<<<<<<<<<
 *         except PicklingError:
 *             raise HashError
 */
        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_v_value);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_value);
        __Pyx_GIVEREF(__pyx_v_value);
        __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
        if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__protocol), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_v_8treedict_8treedict_dumps, __pyx_t_6, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(((PyObject *)__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 = 257; __pyx_clineno = __LINE__; goto __pyx_L12_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 = PyObject_Call(__pyx_v_hf, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
      __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
      __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
      goto __pyx_L19_try_end;
      __pyx_L12_error:;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":258
 *         try:
 *             hf(dumps(value, protocol=2))
 *         except PicklingError:             # <<<<<<<<<<<<<<
 *             raise HashError
 * 
 */
      __pyx_t_8 = PyErr_ExceptionMatches(__pyx_v_8treedict_8treedict_PicklingError);
      if (__pyx_t_8) {
        __Pyx_AddTraceback("treedict.treedict._runValueHash");
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_6);

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":259
 *             hf(dumps(value, protocol=2))
 *         except PicklingError:
 *             raise HashError             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
        __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__HashError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_Raise(__pyx_t_5, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L13_exception_handled;
      }
      __pyx_L14_except_error:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L1_error;
      __pyx_L13_exception_handled:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      __pyx_L19_try_end:;
    }
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("treedict.treedict._runValueHash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":299
 * DEF f_allFlags         = (2**31 - 1)
 * 
 * cdef inline void _setFlagOn(flagtype *f, flagtype flag):             # <<<<<<<<<<<<<<
 *     f[0] |= flag
 * 
 */

static CYTHON_INLINE void __pyx_f_8treedict_8treedict__setFlagOn(__pyx_t_8treedict_8treedict_flagtype *__pyx_v_f, __pyx_t_8treedict_8treedict_flagtype __pyx_v_flag) {
  __Pyx_RefNannySetupContext("_setFlagOn");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":300
 * 
 * cdef inline void _setFlagOn(flagtype *f, flagtype flag):
 *     f[0] |= flag             # <<<<<<<<<<<<<<
 * 
 * cdef inline void _setFlagOff(flagtype *f, flagtype flag):
 */
  (__pyx_v_f[0]) |= __pyx_v_flag;

  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":302
 *     f[0] |= flag
 * 
 * cdef inline void _setFlagOff(flagtype *f, flagtype flag):             # <<<<<<<<<<<<<<
 *     f[0] &= (f_allFlags - flag)
 * 
 */

static CYTHON_INLINE void __pyx_f_8treedict_8treedict__setFlagOff(__pyx_t_8treedict_8treedict_flagtype *__pyx_v_f, __pyx_t_8treedict_8treedict_flagtype __pyx_v_flag) {
  __Pyx_RefNannySetupContext("_setFlagOff");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":303
 * 
 * cdef inline void _setFlagOff(flagtype *f, flagtype flag):
 *     f[0] &= (f_allFlags - flag)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void _setFlag(flagtype *f, flagtype flag, bint on):
 */
  (__pyx_v_f[0]) &= (2147483647 - __pyx_v_flag);

  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":305
 *     f[0] &= (f_allFlags - flag)
 * 
 * cdef inline void _setFlag(flagtype *f, flagtype flag, bint on):             # <<<<<<<<<<<<<<
 *     if on: _setFlagOn(f, flag)
 *     else:  _setFlagOff(f, flag)
 */

static CYTHON_INLINE void __pyx_f_8treedict_8treedict__setFlag(__pyx_t_8treedict_8treedict_flagtype *__pyx_v_f, __pyx_t_8treedict_8treedict_flagtype __pyx_v_flag, int __pyx_v_on) {
  __Pyx_RefNannySetupContext("_setFlag");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":306
 * 
 * cdef inline void _setFlag(flagtype *f, flagtype flag, bint on):
 *     if on: _setFlagOn(f, flag)             # <<<<<<<<<<<<<<
 *     else:  _setFlagOff(f, flag)
 * 
 */
  if (__pyx_v_on) {
    __pyx_f_8treedict_8treedict__setFlagOn(__pyx_v_f, __pyx_v_flag);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":307
 * cdef inline void _setFlag(flagtype *f, flagtype flag, bint on):
 *     if on: _setFlagOn(f, flag)
 *     else:  _setFlagOff(f, flag)             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _flagOn(flagtype *f, flagtype flag):
 */
    __pyx_f_8treedict_8treedict__setFlagOff(__pyx_v_f, __pyx_v_flag);
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":309
 *     else:  _setFlagOff(f, flag)
 * 
 * cdef inline bint _flagOn(flagtype *f, flagtype flag):             # <<<<<<<<<<<<<<
 *     return (f[0] & flag) != 0
 * 
 */

static CYTHON_INLINE int __pyx_f_8treedict_8treedict__flagOn(__pyx_t_8treedict_8treedict_flagtype *__pyx_v_f, __pyx_t_8treedict_8treedict_flagtype __pyx_v_flag) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("_flagOn");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":310
 * 
 * cdef inline bint _flagOn(flagtype *f, flagtype flag):
 *     return (f[0] & flag) != 0             # <<<<<<<<<<<<<<
 * 
 * ########################################
 */
  __pyx_r = (((__pyx_v_f[0]) & __pyx_v_flag) != 0);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":344
 *     }
 * 
 * cdef inline int itemType(v):             # <<<<<<<<<<<<<<
 *     cdef object t = type(v)
 * 
 */

static CYTHON_INLINE int __pyx_f_8treedict_8treedict_itemType(PyObject *__pyx_v_v) {
  PyObject *__pyx_v_t = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  long __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("itemType");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":345
 * 
 * cdef inline int itemType(v):
 *     cdef object t = type(v)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_v)));
  __pyx_v_t = ((PyObject *)Py_TYPE(__pyx_v_v));

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":347
 *     cdef object t = type(v)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         return _fast_type_determination[t]
 *     except KeyError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":348
 * 
 *     try:
 *         return _fast_type_determination[t]             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         pass
 */
      __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_8treedict_8treedict__fast_type_determination), __pyx_v_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = __pyx_t_2;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L10_try_end;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":349
 *     try:
 *         return _fast_type_determination[t]
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_2) {
      PyErr_Restore(0,0,0);
      goto __pyx_L4_exception_handled;
    }
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L10_try_end:;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":352
 *         pass
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         hash(v)
 *     except TypeError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":353
 * 
 *     try:
 *         hash(v)             # <<<<<<<<<<<<<<
 *     except TypeError:
 *         return t_Mutable_Complex
 */
      __pyx_t_3 = PyObject_Hash(__pyx_v_v); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L18_try_end;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":354
 *     try:
 *         hash(v)
 *     except TypeError:             # <<<<<<<<<<<<<<
 *         return t_Mutable_Complex
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.itemType");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":355
 *         hash(v)
 *     except TypeError:
 *         return t_Mutable_Complex             # <<<<<<<<<<<<<<
 * 
 *     return t_Immutable_Complex
 */
      __pyx_r = 1;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_except_return;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L12_exception_handled;
    }
    __pyx_L13_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L14_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L12_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L18_try_end:;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":357
 *         return t_Mutable_Complex
 * 
 *     return t_Immutable_Complex             # <<<<<<<<<<<<<<
 * 
 * ########################################
 */
  __pyx_r = 3;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("treedict.treedict.itemType");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":374
 *     cdef dict      _aux_dict
 * 
 *     cdef _set_it(self, TreeDict node, str key, v, size_t _order_position):             # <<<<<<<<<<<<<<
 * 
 *         self._v = v
 */

static  PyObject *__pyx_f_8treedict_8treedict_10_PTreeNode__set_it(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self, struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_node, PyObject *__pyx_v_key, PyObject *__pyx_v_v, size_t __pyx_v__order_position) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_set_it");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":376
 *     cdef _set_it(self, TreeDict node, str key, v, size_t _order_position):
 * 
 *         self._v = v             # <<<<<<<<<<<<<<
 * 
 *         if type(v) is TreeDict:
 */
  __Pyx_INCREF(__pyx_v_v);
  __Pyx_GIVEREF(__pyx_v_v);
  __Pyx_GOTREF(__pyx_v_self->_v);
  __Pyx_DECREF(__pyx_v_self->_v);
  __pyx_v_self->_v = __pyx_v_v;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":378
 *         self._v = v
 * 
 *         if type(v) is TreeDict:             # <<<<<<<<<<<<<<
 *             if ((<TreeDict>v)._parent is node) and ((<TreeDict>v)._name == key):
 * 
 */
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_v)) == ((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict_TreeDict)));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":379
 * 
 *         if type(v) is TreeDict:
 *             if ((<TreeDict>v)._parent is node) and ((<TreeDict>v)._name == key):             # <<<<<<<<<<<<<<
 * 
 *                 if RUN_ASSERTS:
 */
    __pyx_t_1 = (((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_v)->_parent == __pyx_v_node);
    if (__pyx_t_1) {
      __pyx_t_2 = PyObject_RichCompare(((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_v)->_name), ((PyObject *)__pyx_v_key), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_1;
    }
    if (__pyx_t_4) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":384
 *                     assert (<TreeDict>v)._name is key
 * 
 *                 self._t = t_Branch             # <<<<<<<<<<<<<<
 *             else:
 *                 self._t = t_Tree
 */
      __pyx_v_self->_t = 5;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":386
 *                 self._t = t_Branch
 *             else:
 *                 self._t = t_Tree             # <<<<<<<<<<<<<<
 *         else:
 *             self._t = itemType(v)
 */
      __pyx_v_self->_t = 4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":388
 *                 self._t = t_Tree
 *         else:
 *             self._t = itemType(v)             # <<<<<<<<<<<<<<
 * 
 *         self._aux_dict = {}
 */
    __pyx_v_self->_t = __pyx_f_8treedict_8treedict_itemType(__pyx_v_v);
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":390
 *             self._t = itemType(v)
 * 
 *         self._aux_dict = {}             # <<<<<<<<<<<<<<
 *         self._order_position = _order_position
 * 
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __Pyx_GOTREF(__pyx_v_self->_aux_dict);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_aux_dict));
  __pyx_v_self->_aux_dict = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":391
 * 
 *         self._aux_dict = {}
 *         self._order_position = _order_position             # <<<<<<<<<<<<<<
 * 
 *     cdef value(self):
 */
  __pyx_v_self->_order_position = __pyx_v__order_position;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict._PTreeNode._set_it");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":393
 *         self._order_position = _order_position
 * 
 *     cdef value(self):             # <<<<<<<<<<<<<<
 *         return self._v
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_10_PTreeNode_value(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("value");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":394
 * 
 *     cdef value(self):
 *         return self._v             # <<<<<<<<<<<<<<
 * 
 *     cdef orderPosition(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_v);
  __pyx_r = __pyx_v_self->_v;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":396
 *         return self._v
 * 
 *     cdef orderPosition(self):             # <<<<<<<<<<<<<<
 *         return self._order_position
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_10_PTreeNode_orderPosition(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("orderPosition");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":397
 * 
 *     cdef orderPosition(self):
 *         return self._order_position             # <<<<<<<<<<<<<<
 * 
 *     cdef setOrderPostion(self, size_t op):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_order_position); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict._PTreeNode.orderPosition");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":399
 *         return self._order_position
 * 
 *     cdef setOrderPostion(self, size_t op):             # <<<<<<<<<<<<<<
 *         self._order_position = op
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_10_PTreeNode_setOrderPostion(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self, size_t __pyx_v_op) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("setOrderPostion");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":400
 * 
 *     cdef setOrderPostion(self, size_t op):
 *         self._order_position = op             # <<<<<<<<<<<<<<
 * 
 *     cdef int type(self):
 */
  __pyx_v_self->_order_position = __pyx_v_op;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":402
 *         self._order_position = op
 * 
 *     cdef int type(self):             # <<<<<<<<<<<<<<
 *         return self._t
 * 
 */

static  int __pyx_f_8treedict_8treedict_10_PTreeNode_type(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("type");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":403
 * 
 *     cdef int type(self):
 *         return self._t             # <<<<<<<<<<<<<<
 * 
 *     # Basically there are three classes; trees, mutable local types,
 */
  __pyx_r = __pyx_v_self->_t;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":408
 *     # and immutable local types
 * 
 *     cdef bint isMutable(self):             # <<<<<<<<<<<<<<
 *         return (self._t == t_Mutable_Simple
 *                 or self._t == t_Mutable_Complex)
 */

static  int __pyx_f_8treedict_8treedict_10_PTreeNode_isMutable(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("isMutable");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":410
 *     cdef bint isMutable(self):
 *         return (self._t == t_Mutable_Simple
 *                 or self._t == t_Mutable_Complex)             # <<<<<<<<<<<<<<
 * 
 *     cdef bint isImmutable(self):
 */
  switch (__pyx_v_self->_t) {
    case 0:
    case 1:
    __pyx_t_1 = 1;
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":412
 *                 or self._t == t_Mutable_Complex)
 * 
 *     cdef bint isImmutable(self):             # <<<<<<<<<<<<<<
 *         return (self._t == t_Immutable_Simple
 *                 or self._t == t_Immutable_Complex)
 */

static  int __pyx_f_8treedict_8treedict_10_PTreeNode_isImmutable(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("isImmutable");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":414
 *     cdef bint isImmutable(self):
 *         return (self._t == t_Immutable_Simple
 *                 or self._t == t_Immutable_Complex)             # <<<<<<<<<<<<<<
 * 
 *     cdef bint isBranch(self):
 */
  switch (__pyx_v_self->_t) {
    case 2:
    case 3:
    __pyx_t_1 = 1;
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":416
 *                 or self._t == t_Immutable_Complex)
 * 
 *     cdef bint isBranch(self):             # <<<<<<<<<<<<<<
 *         return self._t == t_Branch
 * 
 */

static  int __pyx_f_8treedict_8treedict_10_PTreeNode_isBranch(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("isBranch");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":417
 * 
 *     cdef bint isBranch(self):
 *         return self._t == t_Branch             # <<<<<<<<<<<<<<
 * 
 *     cdef bint isNonBranchTree(self):
 */
  __pyx_r = (__pyx_v_self->_t == 5);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":419
 *         return self._t == t_Branch
 * 
 *     cdef bint isNonBranchTree(self):             # <<<<<<<<<<<<<<
 *         return self._t == t_Tree
 * 
 */

static  int __pyx_f_8treedict_8treedict_10_PTreeNode_isNonBranchTree(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("isNonBranchTree");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":420
 * 
 *     cdef bint isNonBranchTree(self):
 *         return self._t == t_Tree             # <<<<<<<<<<<<<<
 * 
 *     cdef bint isDanglingBranch(self):
 */
  __pyx_r = (__pyx_v_self->_t == 4);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":422
 *         return self._t == t_Tree
 * 
 *     cdef bint isDanglingBranch(self):             # <<<<<<<<<<<<<<
 *         return self.isBranch() and (<TreeDict>self._v).isDangling()
 * 
 */

static  int __pyx_f_8treedict_8treedict_10_PTreeNode_isDanglingBranch(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("isDanglingBranch");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":423
 * 
 *     cdef bint isDanglingBranch(self):
 *         return self.isBranch() and (<TreeDict>self._v).isDangling()             # <<<<<<<<<<<<<<
 * 
 *     cdef bint isTree(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_self->__pyx_vtab)->isBranch(__pyx_v_self);
  if (__pyx_t_1) {
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self->_v)->__pyx_vtab)->isDangling(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self->_v), 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":425
 *         return self.isBranch() and (<TreeDict>self._v).isDangling()
 * 
 *     cdef bint isTree(self):             # <<<<<<<<<<<<<<
 *         return self.isBranch() or self.isNonBranchTree()
 * 
 */

static  int __pyx_f_8treedict_8treedict_10_PTreeNode_isTree(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("isTree");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":426
 * 
 *     cdef bint isTree(self):
 *         return self.isBranch() or self.isNonBranchTree()             # <<<<<<<<<<<<<<
 * 
 *     cdef bint isDanglingTree(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_self->__pyx_vtab)->isBranch(__pyx_v_self);
  if (!__pyx_t_1) {
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_self->__pyx_vtab)->isNonBranchTree(__pyx_v_self);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":428
 *         return self.isBranch() or self.isNonBranchTree()
 * 
 *     cdef bint isDanglingTree(self):             # <<<<<<<<<<<<<<
 *         return self.isTree() and (<TreeDict>self._v).isDangling()
 * 
 */

static  int __pyx_f_8treedict_8treedict_10_PTreeNode_isDanglingTree(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("isDanglingTree");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":429
 * 
 *     cdef bint isDanglingTree(self):
 *         return self.isTree() and (<TreeDict>self._v).isDangling()             # <<<<<<<<<<<<<<
 * 
 *     cdef TreeDict tree(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_self->__pyx_vtab)->isTree(__pyx_v_self);
  if (__pyx_t_1) {
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self->_v)->__pyx_vtab)->isDangling(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self->_v), 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":431
 *         return self.isTree() and (<TreeDict>self._v).isDangling()
 * 
 *     cdef TreeDict tree(self):             # <<<<<<<<<<<<<<
 *         if RUN_ASSERTS:
 *             assert self.isTree()
 */

static  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_f_8treedict_8treedict_10_PTreeNode_tree(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("tree");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":435
 *             assert self.isTree()
 * 
 *         return (<TreeDict>self._v)             # <<<<<<<<<<<<<<
 * 
 *     cdef bint isChildOf(self, TreeDict parent):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self->_v)));
  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self->_v);
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":437
 *         return (<TreeDict>self._v)
 * 
 *     cdef bint isChildOf(self, TreeDict parent):             # <<<<<<<<<<<<<<
 *         if RUN_ASSERTS:
 *             assert self.isTree()
 */

static  int __pyx_f_8treedict_8treedict_10_PTreeNode_isChildOf(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self, struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_parent) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("isChildOf");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":441
 *             assert self.isTree()
 * 
 *         return (<TreeDict>self._v).parentNode() is parent             # <<<<<<<<<<<<<<
 * 
 *     cdef str fullHash(self):
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self->_v)->__pyx_vtab)->parentNode(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self->_v), 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1) == __pyx_v_parent);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("treedict.treedict._PTreeNode.isChildOf");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":443
 *         return (<TreeDict>self._v).parentNode() is parent
 * 
 *     cdef str fullHash(self):             # <<<<<<<<<<<<<<
 *         h = md5()
 *         hf = getattr(h, 'update')
 */

static  PyObject *__pyx_f_8treedict_8treedict_10_PTreeNode_fullHash(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self) {
  PyObject *__pyx_v_h;
  PyObject *__pyx_v_hf;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("fullHash");
  __pyx_v_h = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_hf = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":444
 * 
 *     cdef str fullHash(self):
 *         h = md5()             # <<<<<<<<<<<<<<
 *         hf = getattr(h, 'update')
 *         self.runFullHash(hf)
 */
  __pyx_t_1 = PyObject_Call(__pyx_v_8treedict_8treedict_md5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_h);
  __pyx_v_h = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":445
 *     cdef str fullHash(self):
 *         h = md5()
 *         hf = getattr(h, 'update')             # <<<<<<<<<<<<<<
 *         self.runFullHash(hf)
 *         return h.digest()
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_h, ((PyObject *)__pyx_n_s__update)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_hf);
  __pyx_v_hf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":446
 *         h = md5()
 *         hf = getattr(h, 'update')
 *         self.runFullHash(hf)             # <<<<<<<<<<<<<<
 *         return h.digest()
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_self->__pyx_vtab)->runFullHash(__pyx_v_self, __pyx_v_hf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":447
 *         hf = getattr(h, 'update')
 *         self.runFullHash(hf)
 *         return h.digest()             # <<<<<<<<<<<<<<
 * 
 *     cdef runFullHash(self, hf):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_h, __pyx_n_s__digest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict._PTreeNode.fullHash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_h);
  __Pyx_DECREF(__pyx_v_hf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":449
 *         return h.digest()
 * 
 *     cdef runFullHash(self, hf):             # <<<<<<<<<<<<<<
 *         cdef TreeDict p
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_10_PTreeNode_runFullHash(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self, PyObject *__pyx_v_hf) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("runFullHash");
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":452
 *         cdef TreeDict p
 * 
 *         if self._t == t_Tree or self._t == t_Branch:             # <<<<<<<<<<<<<<
 *             p = (<TreeDict>self._v)
 *             if not p.isDangling():
 */
  switch (__pyx_v_self->_t) {
    case 4:
    case 5:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":453
 * 
 *         if self._t == t_Tree or self._t == t_Branch:
 *             p = (<TreeDict>self._v)             # <<<<<<<<<<<<<<
 *             if not p.isDangling():
 *                 p._runFullHash(hf)
 */
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self->_v)));
    __Pyx_DECREF(((PyObject *)__pyx_v_p));
    __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self->_v);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":454
 *         if self._t == t_Tree or self._t == t_Branch:
 *             p = (<TreeDict>self._v)
 *             if not p.isDangling():             # <<<<<<<<<<<<<<
 *                 p._runFullHash(hf)
 *         elif self._t == t_Mutable_Simple:
 */
    __pyx_t_1 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->isDangling(__pyx_v_p, 0));
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":455
 *             p = (<TreeDict>self._v)
 *             if not p.isDangling():
 *                 p._runFullHash(hf)             # <<<<<<<<<<<<<<
 *         elif self._t == t_Mutable_Simple:
 *             hf(repr(self._v))
 */
      __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_runFullHash(__pyx_v_p, __pyx_v_hf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L3;
    }
    __pyx_L3:;
    break;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":456
 *             if not p.isDangling():
 *                 p._runFullHash(hf)
 *         elif self._t == t_Mutable_Simple:             # <<<<<<<<<<<<<<
 *             hf(repr(self._v))
 *         elif self._t == t_Mutable_Complex:
 */
    case 0:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":457
 *                 p._runFullHash(hf)
 *         elif self._t == t_Mutable_Simple:
 *             hf(repr(self._v))             # <<<<<<<<<<<<<<
 *         elif self._t == t_Mutable_Complex:
 *             _runValueHash(hf, self._v)
 */
    __pyx_t_2 = PyObject_Repr(__pyx_v_self->_v); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __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 = PyObject_Call(__pyx_v_hf, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    break;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":458
 *         elif self._t == t_Mutable_Simple:
 *             hf(repr(self._v))
 *         elif self._t == t_Mutable_Complex:             # <<<<<<<<<<<<<<
 *             _runValueHash(hf, self._v)
 *         elif self._t == t_Immutable_Simple or self._t == t_Immutable_Complex:
 */
    case 1:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":459
 *             hf(repr(self._v))
 *         elif self._t == t_Mutable_Complex:
 *             _runValueHash(hf, self._v)             # <<<<<<<<<<<<<<
 *         elif self._t == t_Immutable_Simple or self._t == t_Immutable_Complex:
 *             self.runImmutableHash(hf)
 */
    __pyx_t_2 = __pyx_f_8treedict_8treedict__runValueHash(__pyx_v_hf, __pyx_v_self->_v); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    break;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":460
 *         elif self._t == t_Mutable_Complex:
 *             _runValueHash(hf, self._v)
 *         elif self._t == t_Immutable_Simple or self._t == t_Immutable_Complex:             # <<<<<<<<<<<<<<
 *             self.runImmutableHash(hf)
 * 
 */
    case 2:
    case 3:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":461
 *             _runValueHash(hf, self._v)
 *         elif self._t == t_Immutable_Simple or self._t == t_Immutable_Complex:
 *             self.runImmutableHash(hf)             # <<<<<<<<<<<<<<
 * 
 *     cdef runImmutableHash(self, hf):
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_self->__pyx_vtab)->runImmutableHash(__pyx_v_self, __pyx_v_hf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    break;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict._PTreeNode.runFullHash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":463
 *             self.runImmutableHash(hf)
 * 
 *     cdef runImmutableHash(self, hf):             # <<<<<<<<<<<<<<
 *         # Only update it if the item is in the immutable
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_10_PTreeNode_runImmutableHash(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self, PyObject *__pyx_v_hf) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("runImmutableHash");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":466
 *         # Only update it if the item is in the immutable
 * 
 *         if self._t == t_Immutable_Simple:             # <<<<<<<<<<<<<<
 *             hf(repr(self._v))
 *         elif self._t == t_Immutable_Complex:
 */
  switch (__pyx_v_self->_t) {
    case 2:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":467
 * 
 *         if self._t == t_Immutable_Simple:
 *             hf(repr(self._v))             # <<<<<<<<<<<<<<
 *         elif self._t == t_Immutable_Complex:
 *             hf(self._immutableHash())
 */
    __pyx_t_1 = PyObject_Repr(__pyx_v_self->_v); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __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 = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_v_hf, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    break;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":468
 *         if self._t == t_Immutable_Simple:
 *             hf(repr(self._v))
 *         elif self._t == t_Immutable_Complex:             # <<<<<<<<<<<<<<
 *             hf(self._immutableHash())
 * 
 */
    case 3:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":469
 *             hf(repr(self._v))
 *         elif self._t == t_Immutable_Complex:
 *             hf(self._immutableHash())             # <<<<<<<<<<<<<<
 * 
 *     cdef str _immutableHash(self):
 */
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_self->__pyx_vtab)->_immutableHash(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __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 = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_v_hf, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    break;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict._PTreeNode.runImmutableHash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":471
 *             hf(self._immutableHash())
 * 
 *     cdef str _immutableHash(self):             # <<<<<<<<<<<<<<
 *         if s_cached_hash not in self._aux_dict:
 *             ch = md5(dumps(self._v, protocol=2)).digest()
 */

static  PyObject *__pyx_f_8treedict_8treedict_10_PTreeNode__immutableHash(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self) {
  PyObject *__pyx_v_ch;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_immutableHash");
  __pyx_v_ch = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":472
 * 
 *     cdef str _immutableHash(self):
 *         if s_cached_hash not in self._aux_dict:             # <<<<<<<<<<<<<<
 *             ch = md5(dumps(self._v, protocol=2)).digest()
 *             self._aux_dict[s_cached_hash] = ch
 */
  if (unlikely(((PyObject *)__pyx_v_self->_aux_dict) == Py_None)) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else {
    __pyx_t_1 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_cached_hash)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":473
 *     cdef str _immutableHash(self):
 *         if s_cached_hash not in self._aux_dict:
 *             ch = md5(dumps(self._v, protocol=2)).digest()             # <<<<<<<<<<<<<<
 *             self._aux_dict[s_cached_hash] = ch
 *             return ch
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_self->_v);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self->_v);
    __Pyx_GIVEREF(__pyx_v_self->_v);
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__protocol), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_v_8treedict_8treedict_dumps, __pyx_t_2, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__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 = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_v_8treedict_8treedict_md5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__digest); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_ch);
    __pyx_v_ch = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":474
 *         if s_cached_hash not in self._aux_dict:
 *             ch = md5(dumps(self._v, protocol=2)).digest()
 *             self._aux_dict[s_cached_hash] = ch             # <<<<<<<<<<<<<<
 *             return ch
 *         else:
 */
    if (PyDict_SetItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_cached_hash), __pyx_v_ch) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":475
 *             ch = md5(dumps(self._v, protocol=2)).digest()
 *             self._aux_dict[s_cached_hash] = ch
 *             return ch             # <<<<<<<<<<<<<<
 *         else:
 *             return self._aux_dict[s_cached_hash]
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    if (!(likely(PyString_CheckExact(__pyx_v_ch))||((__pyx_v_ch) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_ch)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_ch);
    __pyx_r = ((PyObject *)__pyx_v_ch);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":477
 *             return ch
 *         else:
 *             return self._aux_dict[s_cached_hash]             # <<<<<<<<<<<<<<
 * 
 *     cdef bint isEqual(self, _PTreeNode pn):
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_cached_hash)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(PyString_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = ((PyObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict._PTreeNode._immutableHash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ch);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":479
 *             return self._aux_dict[s_cached_hash]
 * 
 *     cdef bint isEqual(self, _PTreeNode pn):             # <<<<<<<<<<<<<<
 *         if self._t != pn._t:
 *             return False
 */

static  int __pyx_f_8treedict_8treedict_10_PTreeNode_isEqual(struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_self, struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("isEqual");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":480
 * 
 *     cdef bint isEqual(self, _PTreeNode pn):
 *         if self._t != pn._t:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_t != __pyx_v_pn->_t);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":481
 *     cdef bint isEqual(self, _PTreeNode pn):
 *         if self._t != pn._t:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         if self._t == t_Tree or self._t == t_Branch:
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":483
 *             return False
 * 
 *         if self._t == t_Tree or self._t == t_Branch:             # <<<<<<<<<<<<<<
 *             return (<TreeDict>self._v)._isEqual(<TreeDict>pn._v)
 *         else:
 */
  switch (__pyx_v_self->_t) {
    case 4:
    case 5:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":484
 * 
 *         if self._t == t_Tree or self._t == t_Branch:
 *             return (<TreeDict>self._v)._isEqual(<TreeDict>pn._v)             # <<<<<<<<<<<<<<
 *         else:
 *             return self._v == pn._v
 */
    __pyx_r = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self->_v)->__pyx_vtab)->_isEqual(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self->_v), ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_pn->_v));
    goto __pyx_L0;
    break;
    default:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":486
 *             return (<TreeDict>self._v)._isEqual(<TreeDict>pn._v)
 *         else:
 *             return self._v == pn._v             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_self->_v, __pyx_v_pn->_v, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    goto __pyx_L0;
    break;
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("treedict.treedict._PTreeNode.isEqual");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":488
 *             return self._v == pn._v
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (_PTreeNode_unpickler,
 *                 (self._v, self._t, self._order_position) )
 */

static PyObject *__pyx_pf_8treedict_8treedict_10_PTreeNode___reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_10_PTreeNode___reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__reduce__");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":489
 * 
 *     def __reduce__(self):
 *         return (_PTreeNode_unpickler,             # <<<<<<<<<<<<<<
 *                 (self._v, self._t, self._order_position) )
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":490
 *     def __reduce__(self):
 *         return (_PTreeNode_unpickler,
 *                 (self._v, self._t, self._order_position) )             # <<<<<<<<<<<<<<
 * 
 * ########################################
 */
  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_v_self)->_t); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_FromSize_t(((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_v_self)->_order_position); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_v_self)->_v);
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_v_self)->_v);
  __Pyx_GIVEREF(((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_v_self)->_v);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); 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);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict._PTreeNode.__reduce__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":498
 *     cdef _PTreeNode createPTreeNode "PY_NEW" (object t)
 * 
 * cdef inline _PTreeNode newPTreeNode(TreeDict node, str key, value, size_t order_pos):             # <<<<<<<<<<<<<<
 *     cdef _PTreeNode pn = createPTreeNode(_PTreeNode)
 *     pn._set_it(node, key, value, order_pos)
 */

static CYTHON_INLINE struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_f_8treedict_8treedict_newPTreeNode(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_node, PyObject *__pyx_v_key, PyObject *__pyx_v_value, size_t __pyx_v_order_pos) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn = 0;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("newPTreeNode");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":499
 * 
 * cdef inline _PTreeNode newPTreeNode(TreeDict node, str key, value, size_t order_pos):
 *     cdef _PTreeNode pn = createPTreeNode(_PTreeNode)             # <<<<<<<<<<<<<<
 *     pn._set_it(node, key, value, order_pos)
 *     return pn
 */
  __pyx_t_1 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict__PTreeNode)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":500
 * cdef inline _PTreeNode newPTreeNode(TreeDict node, str key, value, size_t order_pos):
 *     cdef _PTreeNode pn = createPTreeNode(_PTreeNode)
 *     pn._set_it(node, key, value, order_pos)             # <<<<<<<<<<<<<<
 *     return pn
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->_set_it(__pyx_v_pn, __pyx_v_node, __pyx_v_key, __pyx_v_value, __pyx_v_order_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":501
 *     cdef _PTreeNode pn = createPTreeNode(_PTreeNode)
 *     pn._set_it(node, key, value, order_pos)
 *     return pn             # <<<<<<<<<<<<<<
 * 
 * def _PTreeNode_unpickler(value, int t, size_t order_pos):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_pn));
  __pyx_r = __pyx_v_pn;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.newPTreeNode");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pn);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":503
 *     return pn
 * 
 * def _PTreeNode_unpickler(value, int t, size_t order_pos):             # <<<<<<<<<<<<<<
 *     return newPTreeNodeExact(value, t, order_pos)
 * 
 */

static PyObject *__pyx_pf_8treedict_8treedict__PTreeNode_unpickler(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict__PTreeNode_unpickler(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_value = 0;
  int __pyx_v_t;
  size_t __pyx_v_order_pos;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__value,&__pyx_n_s__t,&__pyx_n_s__order_pos,0};
  __Pyx_RefNannySetupContext("_PTreeNode_unpickler");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__t);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_PTreeNode_unpickler", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__order_pos);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_PTreeNode_unpickler", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_PTreeNode_unpickler") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_value = values[0];
    __pyx_v_t = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_t == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_order_pos = __Pyx_PyInt_AsSize_t(values[2]); if (unlikely((__pyx_v_order_pos == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_t = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_t == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_order_pos = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_order_pos == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_PTreeNode_unpickler", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict._PTreeNode_unpickler");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":504
 * 
 * def _PTreeNode_unpickler(value, int t, size_t order_pos):
 *     return newPTreeNodeExact(value, t, order_pos)             # <<<<<<<<<<<<<<
 * 
 * cdef inline newPTreeNodeExact(value, int t, size_t order_pos):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8treedict_8treedict_newPTreeNodeExact(__pyx_v_value, __pyx_v_t, __pyx_v_order_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict._PTreeNode_unpickler");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":506
 *     return newPTreeNodeExact(value, t, order_pos)
 * 
 * cdef inline newPTreeNodeExact(value, int t, size_t order_pos):             # <<<<<<<<<<<<<<
 * 
 *     cdef _PTreeNode pn = createPTreeNode(_PTreeNode)
 */

static CYTHON_INLINE PyObject *__pyx_f_8treedict_8treedict_newPTreeNodeExact(PyObject *__pyx_v_value, int __pyx_v_t, size_t __pyx_v_order_pos) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("newPTreeNodeExact");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":508
 * cdef inline newPTreeNodeExact(value, int t, size_t order_pos):
 * 
 *     cdef _PTreeNode pn = createPTreeNode(_PTreeNode)             # <<<<<<<<<<<<<<
 *     pn._v = value
 *     pn._t = t
 */
  __pyx_t_1 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict__PTreeNode)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":509
 * 
 *     cdef _PTreeNode pn = createPTreeNode(_PTreeNode)
 *     pn._v = value             # <<<<<<<<<<<<<<
 *     pn._t = t
 *     pn._order_position = order_pos
 */
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_pn->_v);
  __Pyx_DECREF(__pyx_v_pn->_v);
  __pyx_v_pn->_v = __pyx_v_value;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":510
 *     cdef _PTreeNode pn = createPTreeNode(_PTreeNode)
 *     pn._v = value
 *     pn._t = t             # <<<<<<<<<<<<<<
 *     pn._order_position = order_pos
 *     pn._aux_dict = {}
 */
  __pyx_v_pn->_t = __pyx_v_t;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":511
 *     pn._v = value
 *     pn._t = t
 *     pn._order_position = order_pos             # <<<<<<<<<<<<<<
 *     pn._aux_dict = {}
 *     return pn
 */
  __pyx_v_pn->_order_position = __pyx_v_order_pos;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":512
 *     pn._t = t
 *     pn._order_position = order_pos
 *     pn._aux_dict = {}             # <<<<<<<<<<<<<<
 *     return pn
 * 
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_v_pn->_aux_dict);
  __Pyx_DECREF(((PyObject *)__pyx_v_pn->_aux_dict));
  __pyx_v_pn->_aux_dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":513
 *     pn._order_position = order_pos
 *     pn._aux_dict = {}
 *     return pn             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_pn));
  __pyx_r = ((PyObject *)__pyx_v_pn);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.newPTreeNodeExact");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":555
 *     cdef bint _first_iter_run_yet
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._pos_array = NULL
 * 
 */

static int __pyx_pf_8treedict_8treedict_16TreeDictIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_8treedict_8treedict_16TreeDictIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  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;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":556
 * 
 *     def __cinit__(self):
 *         self._pos_array = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_v_self)->_pos_array = NULL;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":558
 *         self._pos_array = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._pos_array != NULL:
 *             PyMem_Free(self._pos_array)
 */

static void __pyx_pf_8treedict_8treedict_16TreeDictIterator___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_8treedict_8treedict_16TreeDictIterator___dealloc__(PyObject *__pyx_v_self) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":559
 * 
 *     def __dealloc__(self):
 *         if self._pos_array != NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self._pos_array)
 * 
 */
  __pyx_t_1 = (((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_v_self)->_pos_array != NULL);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":560
 *     def __dealloc__(self):
 *         if self._pos_array != NULL:
 *             PyMem_Free(self._pos_array)             # <<<<<<<<<<<<<<
 * 
 *         if self._stop_on_next:
 */
    PyMem_Free(((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_v_self)->_pos_array);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":562
 *             PyMem_Free(self._pos_array)
 * 
 *         if self._stop_on_next:             # <<<<<<<<<<<<<<
 *             return
 *         else:
 */
  if (((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_v_self)->_stop_on_next) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":563
 * 
 *         if self._stop_on_next:
 *             return             # <<<<<<<<<<<<<<
 *         else:
 *             while self.goDownStack():
 */
    goto __pyx_L0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":565
 *             return
 *         else:
 *             while self.goDownStack():             # <<<<<<<<<<<<<<
 *                 pass
 * 
 */
    while (1) {
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_v_self)->__pyx_vtab)->goDownStack(((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_v_self));
      if (!__pyx_t_1) break;
    }

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":568
 *                 pass
 * 
 *             self._decRefToCurTree(0)             # <<<<<<<<<<<<<<
 * 
 *             if RUN_ASSERTS:
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_v_self)->__pyx_vtab)->_decRefToCurTree(((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_v_self), 0);
  }
  __pyx_L6:;

  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":573
 *                 assert not self._base_treedict_referenced
 * 
 *     cdef void _init(self, TreeDict p, bint _recursive,             # <<<<<<<<<<<<<<
 *                     int _branch_mode, int _itertype):
 * 
 */

static  void __pyx_f_8treedict_8treedict_16TreeDictIterator__init(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_self, struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p, int __pyx_v__recursive, int __pyx_v__branch_mode, int __pyx_v__itertype) {
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_init");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":576
 *                     int _branch_mode, int _itertype):
 * 
 *         self._recursive   = _recursive             # <<<<<<<<<<<<<<
 *         self._branch_mode = _branch_mode
 *         self._itertype    = _itertype
 */
  __pyx_v_self->_recursive = __pyx_v__recursive;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":577
 * 
 *         self._recursive   = _recursive
 *         self._branch_mode = _branch_mode             # <<<<<<<<<<<<<<
 *         self._itertype    = _itertype
 * 
 */
  __pyx_v_self->_branch_mode = __pyx_v__branch_mode;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":578
 *         self._recursive   = _recursive
 *         self._branch_mode = _branch_mode
 *         self._itertype    = _itertype             # <<<<<<<<<<<<<<
 * 
 *         # Allocate space for the position stack
 */
  __pyx_v_self->_itertype = __pyx_v__itertype;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":581
 * 
 *         # Allocate space for the position stack
 *         self._pos_array_size = 16             # <<<<<<<<<<<<<<
 *         self._pos_array = <Py_ssize_t*> PyMem_Malloc(self._pos_array_size*sizeof(Py_ssize_t*))
 * 
 */
  __pyx_v_self->_pos_array_size = 16;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":582
 *         # Allocate space for the position stack
 *         self._pos_array_size = 16
 *         self._pos_array = <Py_ssize_t*> PyMem_Malloc(self._pos_array_size*sizeof(Py_ssize_t*))             # <<<<<<<<<<<<<<
 * 
 *         if self._pos_array == NULL:
 */
  __pyx_v_self->_pos_array = ((Py_ssize_t *)PyMem_Malloc((__pyx_v_self->_pos_array_size * (sizeof(Py_ssize_t *)))));

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":584
 *         self._pos_array = <Py_ssize_t*> PyMem_Malloc(self._pos_array_size*sizeof(Py_ssize_t*))
 * 
 *         if self._pos_array == NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_pos_array == NULL);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":585
 * 
 *         if self._pos_array == NULL:
 *             raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         self._cur_pt = p
 */
    __Pyx_Raise(__pyx_builtin_MemoryError, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":587
 *             raise MemoryError
 * 
 *         self._cur_pt = p             # <<<<<<<<<<<<<<
 *         self._incRefToCurTree(0)
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_p));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
  __Pyx_GOTREF(__pyx_v_self->_cur_pt);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_cur_pt));
  __pyx_v_self->_cur_pt = __pyx_v_p;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":588
 * 
 *         self._cur_pt = p
 *         self._incRefToCurTree(0)             # <<<<<<<<<<<<<<
 * 
 *         self._pos_array[0] = 0
 */
  ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->_incRefToCurTree(__pyx_v_self, 0);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":590
 *         self._incRefToCurTree(0)
 * 
 *         self._pos_array[0] = 0             # <<<<<<<<<<<<<<
 *         self._key_stack    = []
 * 
 */
  (__pyx_v_self->_pos_array[0]) = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":591
 * 
 *         self._pos_array[0] = 0
 *         self._key_stack    = []             # <<<<<<<<<<<<<<
 * 
 *         self._cur_depth    = 0
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __Pyx_GOTREF(__pyx_v_self->_key_stack);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_key_stack));
  __pyx_v_self->_key_stack = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":593
 *         self._key_stack    = []
 * 
 *         self._cur_depth    = 0             # <<<<<<<<<<<<<<
 * 
 *         self._last_key     = None
 */
  __pyx_v_self->_cur_depth = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":595
 *         self._cur_depth    = 0
 * 
 *         self._last_key     = None             # <<<<<<<<<<<<<<
 *         self._current_key  = None
 *         self._last_pn      = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_last_key);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_last_key));
  __pyx_v_self->_last_key = ((PyObject *)Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":596
 * 
 *         self._last_key     = None
 *         self._current_key  = None             # <<<<<<<<<<<<<<
 *         self._last_pn      = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_current_key);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_current_key));
  __pyx_v_self->_current_key = ((PyObject *)Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":597
 *         self._last_key     = None
 *         self._current_key  = None
 *         self._last_pn      = None             # <<<<<<<<<<<<<<
 * 
 *         # This is what will be returned; we keep one step ahead so the
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_last_pn);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_last_pn));
  __pyx_v_self->_last_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":601
 *         # This is what will be returned; we keep one step ahead so the
 *         # lock on the TreeDict is released on the final iteration.
 *         self._next_return_value  = None             # <<<<<<<<<<<<<<
 *         self._stop_on_next = False
 *         self._first_iter_run_yet = False
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_next_return_value);
  __Pyx_DECREF(__pyx_v_self->_next_return_value);
  __pyx_v_self->_next_return_value = Py_None;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":602
 *         # lock on the TreeDict is released on the final iteration.
 *         self._next_return_value  = None
 *         self._stop_on_next = False             # <<<<<<<<<<<<<<
 *         self._first_iter_run_yet = False
 * 
 */
  __pyx_v_self->_stop_on_next = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":603
 *         self._next_return_value  = None
 *         self._stop_on_next = False
 *         self._first_iter_run_yet = False             # <<<<<<<<<<<<<<
 * 
 *     cdef void _ensurePosArraySized(self, size_t n):
 */
  __pyx_v_self->_first_iter_run_yet = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDictIterator._init");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":605
 *         self._first_iter_run_yet = False
 * 
 *     cdef void _ensurePosArraySized(self, size_t n):             # <<<<<<<<<<<<<<
 *         if self._pos_array_size <= n:
 *             self._pos_array_size = n + (n >> 1)
 */

static  void __pyx_f_8treedict_8treedict_16TreeDictIterator__ensurePosArraySized(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_self, size_t __pyx_v_n) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_ensurePosArraySized");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":606
 * 
 *     cdef void _ensurePosArraySized(self, size_t n):
 *         if self._pos_array_size <= n:             # <<<<<<<<<<<<<<
 *             self._pos_array_size = n + (n >> 1)
 *             self._pos_array = <Py_ssize_t*>PyMem_Realloc(self._pos_array, self._pos_array_size*sizeof(Py_ssize_t*))
 */
  __pyx_t_1 = (__pyx_v_self->_pos_array_size <= __pyx_v_n);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":607
 *     cdef void _ensurePosArraySized(self, size_t n):
 *         if self._pos_array_size <= n:
 *             self._pos_array_size = n + (n >> 1)             # <<<<<<<<<<<<<<
 *             self._pos_array = <Py_ssize_t*>PyMem_Realloc(self._pos_array, self._pos_array_size*sizeof(Py_ssize_t*))
 * 
 */
    __pyx_v_self->_pos_array_size = (__pyx_v_n + (__pyx_v_n >> 1));

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":608
 *         if self._pos_array_size <= n:
 *             self._pos_array_size = n + (n >> 1)
 *             self._pos_array = <Py_ssize_t*>PyMem_Realloc(self._pos_array, self._pos_array_size*sizeof(Py_ssize_t*))             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    __pyx_v_self->_pos_array = ((Py_ssize_t *)PyMem_Realloc(__pyx_v_self->_pos_array, (__pyx_v_self->_pos_array_size * (sizeof(Py_ssize_t *)))));
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":610
 *             self._pos_array = <Py_ssize_t*>PyMem_Realloc(self._pos_array, self._pos_array_size*sizeof(Py_ssize_t*))
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

static PyObject *__pyx_pf_8treedict_8treedict_16TreeDictIterator___iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_16TreeDictIterator___iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":611
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":613
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         # Iterator interface for these functions
 *         return self._next()
 */

static PyObject *__pyx_pf_8treedict_8treedict_16TreeDictIterator___next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_16TreeDictIterator___next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__next__");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":615
 *     def __next__(self):
 *         # Iterator interface for these functions
 *         return self._next()             # <<<<<<<<<<<<<<
 * 
 *     cdef _next(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_v_self)->__pyx_vtab)->_next(((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDictIterator.__next__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":617
 *         return self._next()
 * 
 *     cdef _next(self):             # <<<<<<<<<<<<<<
 * 
 *         if self._stop_on_next:
 */

static  PyObject *__pyx_f_8treedict_8treedict_16TreeDictIterator__next(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_self) {
  PyObject *__pyx_v_r;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_next");
  __pyx_v_r = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":619
 *     cdef _next(self):
 * 
 *         if self._stop_on_next:             # <<<<<<<<<<<<<<
 *             if RUN_ASSERTS:
 *                 assert not self._base_treedict_referenced
 */
  if (__pyx_v_self->_stop_on_next) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":623
 *                 assert not self._base_treedict_referenced
 * 
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *         r = self._next_return_value
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":625
 *             raise StopIteration
 * 
 *         r = self._next_return_value             # <<<<<<<<<<<<<<
 * 
 *         if self._loadNext():
 */
  __Pyx_INCREF(__pyx_v_self->_next_return_value);
  __Pyx_DECREF(__pyx_v_r);
  __pyx_v_r = __pyx_v_self->_next_return_value;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":627
 *         r = self._next_return_value
 * 
 *         if self._loadNext():             # <<<<<<<<<<<<<<
 *             self._next_return_value = self._currentRetValue()
 *         else:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->_loadNext(__pyx_v_self);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":628
 * 
 *         if self._loadNext():
 *             self._next_return_value = self._currentRetValue()             # <<<<<<<<<<<<<<
 *         else:
 *             if RUN_ASSERTS:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->_currentRetValue(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->_next_return_value);
    __Pyx_DECREF(__pyx_v_self->_next_return_value);
    __pyx_v_self->_next_return_value = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":633
 *                 assert not self._base_treedict_referenced
 * 
 *             self._stop_on_next = True             # <<<<<<<<<<<<<<
 * 
 *         if not self._first_iter_run_yet:
 */
    __pyx_v_self->_stop_on_next = 1;
  }
  __pyx_L4:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":635
 *             self._stop_on_next = True
 * 
 *         if not self._first_iter_run_yet:             # <<<<<<<<<<<<<<
 *             self._first_iter_run_yet = True
 *             return self._next()
 */
  __pyx_t_1 = (!__pyx_v_self->_first_iter_run_yet);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":636
 * 
 *         if not self._first_iter_run_yet:
 *             self._first_iter_run_yet = True             # <<<<<<<<<<<<<<
 *             return self._next()
 *         else:
 */
    __pyx_v_self->_first_iter_run_yet = 1;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":637
 *         if not self._first_iter_run_yet:
 *             self._first_iter_run_yet = True
 *             return self._next()             # <<<<<<<<<<<<<<
 *         else:
 *             return r
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->_next(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":639
 *             return self._next()
 *         else:
 *             return r             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _loadNext(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_r);
    __pyx_r = __pyx_v_r;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDictIterator._next");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_r);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":641
 *             return r
 * 
 *     cdef bint _loadNext(self):             # <<<<<<<<<<<<<<
 * 
 *         cdef PyObject *k_obj, *pn_obj
 */

static  int __pyx_f_8treedict_8treedict_16TreeDictIterator__loadNext(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_self) {
  PyObject *__pyx_v_k_obj;
  PyObject *__pyx_v_pn_obj;
  int __pyx_v_iter_going;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_loadNext");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":646
 *         cdef bint iter_going
 * 
 *         while True:             # <<<<<<<<<<<<<<
 *             iter_going = PyDict_Next(self._cur_pt._param_dict, &self._pos_array[self._cur_depth], &k_obj, &pn_obj)
 * 
 */
  while (1) {
    if (!1) break;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":647
 * 
 *         while True:
 *             iter_going = PyDict_Next(self._cur_pt._param_dict, &self._pos_array[self._cur_depth], &k_obj, &pn_obj)             # <<<<<<<<<<<<<<
 * 
 *             if not iter_going:
 */
    __pyx_v_iter_going = PyDict_Next(__pyx_v_self->_cur_pt->_param_dict, (&(__pyx_v_self->_pos_array[__pyx_v_self->_cur_depth])), (&__pyx_v_k_obj), (&__pyx_v_pn_obj));

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":649
 *             iter_going = PyDict_Next(self._cur_pt._param_dict, &self._pos_array[self._cur_depth], &k_obj, &pn_obj)
 * 
 *             if not iter_going:             # <<<<<<<<<<<<<<
 *                 if not self.goDownStack():
 *                     self._last_key = None
 */
    __pyx_t_1 = (!__pyx_v_iter_going);
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":650
 * 
 *             if not iter_going:
 *                 if not self.goDownStack():             # <<<<<<<<<<<<<<
 *                     self._last_key = None
 *                     self._last_pn  = None
 */
      __pyx_t_1 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->goDownStack(__pyx_v_self));
      if (__pyx_t_1) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":651
 *             if not iter_going:
 *                 if not self.goDownStack():
 *                     self._last_key = None             # <<<<<<<<<<<<<<
 *                     self._last_pn  = None
 * 
 */
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->_last_key);
        __Pyx_DECREF(((PyObject *)__pyx_v_self->_last_key));
        __pyx_v_self->_last_key = ((PyObject *)Py_None);

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":652
 *                 if not self.goDownStack():
 *                     self._last_key = None
 *                     self._last_pn  = None             # <<<<<<<<<<<<<<
 * 
 *                     self._decRefToCurTree(0)
 */
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->_last_pn);
        __Pyx_DECREF(((PyObject *)__pyx_v_self->_last_pn));
        __pyx_v_self->_last_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None);

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":654
 *                     self._last_pn  = None
 * 
 *                     self._decRefToCurTree(0)             # <<<<<<<<<<<<<<
 *                     return False
 *                 else:
 */
        ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->_decRefToCurTree(__pyx_v_self, 0);

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":655
 * 
 *                     self._decRefToCurTree(0)
 *                     return False             # <<<<<<<<<<<<<<
 *                 else:
 *                     continue
 */
        __pyx_r = 0;
        goto __pyx_L0;
        goto __pyx_L6;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":657
 *                     return False
 *                 else:
 *                     continue             # <<<<<<<<<<<<<<
 *             else:
 *                 self._last_key = (<str>k_obj)
 */
        goto __pyx_L3_continue;
      }
      __pyx_L6:;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":659
 *                     continue
 *             else:
 *                 self._last_key = (<str>k_obj)             # <<<<<<<<<<<<<<
 *                 self._last_pn  = (<_PTreeNode>pn_obj)
 * 
 */
      __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_v_k_obj)));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_k_obj));
      __Pyx_GOTREF(__pyx_v_self->_last_key);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_last_key));
      __pyx_v_self->_last_key = ((PyObject *)__pyx_v_k_obj);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":660
 *             else:
 *                 self._last_key = (<str>k_obj)
 *                 self._last_pn  = (<_PTreeNode>pn_obj)             # <<<<<<<<<<<<<<
 * 
 *             if self._last_pn.isBranch():
 */
      __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_v_pn_obj)));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_pn_obj));
      __Pyx_GOTREF(__pyx_v_self->_last_pn);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_last_pn));
      __pyx_v_self->_last_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_v_pn_obj);
    }
    __pyx_L5:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":662
 *                 self._last_pn  = (<_PTreeNode>pn_obj)
 * 
 *             if self._last_pn.isBranch():             # <<<<<<<<<<<<<<
 * 
 *                 if self._last_pn.isDanglingBranch():
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_self->_last_pn->__pyx_vtab)->isBranch(__pyx_v_self->_last_pn);
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":664
 *             if self._last_pn.isBranch():
 * 
 *                 if self._last_pn.isDanglingBranch():             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_self->_last_pn->__pyx_vtab)->isDanglingBranch(__pyx_v_self->_last_pn);
      if (__pyx_t_1) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":665
 * 
 *                 if self._last_pn.isDanglingBranch():
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 if self._branch_mode != i_BranchMode_None:
 */
        goto __pyx_L3_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":667
 *                     continue
 * 
 *                 if self._branch_mode != i_BranchMode_None:             # <<<<<<<<<<<<<<
 * 
 *                     self._setCurrentKey()  # Call before the recursion
 */
      __pyx_t_1 = (__pyx_v_self->_branch_mode != 2);
      if (__pyx_t_1) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":669
 *                 if self._branch_mode != i_BranchMode_None:
 * 
 *                     self._setCurrentKey()  # Call before the recursion             # <<<<<<<<<<<<<<
 * 
 *                     if self._recursive:
 */
        ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->_setCurrentKey(__pyx_v_self);

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":671
 *                     self._setCurrentKey()  # Call before the recursion
 * 
 *                     if self._recursive:             # <<<<<<<<<<<<<<
 *                         self.goUpStack(self._last_key, self._last_pn.tree())
 * 
 */
        if (__pyx_v_self->_recursive) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":672
 * 
 *                     if self._recursive:
 *                         self.goUpStack(self._last_key, self._last_pn.tree())             # <<<<<<<<<<<<<<
 * 
 *                     return True
 */
          __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_self->_last_pn->__pyx_vtab)->tree(__pyx_v_self->_last_pn)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->goUpStack(__pyx_v_self, __pyx_v_self->_last_key, ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2));
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L10;
        }
        __pyx_L10:;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":674
 *                         self.goUpStack(self._last_key, self._last_pn.tree())
 * 
 *                     return True             # <<<<<<<<<<<<<<
 * 
 *                 else:
 */
        __pyx_r = 1;
        goto __pyx_L0;
        goto __pyx_L9;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":677
 * 
 *                 else:
 *                     if self._recursive:             # <<<<<<<<<<<<<<
 *                         self.goUpStack(self._last_key, self._last_pn.tree())
 * 
 */
        if (__pyx_v_self->_recursive) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":678
 *                 else:
 *                     if self._recursive:
 *                         self.goUpStack(self._last_key, self._last_pn.tree())             # <<<<<<<<<<<<<<
 * 
 *                     continue
 */
          __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_self->_last_pn->__pyx_vtab)->tree(__pyx_v_self->_last_pn)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->goUpStack(__pyx_v_self, __pyx_v_self->_last_key, ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2));
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L11;
        }
        __pyx_L11:;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":680
 *                         self.goUpStack(self._last_key, self._last_pn.tree())
 * 
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *             elif self._branch_mode == i_BranchMode_Only:
 */
        goto __pyx_L3_continue;
      }
      __pyx_L9:;
      goto __pyx_L7;
    }

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":682
 *                     continue
 * 
 *             elif self._branch_mode == i_BranchMode_Only:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_1 = (__pyx_v_self->_branch_mode == 3);
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":683
 * 
 *             elif self._branch_mode == i_BranchMode_Only:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             self._setCurrentKey()
 */
      goto __pyx_L3_continue;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":685
 *                 continue
 * 
 *             self._setCurrentKey()             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->_setCurrentKey(__pyx_v_self);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":686
 * 
 *             self._setCurrentKey()
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     cdef void goUpStack(self, str k, TreeDict p):
 */
    __pyx_r = 1;
    goto __pyx_L0;
    __pyx_L3_continue:;
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDictIterator._loadNext");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":688
 *             return True
 * 
 *     cdef void goUpStack(self, str k, TreeDict p):             # <<<<<<<<<<<<<<
 *         self._cur_depth += 1
 * 
 */

static  void __pyx_f_8treedict_8treedict_16TreeDictIterator_goUpStack(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_self, PyObject *__pyx_v_k, struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p) {
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("goUpStack");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":689
 * 
 *     cdef void goUpStack(self, str k, TreeDict p):
 *         self._cur_depth += 1             # <<<<<<<<<<<<<<
 * 
 *         self._ensurePosArraySized(self._cur_depth)
 */
  __pyx_v_self->_cur_depth += 1;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":691
 *         self._cur_depth += 1
 * 
 *         self._ensurePosArraySized(self._cur_depth)             # <<<<<<<<<<<<<<
 *         self._pos_array[self._cur_depth] = 0
 *         self._cur_pt = p
 */
  ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->_ensurePosArraySized(__pyx_v_self, __pyx_v_self->_cur_depth);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":692
 * 
 *         self._ensurePosArraySized(self._cur_depth)
 *         self._pos_array[self._cur_depth] = 0             # <<<<<<<<<<<<<<
 *         self._cur_pt = p
 *         self._incRefToCurTree(self._cur_depth)
 */
  (__pyx_v_self->_pos_array[__pyx_v_self->_cur_depth]) = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":693
 *         self._ensurePosArraySized(self._cur_depth)
 *         self._pos_array[self._cur_depth] = 0
 *         self._cur_pt = p             # <<<<<<<<<<<<<<
 *         self._incRefToCurTree(self._cur_depth)
 *         self._key_stack.append(self._fullKey(k))
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_p));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
  __Pyx_GOTREF(__pyx_v_self->_cur_pt);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_cur_pt));
  __pyx_v_self->_cur_pt = __pyx_v_p;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":694
 *         self._pos_array[self._cur_depth] = 0
 *         self._cur_pt = p
 *         self._incRefToCurTree(self._cur_depth)             # <<<<<<<<<<<<<<
 *         self._key_stack.append(self._fullKey(k))
 * 
 */
  ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->_incRefToCurTree(__pyx_v_self, __pyx_v_self->_cur_depth);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":695
 *         self._cur_pt = p
 *         self._incRefToCurTree(self._cur_depth)
 *         self._key_stack.append(self._fullKey(k))             # <<<<<<<<<<<<<<
 * 
 *     cdef bint goDownStack(self):
 */
  if (unlikely(__pyx_v_self->_key_stack == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->_fullKey(__pyx_v_self, __pyx_v_k)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyList_Append(((PyObject *)__pyx_v_self->_key_stack), __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDictIterator.goUpStack");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":697
 *         self._key_stack.append(self._fullKey(k))
 * 
 *     cdef bint goDownStack(self):             # <<<<<<<<<<<<<<
 * 
 *         if self._cur_depth == 0:
 */

static  int __pyx_f_8treedict_8treedict_16TreeDictIterator_goDownStack(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_self) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("goDownStack");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":699
 *     cdef bint goDownStack(self):
 * 
 *         if self._cur_depth == 0:             # <<<<<<<<<<<<<<
 *             if RUN_ASSERTS:
 *                 assert len(self._key_stack) == 0
 */
  __pyx_t_1 = (__pyx_v_self->_cur_depth == 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":704
 * 
 *             # Asking to go down stack when we're on the only one
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         if RUN_ASSERTS:
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":710
 *             assert len(self._key_stack) != 0
 * 
 *         self._decRefToCurTree(self._cur_depth)             # <<<<<<<<<<<<<<
 *         self._cur_depth -= 1
 *         self._cur_pt = self._cur_pt.parentNode()
 */
  ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->_decRefToCurTree(__pyx_v_self, __pyx_v_self->_cur_depth);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":711
 * 
 *         self._decRefToCurTree(self._cur_depth)
 *         self._cur_depth -= 1             # <<<<<<<<<<<<<<
 *         self._cur_pt = self._cur_pt.parentNode()
 *         self._key_stack.pop()
 */
  __pyx_v_self->_cur_depth -= 1;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":712
 *         self._decRefToCurTree(self._cur_depth)
 *         self._cur_depth -= 1
 *         self._cur_pt = self._cur_pt.parentNode()             # <<<<<<<<<<<<<<
 *         self._key_stack.pop()
 * 
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->_cur_pt->__pyx_vtab)->parentNode(__pyx_v_self->_cur_pt, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_cur_pt);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_cur_pt));
  __pyx_v_self->_cur_pt = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":713
 *         self._cur_depth -= 1
 *         self._cur_pt = self._cur_pt.parentNode()
 *         self._key_stack.pop()             # <<<<<<<<<<<<<<
 * 
 *         return True
 */
  __pyx_t_2 = __Pyx_PyObject_Pop(((PyObject *)__pyx_v_self->_key_stack)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":715
 *         self._key_stack.pop()
 * 
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     # Split these two next steps so that we can handle going up a
 */
  __pyx_r = 1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDictIterator.goDownStack");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":719
 *     # Split these two next steps so that we can handle going up a
 *     # branch and also returning that branch
 *     cdef str currentKey(self):             # <<<<<<<<<<<<<<
 *         return self._current_key
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_16TreeDictIterator_currentKey(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("currentKey");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":720
 *     # branch and also returning that branch
 *     cdef str currentKey(self):
 *         return self._current_key             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setCurrentKey(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_current_key));
  __pyx_r = __pyx_v_self->_current_key;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":722
 *         return self._current_key
 * 
 *     cdef void _setCurrentKey(self):             # <<<<<<<<<<<<<<
 *         self._current_key = self._fullKey(self._last_key)
 * 
 */

static  void __pyx_f_8treedict_8treedict_16TreeDictIterator__setCurrentKey(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_self) {
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_setCurrentKey");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":723
 * 
 *     cdef void _setCurrentKey(self):
 *         self._current_key = self._fullKey(self._last_key)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _decRefToCurTree(self, size_t depth):
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->_fullKey(__pyx_v_self, __pyx_v_self->_last_key)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_current_key);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_current_key));
  __pyx_v_self->_current_key = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDictIterator._setCurrentKey");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":725
 *         self._current_key = self._fullKey(self._last_key)
 * 
 *     cdef void _decRefToCurTree(self, size_t depth):             # <<<<<<<<<<<<<<
 *         if depth == 0:
 *             if self._base_treedict_referenced:
 */

static  void __pyx_f_8treedict_8treedict_16TreeDictIterator__decRefToCurTree(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_self, size_t __pyx_v_depth) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_decRefToCurTree");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":726
 * 
 *     cdef void _decRefToCurTree(self, size_t depth):
 *         if depth == 0:             # <<<<<<<<<<<<<<
 *             if self._base_treedict_referenced:
 *                 self._cur_pt.iteratorDecRef()
 */
  __pyx_t_1 = (__pyx_v_depth == 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":727
 *     cdef void _decRefToCurTree(self, size_t depth):
 *         if depth == 0:
 *             if self._base_treedict_referenced:             # <<<<<<<<<<<<<<
 *                 self._cur_pt.iteratorDecRef()
 * 
 */
    if (__pyx_v_self->_base_treedict_referenced) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":728
 *         if depth == 0:
 *             if self._base_treedict_referenced:
 *                 self._cur_pt.iteratorDecRef()             # <<<<<<<<<<<<<<
 * 
 *             self._base_treedict_referenced = False
 */
      ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->_cur_pt->__pyx_vtab)->iteratorDecRef(__pyx_v_self->_cur_pt);
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":730
 *                 self._cur_pt.iteratorDecRef()
 * 
 *             self._base_treedict_referenced = False             # <<<<<<<<<<<<<<
 *         else:
 *             self._cur_pt.iteratorDecRef()
 */
    __pyx_v_self->_base_treedict_referenced = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":732
 *             self._base_treedict_referenced = False
 *         else:
 *             self._cur_pt.iteratorDecRef()             # <<<<<<<<<<<<<<
 * 
 *     cdef void _incRefToCurTree(self, size_t depth):
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->_cur_pt->__pyx_vtab)->iteratorDecRef(__pyx_v_self->_cur_pt);
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":734
 *             self._cur_pt.iteratorDecRef()
 * 
 *     cdef void _incRefToCurTree(self, size_t depth):             # <<<<<<<<<<<<<<
 *         self._cur_pt.iteratorIncRef()
 * 
 */

static  void __pyx_f_8treedict_8treedict_16TreeDictIterator__incRefToCurTree(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_self, size_t __pyx_v_depth) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_incRefToCurTree");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":735
 * 
 *     cdef void _incRefToCurTree(self, size_t depth):
 *         self._cur_pt.iteratorIncRef()             # <<<<<<<<<<<<<<
 * 
 *         if depth == 0:
 */
  ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->_cur_pt->__pyx_vtab)->iteratorIncRef(__pyx_v_self->_cur_pt);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":737
 *         self._cur_pt.iteratorIncRef()
 * 
 *         if depth == 0:             # <<<<<<<<<<<<<<
 *             self._base_treedict_referenced = True
 * 
 */
  __pyx_t_1 = (__pyx_v_depth == 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":738
 * 
 *         if depth == 0:
 *             self._base_treedict_referenced = True             # <<<<<<<<<<<<<<
 * 
 *     cdef _PTreeNode currentPTreeNode(self):
 */
    __pyx_v_self->_base_treedict_referenced = 1;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":740
 *             self._base_treedict_referenced = True
 * 
 *     cdef _PTreeNode currentPTreeNode(self):             # <<<<<<<<<<<<<<
 *         return self._last_pn
 * 
 */

static  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_f_8treedict_8treedict_16TreeDictIterator_currentPTreeNode(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_self) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("currentPTreeNode");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":741
 * 
 *     cdef _PTreeNode currentPTreeNode(self):
 *         return self._last_pn             # <<<<<<<<<<<<<<
 * 
 *     cdef _currentRetValue(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_last_pn));
  __pyx_r = __pyx_v_self->_last_pn;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":743
 *         return self._last_pn
 * 
 *     cdef _currentRetValue(self):             # <<<<<<<<<<<<<<
 *         if self._last_key is None or self._last_pn is None:
 *             return None
 */

static  PyObject *__pyx_f_8treedict_8treedict_16TreeDictIterator__currentRetValue(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  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;
  __Pyx_RefNannySetupContext("_currentRetValue");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":744
 * 
 *     cdef _currentRetValue(self):
 *         if self._last_key is None or self._last_pn is None:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_last_key == ((PyObject *)Py_None));
  if (!__pyx_t_1) {
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_last_pn) == Py_None);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":745
 *     cdef _currentRetValue(self):
 *         if self._last_key is None or self._last_pn is None:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         if self._itertype == i_Keys:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":747
 *             return None
 * 
 *         if self._itertype == i_Keys:             # <<<<<<<<<<<<<<
 *             return self.currentKey()
 *         elif self._itertype == i_Values:
 */
  switch (__pyx_v_self->_itertype) {
    case 2:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":748
 * 
 *         if self._itertype == i_Keys:
 *             return self.currentKey()             # <<<<<<<<<<<<<<
 *         elif self._itertype == i_Values:
 *             return self.currentPTreeNode().value()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->currentKey(__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    break;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":749
 *         if self._itertype == i_Keys:
 *             return self.currentKey()
 *         elif self._itertype == i_Values:             # <<<<<<<<<<<<<<
 *             return self.currentPTreeNode().value()
 *         elif self._itertype == i_Items:
 */
    case 3:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":750
 *             return self.currentKey()
 *         elif self._itertype == i_Values:
 *             return self.currentPTreeNode().value()             # <<<<<<<<<<<<<<
 *         elif self._itertype == i_Items:
 *             return (self.currentKey(), self.currentPTreeNode().value())
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->currentPTreeNode(__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_4)->__pyx_vtab)->value(((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    break;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":751
 *         elif self._itertype == i_Values:
 *             return self.currentPTreeNode().value()
 *         elif self._itertype == i_Items:             # <<<<<<<<<<<<<<
 *             return (self.currentKey(), self.currentPTreeNode().value())
 * 
 */
    case 1:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":752
 *             return self.currentPTreeNode().value()
 *         elif self._itertype == i_Items:
 *             return (self.currentKey(), self.currentPTreeNode().value())             # <<<<<<<<<<<<<<
 * 
 *     cdef str _fullKey(self, str k):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->currentKey(__pyx_v_self)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_self->__pyx_vtab)->currentPTreeNode(__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_4)->__pyx_vtab)->value(((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __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);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    break;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("treedict.treedict.TreeDictIterator._currentRetValue");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":754
 *             return (self.currentKey(), self.currentPTreeNode().value())
 * 
 *     cdef str _fullKey(self, str k):             # <<<<<<<<<<<<<<
 *         if len(self._key_stack) == 0:
 *             return k
 */

static  PyObject *__pyx_f_8treedict_8treedict_16TreeDictIterator__fullKey(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_self, PyObject *__pyx_v_k) {
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_fullKey");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":755
 * 
 *     cdef str _fullKey(self, str k):
 *         if len(self._key_stack) == 0:             # <<<<<<<<<<<<<<
 *             return k
 *         else:
 */
  if (unlikely(__pyx_v_self->_key_stack == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_self->_key_stack)); 
  __pyx_t_2 = (__pyx_t_1 == 0);
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":756
 *     cdef str _fullKey(self, str k):
 *         if len(self._key_stack) == 0:
 *             return k             # <<<<<<<<<<<<<<
 *         else:
 *             return (<str>self._key_stack[-1]) + '.' + k
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_k));
    __pyx_r = __pyx_v_k;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":758
 *             return k
 *         else:
 *             return (<str>self._key_stack[-1]) + '.' + k             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_self->_key_stack), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Add(__pyx_t_3, ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_v_k)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDictIterator._fullKey");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":782
 *         object __weakref__
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._run__cinit__()
 * 
 */

static int __pyx_pf_8treedict_8treedict_8TreeDict___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_8treedict_8treedict_8TreeDict___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__cinit__");
  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;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":783
 * 
 *     def __cinit__(self):
 *         self._run__cinit__()             # <<<<<<<<<<<<<<
 * 
 *     cdef _run__cinit__(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_run__cinit__(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":785
 *         self._run__cinit__()
 * 
 *     cdef _run__cinit__(self):             # <<<<<<<<<<<<<<
 * 
 *         # Split this off so the new style constructor can use them
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__run__cinit__(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_run__cinit__");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":788
 * 
 *         # Split this off so the new style constructor can use them
 *         self._param_dict = {}             # <<<<<<<<<<<<<<
 *         self._aux_dict = {}
 *         self._branches = []
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_v_self->_param_dict);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_param_dict));
  __pyx_v_self->_param_dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":789
 *         # Split this off so the new style constructor can use them
 *         self._param_dict = {}
 *         self._aux_dict = {}             # <<<<<<<<<<<<<<
 *         self._branches = []
 * 
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_v_self->_aux_dict);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_aux_dict));
  __pyx_v_self->_aux_dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":790
 *         self._param_dict = {}
 *         self._aux_dict = {}
 *         self._branches = []             # <<<<<<<<<<<<<<
 * 
 *         self._flags = 0
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_v_self->_branches);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_branches));
  __pyx_v_self->_branches = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":792
 *         self._branches = []
 * 
 *         self._flags = 0             # <<<<<<<<<<<<<<
 * 
 *         self._n_mutable = 0
 */
  __pyx_v_self->_flags = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":794
 *         self._flags = 0
 * 
 *         self._n_mutable = 0             # <<<<<<<<<<<<<<
 *         self._n_dangling = 0
 *         self._next_item_order_position = _orderNodeStartingValue
 */
  __pyx_v_self->_n_mutable = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":795
 * 
 *         self._n_mutable = 0
 *         self._n_dangling = 0             # <<<<<<<<<<<<<<
 *         self._next_item_order_position = _orderNodeStartingValue
 * 
 */
  __pyx_v_self->_n_dangling = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":796
 *         self._n_mutable = 0
 *         self._n_dangling = 0
 *         self._next_item_order_position = _orderNodeStartingValue             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, str tree_name = 'root', **kwargs):
 */
  __pyx_v_self->_next_item_order_position = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._run__cinit__");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":798
 *         self._next_item_order_position = _orderNodeStartingValue
 * 
 *     def __init__(self, str tree_name = 'root', **kwargs):             # <<<<<<<<<<<<<<
 *         self._run__init__(tree_name)
 * 
 */

static int __pyx_pf_8treedict_8treedict_8TreeDict___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_8treedict_8treedict_8TreeDict___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tree_name = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree_name,0};
  __Pyx_RefNannySetupContext("__init__");
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_n_s__root);
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree_name);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tree_name = ((PyObject *)values[0]);
  } else {
    __pyx_v_tree_name = ((PyObject *)__pyx_n_s__root);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_tree_name = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  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 = 798; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__init__");
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tree_name), &PyString_Type, 1, "tree_name", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":799
 * 
 *     def __init__(self, str tree_name = 'root', **kwargs):
 *         self._run__init__(tree_name)             # <<<<<<<<<<<<<<
 * 
 *         if len(kwargs) != 0:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_run__init__(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_tree_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":801
 *         self._run__init__(tree_name)
 * 
 *         if len(kwargs) != 0:             # <<<<<<<<<<<<<<
 *             self._setAll(None, kwargs, 0)
 * 
 */
  if (unlikely(__pyx_v_kwargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = PyDict_Size(((PyObject *)__pyx_v_kwargs)); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":802
 * 
 *         if len(kwargs) != 0:
 *             self._setAll(None, kwargs, 0)             # <<<<<<<<<<<<<<
 * 
 *     cdef _run__init__(self, str name):
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_setAll(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((PyObject *)Py_None), __pyx_v_kwargs, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":804
 *             self._setAll(None, kwargs, 0)
 * 
 *     cdef _run__init__(self, str name):             # <<<<<<<<<<<<<<
 * 
 *         # Split this off so the new style constructor can use it
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__run__init__(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("_run__init__");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":807
 * 
 *         # Split this off so the new style constructor can use it
 *         self._name = name             # <<<<<<<<<<<<<<
 * 
 *     cdef _setRegistered(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_name));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_name));
  __Pyx_GOTREF(__pyx_v_self->_name);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_name));
  __pyx_v_self->_name = __pyx_v_name;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":809
 *         self._name = name
 * 
 *     cdef _setRegistered(self):             # <<<<<<<<<<<<<<
 * 
 *         if RUN_ASSERTS:
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__setRegistered(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("_setRegistered");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":814
 *             assert not treeExists(self._name)
 * 
 *         self._setRegisteredFlag(True)             # <<<<<<<<<<<<<<
 * 
 *     ################################################################################
 */
  ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setRegisteredFlag(__pyx_v_self, 1);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":819
 *     # Parameters for manipulating the values
 * 
 *     def __setattr__(self, str k, v):             # <<<<<<<<<<<<<<
 *         try:
 *             self._setLocal(k, v, 0)
 */

static int __pyx_pf_8treedict_8treedict_8TreeDict___setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_k, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pf_8treedict_8treedict_8TreeDict___setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_k, PyObject *__pyx_v_v) {
  PyObject *__pyx_v_e;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__setattr__");
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_k), &PyString_Type, 1, "k", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":820
 * 
 *     def __setattr__(self, str k, v):
 *         try:             # <<<<<<<<<<<<<<
 *             self._setLocal(k, v, 0)
 *         except Exception, e:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":821
 *     def __setattr__(self, str k, v):
 *         try:
 *             self._setLocal(k, v, 0)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_setLocal(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_k, __pyx_v_v, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":822
 *         try:
 *             self._setLocal(k, v, 0)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.__setattr__");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":823
 *             self._setLocal(k, v, 0)
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, str k, v):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__setattr__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":825
 *             raise e
 * 
 *     def __setitem__(self, str k, v):             # <<<<<<<<<<<<<<
 *         try:
 *             self._set(k, v, 0)
 */

static int __pyx_pf_8treedict_8treedict_8TreeDict___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_k, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pf_8treedict_8treedict_8TreeDict___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_k, PyObject *__pyx_v_v) {
  PyObject *__pyx_v_e;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__setitem__");
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_k), &PyString_Type, 1, "k", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":826
 * 
 *     def __setitem__(self, str k, v):
 *         try:             # <<<<<<<<<<<<<<
 *             self._set(k, v, 0)
 *         except Exception, e:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":827
 *     def __setitem__(self, str k, v):
 *         try:
 *             self._set(k, v, 0)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_set(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_k, __pyx_v_v, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":828
 *         try:
 *             self._set(k, v, 0)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.__setitem__");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":829
 *             self._set(k, v, 0)
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     def setFromString(self, str key, str value, dict extra_variables = {}):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__setitem__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":831
 *             raise e
 * 
 *     def setFromString(self, str key, str value, dict extra_variables = {}):             # <<<<<<<<<<<<<<
 *         """
 *         A convenience function for setting arguments from sources in
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_setFromString(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_setFromString[] = "\n        A convenience function for setting arguments from sources in\n        which a python type or expression is embedded inside a string\n        (e.g. arguments given on the command line).\n\n        For example::\n\n          p.setFromString('a', '(1,2,3)')\n\n        would set ``p.a`` to ``(1,2,3)``, a python tuple.\n\n        Internally, this is done by trying to evaluate `value` as a\n        python string, and returning a simple string if an error\n        occurs.  `extra_variables` is passed to `eval()` to provide\n        additional variables for evaluating the string.  Users wanting\n        more sophistication should avoid this method.\n\n        Returns True if the value was translated successfully and\n        False otherwise.\n\n        Example::\n\n            >>> from treedict import TreeDict\n            >>> t = TreeDict()\n            >>> t.setFromString('x', '1')\n            True\n            >>> t.setFromString('y', '(1,2,[\"abc\",None])') \n            True\n            >>> t.setFromString('z', '{\"abc\" : 1}')\n            True\n            >>> print t.makeReport()\n            x = 1\n            y = (1, 2, ['abc', None])\n            z = {'abc': 1}\n        \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_setFromString(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_extra_variables = 0;
  PyObject *__pyx_v_v;
  int __pyx_v_ret_status;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__value,&__pyx_n_s__extra_variables,0};
  __Pyx_RefNannySetupContext("setFromString");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = __pyx_k_13;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("setFromString", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__extra_variables);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setFromString") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = ((PyObject *)values[0]);
    __pyx_v_value = ((PyObject *)values[1]);
    __pyx_v_extra_variables = ((PyObject *)values[2]);
  } else {
    __pyx_v_extra_variables = __pyx_k_13;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_extra_variables = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 2));
      case  2:
      __pyx_v_value = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 1));
      __pyx_v_key = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFromString", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.setFromString");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), &PyString_Type, 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value), &PyString_Type, 1, "value", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_variables), &PyDict_Type, 1, "extra_variables", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":869
 *         """
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             v = eval(value.strip(), extra_variables)
 *             ret_status = True
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":870
 * 
 *         try:
 *             v = eval(value.strip(), extra_variables)             # <<<<<<<<<<<<<<
 *             ret_status = True
 *         except Exception:
 */
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_value), __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_extra_variables));
      PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_extra_variables));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_extra_variables));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_builtin_eval, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":871
 *         try:
 *             v = eval(value.strip(), extra_variables)
 *             ret_status = True             # <<<<<<<<<<<<<<
 *         except Exception:
 *             v = value
 */
      __pyx_v_ret_status = 1;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":872
 *             v = eval(value.strip(), extra_variables)
 *             ret_status = True
 *         except Exception:             # <<<<<<<<<<<<<<
 *             v = value
 *             ret_status = False
 */
    __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_3) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.setFromString");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":873
 *             ret_status = True
 *         except Exception:
 *             v = value             # <<<<<<<<<<<<<<
 *             ret_status = False
 * 
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_value));
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = ((PyObject *)__pyx_v_value);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":874
 *         except Exception:
 *             v = value
 *             ret_status = False             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
      __pyx_v_ret_status = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":876
 *             ret_status = False
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._set(key, v, 0)
 *         except Exception, e:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":877
 * 
 *         try:
 *             self._set(key, v, 0)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_set(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key, __pyx_v_v, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L23_try_end;
    __pyx_L16_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":878
 *         try:
 *             self._set(key, v, 0)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_3) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.setFromString");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_1;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":879
 *             self._set(key, v, 0)
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *         return ret_status
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L17_exception_handled;
    }
    __pyx_L18_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L17_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L23_try_end:;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":881
 *             raise e
 * 
 *         return ret_status             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_ret_status); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.setFromString");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":884
 * 
 *     @classmethod
 *     def fromkeys(cls, key_iterable, value = None):             # <<<<<<<<<<<<<<
 *         """
 *         Creates a new TreeDict instance populated by setting the keys
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_fromkeys(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_fromkeys[] = "\n        Creates a new TreeDict instance populated by setting the keys\n        in `key_iterable` to `value`, which defaults to None.\n\n        This behavior is analagous to the fromkeys() method of dict.\n\n        Example 1::\n\n            >>> from treedict import TreeDict\n            >>> t = TreeDict.fromkeys(['a', 'b', 'c'])\n            >>> print t.makeReport()\n            a = None\n            c = None\n            b = None\n\n        Example 2::\n        \n            >>> from treedict import TreeDict\n            >>> t = TreeDict.fromkeys('abc', 'abc')\n            >>> print t.makeReport()\n            a = 'abc'\n            c = 'abc'\n            b = 'abc'\n\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_fromkeys(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key_iterable = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key_iterable,&__pyx_n_s__value,0};
  __Pyx_RefNannySetupContext("fromkeys");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key_iterable);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fromkeys") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key_iterable = values[0];
    __pyx_v_value = values[1];
  } else {
    __pyx_v_value = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_key_iterable = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fromkeys", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.fromkeys");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":911
 *         """
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return TreeDict.fromdict(dict.fromkeys(key_iterable, value))
 *         except Exception, e:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":912
 * 
 *         try:
 *             return TreeDict.fromdict(dict.fromkeys(key_iterable, value))             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict_TreeDict)), __pyx_n_s__fromdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)&PyDict_Type)), __pyx_n_s__fromkeys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_key_iterable);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key_iterable);
      __Pyx_GIVEREF(__pyx_v_key_iterable);
      __Pyx_INCREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L10_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":913
 *         try:
 *             return TreeDict.fromdict(dict.fromkeys(key_iterable, value))
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.fromkeys");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":914
 *             return TreeDict.fromdict(dict.fromkeys(key_iterable, value))
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.fromkeys");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":917
 * 
 *     @classmethod
 *     def fromdict(cls, d):             # <<<<<<<<<<<<<<
 *         """
 *         A convenience method that creates a new TreeDict instance from
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_fromdict(PyObject *__pyx_v_cls, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_fromdict[] = "\n        A convenience method that creates a new TreeDict instance from\n        a dictionary or other object convertable to a dictionary.\n        This is analagous to the :meth:`fromkeys()` method, except that the\n        keys and associated values are given by a dictionary.  It is\n        equivalent to::\n\n           t = TreeDict()\n           t.update(d)\n           return t\n\n        Example::\n\n            >>> from treedict import TreeDict\n            >>> t = TreeDict.fromdict({'a.x' : 1, 'a.y' : 2, 'z' : 3})\n            >>> print t.makeReport()\n            z   = 3\n            a.x = 1\n            a.y = 2\n        \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_fromdict(PyObject *__pyx_v_cls, PyObject *__pyx_v_d) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p = 0;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("fromdict");
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":940
 *         """
 * 
 *         cdef TreeDict p = newTreeDict(None, False)             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8treedict_8treedict_newTreeDict(((PyObject *)Py_None), 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":942
 *         cdef TreeDict p = newTreeDict(None, False)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             p._setAll(None, d, 0)
 *             return p
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":943
 * 
 *         try:
 *             p._setAll(None, d, 0)             # <<<<<<<<<<<<<<
 *             return p
 *         except Exception, e:
 */
      if (!(likely(PyDict_CheckExact(__pyx_v_d))||((__pyx_v_d) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_v_d)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_setAll(__pyx_v_p, ((PyObject *)Py_None), ((PyObject *)__pyx_v_d), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":944
 *         try:
 *             p._setAll(None, d, 0)
 *             return p             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_p));
      __pyx_r = ((PyObject *)__pyx_v_p);
      goto __pyx_L9_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L9_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":945
 *             p._setAll(None, d, 0)
 *             return p
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.fromdict");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":946
 *             return p
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     def setdefault(self, str key, value = None):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.fromdict");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_p);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":948
 *             raise e
 * 
 *     def setdefault(self, str key, value = None):             # <<<<<<<<<<<<<<
 *         """
 *         If `key` does not exist, sets `key` eqaul to `value`, which
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_setdefault(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_setdefault[] = "\n        If `key` does not exist, sets `key` eqaul to `value`, which\n        defaults to None.  Returns `value` if `key` was changed;\n        otherwise returns the original value.\n\n        This behavior is analagous to the `setdefault()` method of dict.\n\n        Example::\n\n            >>> from treedict import TreeDict\n            >>> t = TreeDict(x = 1)\n            >>> print t.makeReport()\n            x = 1\n            >>> t.setdefault('x', 2)\n            1\n            >>> t.setdefault('y', 2)\n            2\n            >>> print t.makeReport()\n            x = 1\n            y = 2\n            \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_setdefault(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__value,0};
  __Pyx_RefNannySetupContext("setdefault");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setdefault") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = ((PyObject *)values[0]);
    __pyx_v_value = values[1];
  } else {
    __pyx_v_value = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_key = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  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 = 948; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.setdefault");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), &PyString_Type, 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":972
 *         """
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if not self._exists(key, False):
 *                 self._set(key, value, 0)
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":973
 * 
 *         try:
 *             if not self._exists(key, False):             # <<<<<<<<<<<<<<
 *                 self._set(key, value, 0)
 *                 return value
 */
      __pyx_t_1 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_exists(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key, 0));
      if (__pyx_t_1) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":974
 *         try:
 *             if not self._exists(key, False):
 *                 self._set(key, value, 0)             # <<<<<<<<<<<<<<
 *                 return value
 *             else:
 */
        __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_set(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key, __pyx_v_value, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":975
 *             if not self._exists(key, False):
 *                 self._set(key, value, 0)
 *                 return value             # <<<<<<<<<<<<<<
 *             else:
 *                 return self._get(key, False)
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_value);
        __pyx_r = __pyx_v_value;
        goto __pyx_L10_try_return;
        goto __pyx_L14;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":977
 *                 return value
 *             else:
 *                 return self._get(key, False)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_get(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L10_try_return;
      }
      __pyx_L14:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":978
 *             else:
 *                 return self._get(key, False)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_3) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.setdefault");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_4;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":979
 *                 return self._get(key, False)
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     def set(self, *args, **kwargs):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.setdefault");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":981
 *             raise e
 * 
 *     def set(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the value of a particular key or set of keys.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_set[] = "\n        Sets the value of a particular key or set of keys.\n\n        In the case of name conflicts, keyword arguments take\n        precedence over all others, and key-value pairs given later in\n        the args list take precedence over earlier values.\n\n        If ``protect_structure == True`` is given as a keyword\n        argument, then values cannot be implicitly overwritten by\n        branches.  For example, if `b = 1` is in the tree, then\n        setting `b.x = 2` would overwrite b with an implicitly created\n        branch.  Normally, this operation is allowed; however, it\n        would raise a TypeError under this situation.  Similarly,\n        overwriting branch or TreeDict value -- both seen as part of\n        the tree structure -- with a non-TreeDict value would normally\n        be allowed, but would raise a TypeError if protect_structure\n        is true.\n\n        In the case of an error or exception in any part of the\n        opereration, nothing is changed in the tree.\n\n        Examples::\n        \n            >>> from treedict import TreeDict\n            >>> t = TreeDict()\n            >>> t.set(\"x\", 1)\n            >>> t.set(z = 3)\n            >>> t.set(\"ya\", 2, \"yb\", 2, yc = 3)\n            >>> t.set(\"a.b.c.v\", 1)\n            >>> print t.makeReport()\n            x       = 1\n            z       = 3\n            ya      = 2\n            yb      = 2\n            yc      = 3\n            a.b.c.v = 1\n            \n        Setting values in groups is all or nothing::\n        \n            >>> from treedict import TreeDict\n            >>> t = TreeDict()\n            >>> t.set(\"x\", 1)\n            >>> print t.makeReport()\n            x = 1\n            >>> t.set(\"a\", 3, \"b\", 4, \"1badvalue\", 5)\n            NameError: '1badvalue' not a valid branch name.\n            >>> print t.makeReport()\n            x = 1\n            \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_v_v;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("set");
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set", 1))) return NULL;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
  if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1033
 *         """
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if s_protect_structure in kwargs:
 *                 v = kwargs.pop(s_protect_structure)
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1034
 * 
 *         try:
 *             if s_protect_structure in kwargs:             # <<<<<<<<<<<<<<
 *                 v = kwargs.pop(s_protect_structure)
 *                 if v:
 */
      if (unlikely(((PyObject *)__pyx_v_kwargs) == Py_None)) {
        __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      } else {
        __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_v_8treedict_8treedict_s_protect_structure)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      }
      if (__pyx_t_1) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1035
 *         try:
 *             if s_protect_structure in kwargs:
 *                 v = kwargs.pop(s_protect_structure)             # <<<<<<<<<<<<<<
 *                 if v:
 *                     self._setAll(args, kwargs, f_protect_structure)
 */
        __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_kwargs), __pyx_n_s__pop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_v_8treedict_8treedict_s_protect_structure));
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_8treedict_8treedict_s_protect_structure));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_8treedict_8treedict_s_protect_structure));
        __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_v_v);
        __pyx_v_v = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1036
 *             if s_protect_structure in kwargs:
 *                 v = kwargs.pop(s_protect_structure)
 *                 if v:             # <<<<<<<<<<<<<<
 *                     self._setAll(args, kwargs, f_protect_structure)
 *                 else:
 */
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_v); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        if (__pyx_t_1) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1037
 *                 v = kwargs.pop(s_protect_structure)
 *                 if v:
 *                     self._setAll(args, kwargs, f_protect_structure)             # <<<<<<<<<<<<<<
 *                 else:
 *                     self._setAll(args, kwargs, 0)
 */
          __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_setAll(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs, 64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L14;
        }
        /*else*/ {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1039
 *                     self._setAll(args, kwargs, f_protect_structure)
 *                 else:
 *                     self._setAll(args, kwargs, 0)             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
          __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_setAll(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_L14:;
        goto __pyx_L13;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1042
 * 
 *             else:
 *                 self._setAll(args, kwargs, 0)             # <<<<<<<<<<<<<<
 * 
 *         except Exception, e:
 */
        __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_setAll(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_L13:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1044
 *                 self._setAll(args, kwargs, 0)
 * 
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.set");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1045
 * 
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     def checkset(self, *args, **kwargs):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.set");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1047
 *             raise e
 * 
 *     def checkset(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Same as :meth:`set()`, and will raise the same exceptions on
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_checkset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_checkset[] = "\n        Same as :meth:`set()`, and will raise the same exceptions on\n        failure, but doesn't actually change the tree in any way.\n        Useful for ensuring that a set of arguments is valid and won't\n        raise an exception.  \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_checkset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_v_v;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("checkset");
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "checkset", 1))) return NULL;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
  if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1055
 *         """
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if s_protect_structure in kwargs:
 *                 v = kwargs.pop(s_protect_structure)
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1056
 * 
 *         try:
 *             if s_protect_structure in kwargs:             # <<<<<<<<<<<<<<
 *                 v = kwargs.pop(s_protect_structure)
 * 
 */
      if (unlikely(((PyObject *)__pyx_v_kwargs) == Py_None)) {
        __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      } else {
        __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_v_8treedict_8treedict_s_protect_structure)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      }
      if (__pyx_t_1) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1057
 *         try:
 *             if s_protect_structure in kwargs:
 *                 v = kwargs.pop(s_protect_structure)             # <<<<<<<<<<<<<<
 * 
 *                 if v:
 */
        __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_kwargs), __pyx_n_s__pop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_v_8treedict_8treedict_s_protect_structure));
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_8treedict_8treedict_s_protect_structure));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_8treedict_8treedict_s_protect_structure));
        __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_v_v);
        __pyx_v_v = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1059
 *                 v = kwargs.pop(s_protect_structure)
 * 
 *                 if v:             # <<<<<<<<<<<<<<
 *                     self._setAll(args, kwargs, f_protect_structure | f_check_only)
 *                 else:
 */
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_v); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        if (__pyx_t_1) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1060
 * 
 *                 if v:
 *                     self._setAll(args, kwargs, f_protect_structure | f_check_only)             # <<<<<<<<<<<<<<
 *                 else:
 *                     self._setAll(args, kwargs, f_check_only)
 */
          __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_setAll(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs, 72); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L14;
        }
        /*else*/ {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1062
 *                     self._setAll(args, kwargs, f_protect_structure | f_check_only)
 *                 else:
 *                     self._setAll(args, kwargs, f_check_only)             # <<<<<<<<<<<<<<
 * 
 *             self._setAll(args, kwargs, f_check_only)
 */
          __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_setAll(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs, 8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_L14:;
        goto __pyx_L13;
      }
      __pyx_L13:;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1064
 *                     self._setAll(args, kwargs, f_check_only)
 * 
 *             self._setAll(args, kwargs, f_check_only)             # <<<<<<<<<<<<<<
 * 
 *         except Exception, e:
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_setAll(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs, 8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1066
 *             self._setAll(args, kwargs, f_check_only)
 * 
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.checkset");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1067
 * 
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     cdef _setAll(self, tuple args, dict kwargs, flagtype flags):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.checkset");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1069
 *             raise e
 * 
 *     cdef _setAll(self, tuple args, dict kwargs, flagtype flags):             # <<<<<<<<<<<<<<
 * 
 *         # Sets major functionality for the set function.
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__setAll(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, __pyx_t_8treedict_8treedict_flagtype __pyx_v_flags) {
  size_t __pyx_v_n_args;
  size_t __pyx_v_n_argsets;
  size_t __pyx_v_i;
  PyObject *__pyx_v_key_list = 0;
  PyObject *__pyx_v_val_list = 0;
  PyObject *__pyx_v_k;
  PyObject *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  size_t __pyx_t_8;
  int __pyx_t_9;
  void *__pyx_t_10;
  void *__pyx_t_11;
  __Pyx_RefNannySetupContext("_setAll");
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1073
 *         # Sets major functionality for the set function.
 * 
 *         cdef size_t n_args = len(args) if args is not None else 0             # <<<<<<<<<<<<<<
 * 
 *         if ((<int>(n_args)) % 2) != 0:
 */
  __pyx_t_2 = (__pyx_v_args != ((PyObject *)Py_None));
  if (__pyx_t_2) {
    if (unlikely(__pyx_v_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_args)); 
    __pyx_t_1 = __pyx_t_3;
  } else {
    __pyx_t_1 = 0;
  }
  __pyx_v_n_args = __pyx_t_1;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1075
 *         cdef size_t n_args = len(args) if args is not None else 0
 * 
 *         if ((<int>(n_args)) % 2) != 0:             # <<<<<<<<<<<<<<
 *             raise TypeError("Even number of non-keyword arguments expected.")
 * 
 */
  __pyx_t_2 = (__Pyx_mod_long(((int)__pyx_v_n_args), 2) != 0);
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1076
 * 
 *         if ((<int>(n_args)) % 2) != 0:
 *             raise TypeError("Even number of non-keyword arguments expected.")             # <<<<<<<<<<<<<<
 * 
 *         cdef size_t n_argsets = n_args / 2
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_14));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
    __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1078
 *             raise TypeError("Even number of non-keyword arguments expected.")
 * 
 *         cdef size_t n_argsets = n_args / 2             # <<<<<<<<<<<<<<
 * 
 *         cdef size_t i
 */
  __pyx_v_n_argsets = (__pyx_v_n_args / 2);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1083
 * 
 *         # important to preserve order
 *         cdef list key_list = [None]*n_argsets             # <<<<<<<<<<<<<<
 *         cdef list val_list = [None]*n_argsets
 * 
 */
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(Py_None);
  PyList_SET_ITEM(__pyx_t_5, 0, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_n_argsets); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyNumber_Multiply(((PyObject *)__pyx_t_5), __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_key_list = ((PyObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1084
 *         # important to preserve order
 *         cdef list key_list = [None]*n_argsets
 *         cdef list val_list = [None]*n_argsets             # <<<<<<<<<<<<<<
 * 
 *         for i from 0 <= i < n_argsets:
 */
  __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_INCREF(Py_None);
  PyList_SET_ITEM(__pyx_t_6, 0, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_n_argsets); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyNumber_Multiply(((PyObject *)__pyx_t_6), __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_val_list = ((PyObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1086
 *         cdef list val_list = [None]*n_argsets
 * 
 *         for i from 0 <= i < n_argsets:             # <<<<<<<<<<<<<<
 *             k = args[2*i]
 * 
 */
  __pyx_t_7 = __pyx_v_n_argsets;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1087
 * 
 *         for i from 0 <= i < n_argsets:
 *             k = args[2*i]             # <<<<<<<<<<<<<<
 * 
 *             if not type(k) is str:
 */
    __pyx_t_8 = (2 * __pyx_v_i);
    __pyx_t_5 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_args), __pyx_t_8, sizeof(size_t)+1, __Pyx_PyInt_FromSize_t); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_v_k);
    __pyx_v_k = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1089
 *             k = args[2*i]
 * 
 *             if not type(k) is str:             # <<<<<<<<<<<<<<
 *                 raise TypeError("Name argument (%d, '%s') not string." % (i, repr(k)))
 * 
 */
    __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_k)) == ((PyObject *)((PyObject*)&PyString_Type)));
    __pyx_t_9 = (!__pyx_t_2);
    if (__pyx_t_9) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1090
 * 
 *             if not type(k) is str:
 *                 raise TypeError("Name argument (%d, '%s') not string." % (i, repr(k)))             # <<<<<<<<<<<<<<
 * 
 *             if len(<str>k) == 0:
 */
      __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_i); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_Repr(__pyx_v_k); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __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 = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_5 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1092
 *                 raise TypeError("Name argument (%d, '%s') not string." % (i, repr(k)))
 * 
 *             if len(<str>k) == 0:             # <<<<<<<<<<<<<<
 *                 raise NameError("Name argument (%d) empty string." % i)
 * 
 */
    __pyx_t_1 = PyObject_Length(__pyx_v_k); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = (__pyx_t_1 == 0);
    if (__pyx_t_9) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1093
 * 
 *             if len(<str>k) == 0:
 *                 raise NameError("Name argument (%d) empty string." % i)             # <<<<<<<<<<<<<<
 * 
 *             v = args[2*i + 1]
 */
      __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_6));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_builtin_NameError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_6, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1095
 *                 raise NameError("Name argument (%d) empty string." % i)
 * 
 *             v = args[2*i + 1]             # <<<<<<<<<<<<<<
 * 
 *             key_list[i] = k
 */
    __pyx_t_8 = ((2 * __pyx_v_i) + 1);
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_args), __pyx_t_8, sizeof(size_t)+1, __Pyx_PyInt_FromSize_t); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_v_v);
    __pyx_v_v = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1097
 *             v = args[2*i + 1]
 * 
 *             key_list[i] = k             # <<<<<<<<<<<<<<
 *             val_list[i] = v
 * 
 */
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_key_list), __pyx_v_i, __pyx_v_k, sizeof(size_t)+1, __Pyx_PyInt_FromSize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1098
 * 
 *             key_list[i] = k
 *             val_list[i] = v             # <<<<<<<<<<<<<<
 * 
 *             # test it
 */
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_val_list), __pyx_v_i, __pyx_v_v, sizeof(size_t)+1, __Pyx_PyInt_FromSize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1101
 * 
 *             # test it
 *             self._set(<str>k, v, flags | f_check_only)             # <<<<<<<<<<<<<<
 * 
 *         for k, v in kwargs.iteritems():
 */
    __pyx_t_6 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_set(__pyx_v_self, ((PyObject *)__pyx_v_k), __pyx_v_v, (__pyx_v_flags | 8)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1103
 *             self._set(<str>k, v, flags | f_check_only)
 * 
 *         for k, v in kwargs.iteritems():             # <<<<<<<<<<<<<<
 *             if not type(k) is str:
 *                 raise TypeError("Name argument '%s' not string." % repr(k))
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_kwargs));
  __Pyx_XDECREF(__pyx_t_6);
  __pyx_t_6 = ((PyObject *)__pyx_v_kwargs);
  __pyx_t_1 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_6, (&__pyx_t_1), ((PyObject **)(&__pyx_t_10)), ((PyObject **)(&__pyx_t_11)))) break;
    __Pyx_INCREF(((PyObject *)__pyx_t_10));
    __Pyx_DECREF(__pyx_v_k);
    __pyx_v_k = ((PyObject *)__pyx_t_10);
    __Pyx_INCREF(((PyObject *)__pyx_t_11));
    __Pyx_DECREF(__pyx_v_v);
    __pyx_v_v = ((PyObject *)__pyx_t_11);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1104
 * 
 *         for k, v in kwargs.iteritems():
 *             if not type(k) is str:             # <<<<<<<<<<<<<<
 *                 raise TypeError("Name argument '%s' not string." % repr(k))
 * 
 */
    __pyx_t_9 = (((PyObject *)Py_TYPE(__pyx_v_k)) == ((PyObject *)((PyObject*)&PyString_Type)));
    __pyx_t_2 = (!__pyx_t_9);
    if (__pyx_t_2) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1105
 *         for k, v in kwargs.iteritems():
 *             if not type(k) is str:
 *                 raise TypeError("Name argument '%s' not string." % repr(k))             # <<<<<<<<<<<<<<
 * 
 *             self._set(<str>k, v, flags | f_check_only)
 */
      __pyx_t_4 = PyObject_Repr(__pyx_v_k); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1107
 *                 raise TypeError("Name argument '%s' not string." % repr(k))
 * 
 *             self._set(<str>k, v, flags | f_check_only)             # <<<<<<<<<<<<<<
 * 
 *         # Now everything has been tested; go ahead and set it if need be
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_set(__pyx_v_self, ((PyObject *)__pyx_v_k), __pyx_v_v, (__pyx_v_flags | 8)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1110
 * 
 *         # Now everything has been tested; go ahead and set it if need be
 *         if (flags & f_check_only) == 0:             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < n_argsets:
 *                 self._set(<str>key_list[i], val_list[i], flags | f_already_checked)
 */
  __pyx_t_2 = ((__pyx_v_flags & 8) == 0);
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1111
 *         # Now everything has been tested; go ahead and set it if need be
 *         if (flags & f_check_only) == 0:
 *             for i from 0 <= i < n_argsets:             # <<<<<<<<<<<<<<
 *                 self._set(<str>key_list[i], val_list[i], flags | f_already_checked)
 * 
 */
    __pyx_t_7 = __pyx_v_n_argsets;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1112
 *         if (flags & f_check_only) == 0:
 *             for i from 0 <= i < n_argsets:
 *                 self._set(<str>key_list[i], val_list[i], flags | f_already_checked)             # <<<<<<<<<<<<<<
 * 
 *             for k, v in kwargs.iteritems():
 */
      __pyx_t_6 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_key_list), __pyx_v_i, sizeof(size_t)+1, __Pyx_PyInt_FromSize_t); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_val_list), __pyx_v_i, sizeof(size_t)+1, __Pyx_PyInt_FromSize_t); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_set(__pyx_v_self, ((PyObject *)__pyx_t_6), __pyx_t_5, (__pyx_v_flags | 32)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __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;
    }

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1114
 *                 self._set(<str>key_list[i], val_list[i], flags | f_already_checked)
 * 
 *             for k, v in kwargs.iteritems():             # <<<<<<<<<<<<<<
 *                 self._set(<str>k, v, flags | f_already_checked)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_kwargs));
    __Pyx_XDECREF(__pyx_t_4);
    __pyx_t_4 = ((PyObject *)__pyx_v_kwargs);
    __pyx_t_1 = 0;
    while (1) {
      if (!PyDict_Next(__pyx_t_4, (&__pyx_t_1), ((PyObject **)(&__pyx_t_11)), ((PyObject **)(&__pyx_t_10)))) break;
      __Pyx_INCREF(((PyObject *)__pyx_t_11));
      __Pyx_DECREF(__pyx_v_k);
      __pyx_v_k = ((PyObject *)__pyx_t_11);
      __Pyx_INCREF(((PyObject *)__pyx_t_10));
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = ((PyObject *)__pyx_t_10);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1115
 * 
 *             for k, v in kwargs.iteritems():
 *                 self._set(<str>k, v, flags | f_already_checked)             # <<<<<<<<<<<<<<
 * 
 *     cdef _set(self, str k, value, flagtype base_flags):
 */
      __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_set(__pyx_v_self, ((PyObject *)__pyx_v_k), __pyx_v_v, (__pyx_v_flags | 32)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L11;
  }
  __pyx_L11:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._setAll");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key_list);
  __Pyx_XDECREF(__pyx_v_val_list);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1117
 *                 self._set(<str>k, v, flags | f_already_checked)
 * 
 *     cdef _set(self, str k, value, flagtype base_flags):             # <<<<<<<<<<<<<<
 * 
 *         cdef flagtype gsp = (f_retrieve_dangling_okay
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__set(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k, PyObject *__pyx_v_value, __pyx_t_8treedict_8treedict_flagtype __pyx_v_base_flags) {
  __pyx_t_8treedict_8treedict_flagtype __pyx_v_gsp;
  int __pyx_v_rpos;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_set");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1123
 *                              | f_create_node_if_needed
 *                              | f_atomic_set
 *                              | base_flags)             # <<<<<<<<<<<<<<
 * 
 *         cdef int rpos = strrfind(k, '.')
 */
  __pyx_v_gsp = (263 | __pyx_v_base_flags);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1125
 *                              | base_flags)
 * 
 *         cdef int rpos = strrfind(k, '.')             # <<<<<<<<<<<<<<
 * 
 *         if rpos != -1:
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_k));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_k));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_k));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
  __pyx_t_2 = PyObject_Call(__pyx_v_8treedict_8treedict_strrfind, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rpos = __pyx_t_3;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1127
 *         cdef int rpos = strrfind(k, '.')
 * 
 *         if rpos != -1:             # <<<<<<<<<<<<<<
 *             self._getBranch(k[:rpos], gsp)._setLocal(k[rpos+1:], value, gsp)
 *         else:
 */
  __pyx_t_4 = (__pyx_v_rpos != -1);
  if (__pyx_t_4) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1128
 * 
 *         if rpos != -1:
 *             self._getBranch(k[:rpos], gsp)._setLocal(k[rpos+1:], value, gsp)             # <<<<<<<<<<<<<<
 *         else:
 *             self._setLocal(k, value, gsp)
 */
    __pyx_t_2 = PySequence_GetSlice(((PyObject *)__pyx_v_k), 0, __pyx_v_rpos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getBranch(__pyx_v_self, __pyx_t_2, __pyx_v_gsp)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_2 = PySequence_GetSlice(((PyObject *)__pyx_v_k), (__pyx_v_rpos + 1), PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1)->__pyx_vtab)->_setLocal(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1), __pyx_t_2, __pyx_v_value, __pyx_v_gsp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1130
 *             self._getBranch(k[:rpos], gsp)._setLocal(k[rpos+1:], value, gsp)
 *         else:
 *             self._setLocal(k, value, gsp)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ensureWriteable(self, str k):
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setLocal(__pyx_v_self, __pyx_v_k, __pyx_v_value, __pyx_v_gsp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._set");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1132
 *             self._setLocal(k, value, gsp)
 * 
 *     cdef _ensureWriteable(self, str k):             # <<<<<<<<<<<<<<
 *         if self.isFrozen():
 *             if k is not None:
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__ensureWriteable(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_ensureWriteable");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1133
 * 
 *     cdef _ensureWriteable(self, str k):
 *         if self.isFrozen():             # <<<<<<<<<<<<<<
 *             if k is not None:
 *                 raise TypeError("%s frozen; cannot modify '%s'" % (self._branchName(False, True), k))
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->isFrozen(__pyx_v_self, 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1134
 *     cdef _ensureWriteable(self, str k):
 *         if self.isFrozen():
 *             if k is not None:             # <<<<<<<<<<<<<<
 *                 raise TypeError("%s frozen; cannot modify '%s'" % (self._branchName(False, True), k))
 *             else:
 */
    __pyx_t_1 = (__pyx_v_k != ((PyObject *)Py_None));
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1135
 *         if self.isFrozen():
 *             if k is not None:
 *                 raise TypeError("%s frozen; cannot modify '%s'" % (self._branchName(False, True), k))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError("%s frozen; cannot modify." % self._branchName(False, True))
 */
      __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_branchName(__pyx_v_self, 0, 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __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_INCREF(((PyObject *)__pyx_v_k));
      PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_k));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_k));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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 = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1137
 *                 raise TypeError("%s frozen; cannot modify '%s'" % (self._branchName(False, True), k))
 *             else:
 *                 raise TypeError("%s frozen; cannot modify." % self._branchName(False, True))             # <<<<<<<<<<<<<<
 * 
 *         if self.isIterReferenced():
 */
      __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_branchName(__pyx_v_self, 0, 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __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);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1139
 *                 raise TypeError("%s frozen; cannot modify." % self._branchName(False, True))
 * 
 *         if self.isIterReferenced():             # <<<<<<<<<<<<<<
 *             raise RuntimeError("%s cannot be changed while being iterated over." % self._branchName(False, True))
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->isIterReferenced(__pyx_v_self);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1140
 * 
 *         if self.isIterReferenced():
 *             raise RuntimeError("%s cannot be changed while being iterated over." % self._branchName(False, True))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_branchName(__pyx_v_self, 0, 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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 = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._ensureWriteable");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1143
 * 
 * 
 *     cdef _setLocal(self, str k, v, flagtype gsp):             # <<<<<<<<<<<<<<
 *         # All set operations should go through this function.
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__setLocal(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k, PyObject *__pyx_v_v, __pyx_t_8treedict_8treedict_flagtype __pyx_v_gsp) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_lpn;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_new_pn;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __pyx_t_8treedict_8treedict_flagtype __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  __Pyx_RefNannySetupContext("_setLocal");
  __pyx_v_lpn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_new_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1151
 *         cdef _PTreeNode lpn, new_pn
 * 
 *         if not (gsp & f_already_checked):             # <<<<<<<<<<<<<<
 *             checkNameValidity(k)
 * 
 */
  __pyx_t_1 = (!(__pyx_v_gsp & 32));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1152
 * 
 *         if not (gsp & f_already_checked):
 *             checkNameValidity(k)             # <<<<<<<<<<<<<<
 * 
 *         lpn = self._getLocalPTNode(k)
 */
    __pyx_t_2 = __pyx_f_8treedict_8treedict_checkNameValidity(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1154
 *             checkNameValidity(k)
 * 
 *         lpn = self._getLocalPTNode(k)             # <<<<<<<<<<<<<<
 * 
 *         if lpn is not None and (gsp & f_no_overwrite) != 0:
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getLocalPTNode(__pyx_v_self, __pyx_v_k)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_lpn));
  __pyx_v_lpn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1156
 *         lpn = self._getLocalPTNode(k)
 * 
 *         if lpn is not None and (gsp & f_no_overwrite) != 0:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_lpn) != Py_None);
  if (__pyx_t_1) {
    __pyx_t_3 = ((__pyx_v_gsp & 512) != 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_1;
  }
  if (__pyx_t_4) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1157
 * 
 *         if lpn is not None and (gsp & f_no_overwrite) != 0:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if not (gsp & f_already_checked): # Skip things we've already checked
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1159
 *             return
 * 
 *         if not (gsp & f_already_checked): # Skip things we've already checked             # <<<<<<<<<<<<<<
 *             self._ensureWriteable(k)
 *             self._checkNodeAvailability()
 */
  __pyx_t_4 = (!(__pyx_v_gsp & 32));
  if (__pyx_t_4) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1160
 * 
 *         if not (gsp & f_already_checked): # Skip things we've already checked
 *             self._ensureWriteable(k)             # <<<<<<<<<<<<<<
 *             self._checkNodeAvailability()
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_ensureWriteable(__pyx_v_self, __pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1161
 *         if not (gsp & f_already_checked): # Skip things we've already checked
 *             self._ensureWriteable(k)
 *             self._checkNodeAvailability()             # <<<<<<<<<<<<<<
 * 
 *         ########################################
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_checkNodeAvailability(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1166
 *         # Now go through the above
 * 
 *         if lpn is not None:             # <<<<<<<<<<<<<<
 * 
 *             if (gsp & f_protect_structure):
 */
  __pyx_t_4 = (((PyObject *)__pyx_v_lpn) != Py_None);
  if (__pyx_t_4) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1168
 *         if lpn is not None:
 * 
 *             if (gsp & f_protect_structure):             # <<<<<<<<<<<<<<
 * 
 *                 if lpn.isTree() and type(v) is not TreeDict:
 */
    __pyx_t_5 = (__pyx_v_gsp & 64);
    if (__pyx_t_5) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1170
 *             if (gsp & f_protect_structure):
 * 
 *                 if lpn.isTree() and type(v) is not TreeDict:             # <<<<<<<<<<<<<<
 *                     raise TypeError("Branch/Tree '%s' would be overwritten by value."
 *                                     % self._fullNameOf(k))
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_lpn->__pyx_vtab)->isTree(__pyx_v_lpn);
      if (__pyx_t_4) {
        __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_v)) != ((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict_TreeDict)));
        __pyx_t_3 = __pyx_t_1;
      } else {
        __pyx_t_3 = __pyx_t_4;
      }
      if (__pyx_t_3) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1172
 *                 if lpn.isTree() and type(v) is not TreeDict:
 *                     raise TypeError("Branch/Tree '%s' would be overwritten by value."
 *                                     % self._fullNameOf(k))             # <<<<<<<<<<<<<<
 * 
 *                 elif (not lpn.isTree()) and type(v) is TreeDict:
 */
        __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_fullNameOf(__pyx_v_self, __pyx_v_k, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_6));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
        __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_Raise(__pyx_t_6, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L8;
      }

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1174
 *                                     % self._fullNameOf(k))
 * 
 *                 elif (not lpn.isTree()) and type(v) is TreeDict:             # <<<<<<<<<<<<<<
 *                     raise TypeError("Value '%s' would be overwritten by Branch/Tree."
 *                                     % self._fullNameOf(k))
 */
      __pyx_t_3 = (!((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_lpn->__pyx_vtab)->isTree(__pyx_v_lpn));
      if (__pyx_t_3) {
        __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_v)) == ((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict_TreeDict)));
        __pyx_t_1 = __pyx_t_4;
      } else {
        __pyx_t_1 = __pyx_t_3;
      }
      if (__pyx_t_1) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1176
 *                 elif (not lpn.isTree()) and type(v) is TreeDict:
 *                     raise TypeError("Value '%s' would be overwritten by Branch/Tree."
 *                                     % self._fullNameOf(k))             # <<<<<<<<<<<<<<
 * 
 *             if (gsp & f_check_only):
 */
        __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_fullNameOf(__pyx_v_self, __pyx_v_k, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
        __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_Raise(__pyx_t_2, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L8;
      }
      __pyx_L8:;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1178
 *                                     % self._fullNameOf(k))
 * 
 *             if (gsp & f_check_only):             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
    __pyx_t_5 = (__pyx_v_gsp & 8);
    if (__pyx_t_5) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1179
 * 
 *             if (gsp & f_check_only):
 *                 return             # <<<<<<<<<<<<<<
 * 
 *             # Most common case, # 1 above
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1182
 * 
 *             # Most common case, # 1 above
 *             self._keyDeleted(k, lpn)             # <<<<<<<<<<<<<<
 * 
 *             new_pn = newPTreeNode(self, k, v, lpn.orderPosition())
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_keyDeleted(__pyx_v_self, __pyx_v_k, __pyx_v_lpn);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1184
 *             self._keyDeleted(k, lpn)
 * 
 *             new_pn = newPTreeNode(self, k, v, lpn.orderPosition())             # <<<<<<<<<<<<<<
 *             self._param_dict[k] = new_pn
 *             self._keyInserted(k, new_pn)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_lpn->__pyx_vtab)->orderPosition(__pyx_v_lpn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyInt_AsSize_t(__pyx_t_2); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = ((PyObject *)__pyx_f_8treedict_8treedict_newPTreeNode(__pyx_v_self, __pyx_v_k, __pyx_v_v, __pyx_t_7)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_new_pn));
    __pyx_v_new_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1185
 * 
 *             new_pn = newPTreeNode(self, k, v, lpn.orderPosition())
 *             self._param_dict[k] = new_pn             # <<<<<<<<<<<<<<
 *             self._keyInserted(k, new_pn)
 * 
 */
    if (PyDict_SetItem(((PyObject *)__pyx_v_self->_param_dict), ((PyObject *)__pyx_v_k), ((PyObject *)__pyx_v_new_pn)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1186
 *             new_pn = newPTreeNode(self, k, v, lpn.orderPosition())
 *             self._param_dict[k] = new_pn
 *             self._keyInserted(k, new_pn)             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_keyInserted(__pyx_v_self, __pyx_v_k, __pyx_v_new_pn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1189
 * 
 *         else:
 *             if (gsp & f_check_only):             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
    __pyx_t_5 = (__pyx_v_gsp & 8);
    if (__pyx_t_5) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1190
 *         else:
 *             if (gsp & f_check_only):
 *                 return             # <<<<<<<<<<<<<<
 * 
 *             new_pn = newPTreeNode(self, k, v, self._getNextOrderValue())
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1192
 *                 return
 * 
 *             new_pn = newPTreeNode(self, k, v, self._getNextOrderValue())             # <<<<<<<<<<<<<<
 *             self._param_dict[k] = new_pn
 *             self._keyInserted(k, new_pn)
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_8treedict_8treedict_newPTreeNode(__pyx_v_self, __pyx_v_k, __pyx_v_v, ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getNextOrderValue(__pyx_v_self))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_new_pn));
    __pyx_v_new_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1193
 * 
 *             new_pn = newPTreeNode(self, k, v, self._getNextOrderValue())
 *             self._param_dict[k] = new_pn             # <<<<<<<<<<<<<<
 *             self._keyInserted(k, new_pn)
 * 
 */
    if (PyDict_SetItem(((PyObject *)__pyx_v_self->_param_dict), ((PyObject *)__pyx_v_k), ((PyObject *)__pyx_v_new_pn)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1194
 *             new_pn = newPTreeNode(self, k, v, self._getNextOrderValue())
 *             self._param_dict[k] = new_pn
 *             self._keyInserted(k, new_pn)             # <<<<<<<<<<<<<<
 * 
 *     ########################################
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_keyInserted(__pyx_v_self, __pyx_v_k, __pyx_v_new_pn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._setLocal");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_lpn);
  __Pyx_DECREF((PyObject *)__pyx_v_new_pn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1199
 *     # Code to deal with ordering of node values
 * 
 *     cdef _checkNodeAvailability(self):             # <<<<<<<<<<<<<<
 *         if self._next_item_order_position >= _orderNodeMaxNum - 1:
 *             # Need to rework the nodes; raises exception if there's a
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__checkNodeAvailability(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_checkNodeAvailability");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1200
 * 
 *     cdef _checkNodeAvailability(self):
 *         if self._next_item_order_position >= _orderNodeMaxNum - 1:             # <<<<<<<<<<<<<<
 *             # Need to rework the nodes; raises exception if there's a
 *             # problem
 */
  __pyx_t_1 = (__pyx_v_self->_next_item_order_position >= (__pyx_v_8treedict_8treedict__orderNodeMaxNum - 1));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1203
 *             # Need to rework the nodes; raises exception if there's a
 *             # problem
 *             self._reworkOrderValues()             # <<<<<<<<<<<<<<
 * 
 *     cdef size_t _getNextOrderValue(self):
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_reworkOrderValues(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._checkNodeAvailability");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1205
 *             self._reworkOrderValues()
 * 
 *     cdef size_t _getNextOrderValue(self):             # <<<<<<<<<<<<<<
 *         cdef size_t ret = self._next_item_order_position
 *         self._next_item_order_position += 1
 */

static  size_t __pyx_f_8treedict_8treedict_8TreeDict__getNextOrderValue(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  size_t __pyx_v_ret;
  size_t __pyx_r;
  __Pyx_RefNannySetupContext("_getNextOrderValue");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1206
 * 
 *     cdef size_t _getNextOrderValue(self):
 *         cdef size_t ret = self._next_item_order_position             # <<<<<<<<<<<<<<
 *         self._next_item_order_position += 1
 *         return ret
 */
  __pyx_v_ret = __pyx_v_self->_next_item_order_position;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1207
 *     cdef size_t _getNextOrderValue(self):
 *         cdef size_t ret = self._next_item_order_position
 *         self._next_item_order_position += 1             # <<<<<<<<<<<<<<
 *         return ret
 * 
 */
  __pyx_v_self->_next_item_order_position += 1;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1208
 *         cdef size_t ret = self._next_item_order_position
 *         self._next_item_order_position += 1
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     cdef _reworkOrderValues(self):
 */
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1210
 *         return ret
 * 
 *     cdef _reworkOrderValues(self):             # <<<<<<<<<<<<<<
 *         cdef _PTreeNode pn
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__reworkOrderValues(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  PyObject *__pyx_v_vl = 0;
  PyObject *__pyx_v_tr_dict = 0;
  PyObject *__pyx_v_np;
  PyObject *__pyx_v_p;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  void *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  __Pyx_RefNannySetupContext("_reworkOrderValues");
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_np = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_p = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1213
 *         cdef _PTreeNode pn
 * 
 *         cdef list vl = sorted([pn.orderPosition()             # <<<<<<<<<<<<<<
 *                                for pn in self._param_dict.itervalues()])
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1214
 * 
 *         cdef list vl = sorted([pn.orderPosition()
 *                                for pn in self._param_dict.itervalues()])             # <<<<<<<<<<<<<<
 * 
 *         if len(vl) > _orderNodeMaxNum:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_param_dict));
  __Pyx_XDECREF(__pyx_t_2);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_param_dict);
  __pyx_t_3 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_2, (&__pyx_t_3), NULL, ((PyObject **)(&__pyx_t_4)))) break;
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_4), __pyx_ptype_8treedict_8treedict__PTreeNode)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_4)));
    __Pyx_DECREF(((PyObject *)__pyx_v_pn));
    __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_4);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1213
 *         cdef _PTreeNode pn
 * 
 *         cdef list vl = sorted([pn.orderPosition()             # <<<<<<<<<<<<<<
 *                                for pn in self._param_dict.itervalues()])
 * 
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->orderPosition(__pyx_v_pn); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_sorted, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_vl = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1216
 *                                for pn in self._param_dict.itervalues()])
 * 
 *         if len(vl) > _orderNodeMaxNum:             # <<<<<<<<<<<<<<
 *             raise OverflowError("Maximum number of branches/leaves (%d) exceeded."
 *                                 % str(_orderNodeMaxNum))
 */
  if (unlikely(__pyx_v_vl == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_vl)); 
  __pyx_t_6 = (__pyx_t_3 > __pyx_v_8treedict_8treedict__orderNodeMaxNum);
  if (__pyx_t_6) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1218
 *         if len(vl) > _orderNodeMaxNum:
 *             raise OverflowError("Maximum number of branches/leaves (%d) exceeded."
 *                                 % str(_orderNodeMaxNum))             # <<<<<<<<<<<<<<
 * 
 *         cdef dict tr_dict = dict([(p, np+1) for np, p in enumerate(vl)])
 */
    __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_8treedict_8treedict__orderNodeMaxNum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; __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 = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_builtin_OverflowError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1220
 *                                 % str(_orderNodeMaxNum))
 * 
 *         cdef dict tr_dict = dict([(p, np+1) for np, p in enumerate(vl)])             # <<<<<<<<<<<<<<
 * 
 *         for pn in self._param_dict.itervalues():
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_1 = __pyx_int_0;
  if (likely(((PyObject *)__pyx_v_vl) != Py_None)) {
    __pyx_t_3 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_vl); __Pyx_INCREF(__pyx_t_5);
  } else {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break;
    __pyx_t_7 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
    __Pyx_DECREF(__pyx_v_p);
    __pyx_v_p = __pyx_t_7;
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_np);
    __pyx_v_np = __pyx_t_1;
    __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_v_np, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_p);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_p);
    __Pyx_GIVEREF(__pyx_v_p);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_7 = 0;
    if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyDict_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_tr_dict = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1222
 *         cdef dict tr_dict = dict([(p, np+1) for np, p in enumerate(vl)])
 * 
 *         for pn in self._param_dict.itervalues():             # <<<<<<<<<<<<<<
 *             pn.setOrderPostion(tr_dict[pn.orderPosition()])
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_param_dict));
  __Pyx_XDECREF(__pyx_t_2);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_param_dict);
  __pyx_t_3 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_2, (&__pyx_t_3), NULL, ((PyObject **)(&__pyx_t_4)))) break;
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_4), __pyx_ptype_8treedict_8treedict__PTreeNode)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_4)));
    __Pyx_DECREF(((PyObject *)__pyx_v_pn));
    __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_4);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1223
 * 
 *         for pn in self._param_dict.itervalues():
 *             pn.setOrderPostion(tr_dict[pn.orderPosition()])             # <<<<<<<<<<<<<<
 * 
 *         self._next_item_order_position = len(vl) + 2
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->orderPosition(__pyx_v_pn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_tr_dict), __pyx_t_1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_9 = __Pyx_PyInt_AsSize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->setOrderPostion(__pyx_v_pn, __pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1225
 *             pn.setOrderPostion(tr_dict[pn.orderPosition()])
 * 
 *         self._next_item_order_position = len(vl) + 2             # <<<<<<<<<<<<<<
 * 
 *     ################################################################################
 */
  if (unlikely(__pyx_v_vl == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_vl)); 
  __pyx_v_self->_next_item_order_position = (__pyx_t_3 + 2);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._reworkOrderValues");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_XDECREF(__pyx_v_vl);
  __Pyx_XDECREF(__pyx_v_tr_dict);
  __Pyx_DECREF(__pyx_v_np);
  __Pyx_DECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1230
 *     # Methods that freeze the state of the tree
 * 
 *     cpdef freeze(self, str branch=None, bint quiet = True):             # <<<<<<<<<<<<<<
 *         """
 *         Freezes the tree and all branches so no further manipulations
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_freeze(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict_freeze(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_freeze *__pyx_optional_args) {
  PyObject *__pyx_v_branch = ((PyObject *)Py_None);
  int __pyx_v_quiet = ((int)1);
  PyObject *__pyx_v_b;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("freeze");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_branch = __pyx_optional_args->branch;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_quiet = __pyx_optional_args->quiet;
      }
    }
  }
  __pyx_v_b = Py_None; __Pyx_INCREF(Py_None);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__freeze); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_freeze)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_quiet); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(((PyObject *)__pyx_v_branch));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_branch));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_branch));
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __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;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1249
 *         """
 * 
 *         if branch is None:             # <<<<<<<<<<<<<<
 *             self._freeze_tree()
 *         else:
 */
  __pyx_t_4 = (__pyx_v_branch == ((PyObject *)Py_None));
  if (__pyx_t_4) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1250
 * 
 *         if branch is None:
 *             self._freeze_tree()             # <<<<<<<<<<<<<<
 *         else:
 *             b = self.get(branch)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_freeze_tree(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1252
 *             self._freeze_tree()
 *         else:
 *             b = self.get(branch)             # <<<<<<<<<<<<<<
 * 
 *             if not type(b) is TreeDict:
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_branch, 0, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_b);
    __pyx_v_b = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1254
 *             b = self.get(branch)
 * 
 *             if not type(b) is TreeDict:             # <<<<<<<<<<<<<<
 *                 if not quiet:
 *                     raise TypeError("Cannot freeze non-branch value at key '%s'" % branch)
 */
    __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_b)) == ((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict_TreeDict)));
    __pyx_t_5 = (!__pyx_t_4);
    if (__pyx_t_5) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1255
 * 
 *             if not type(b) is TreeDict:
 *                 if not quiet:             # <<<<<<<<<<<<<<
 *                     raise TypeError("Cannot freeze non-branch value at key '%s'" % branch)
 *                 else:
 */
      __pyx_t_5 = (!__pyx_v_quiet);
      if (__pyx_t_5) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1256
 *             if not type(b) is TreeDict:
 *                 if not quiet:
 *                     raise TypeError("Cannot freeze non-branch value at key '%s'" % branch)             # <<<<<<<<<<<<<<
 *                 else:
 *                     return
 */
        __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), ((PyObject *)__pyx_v_branch)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_Raise(__pyx_t_1, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L5;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1258
 *                     raise TypeError("Cannot freeze non-branch value at key '%s'" % branch)
 *                 else:
 *                     return             # <<<<<<<<<<<<<<
 * 
 *             (<TreeDict>b)._freeze_tree()
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        goto __pyx_L0;
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1260
 *                     return
 * 
 *             (<TreeDict>b)._freeze_tree()             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_b)->__pyx_vtab)->_freeze_tree(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.freeze");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1230
 *     # Methods that freeze the state of the tree
 * 
 *     cpdef freeze(self, str branch=None, bint quiet = True):             # <<<<<<<<<<<<<<
 *         """
 *         Freezes the tree and all branches so no further manipulations
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_freeze(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_freeze[] = "\n        Freezes the tree and all branches so no further manipulations\n        can happen.  The tree cannot be unfrozen except by creating an\n        unfrozen copy of that tree.  If the tree does not contain\n        mutable values, it can then be used as a key in a dictionary.\n\n        If `branch` is given, then only that branch (and all\n        sub-branches) are frozen.\n\n        If `quiet` is True, then no error is raised if `branch` refers\n        to a value instead of a branch.  Otherwise, a TypeError\n        exception is raised. This parameter is ignored if `branch` is\n        None.\n\n        Note: TreeDict values stored in the tree as values -- not as\n        branches -- are not affected by this freezing operation.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_freeze(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_branch = 0;
  int __pyx_v_quiet;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8treedict_8treedict_8TreeDict_freeze __pyx_t_2;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__branch,&__pyx_n_s__quiet,0};
  __Pyx_RefNannySetupContext("freeze");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__branch);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__quiet);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "freeze") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_branch = ((PyObject *)values[0]);
    if (values[1]) {
      __pyx_v_quiet = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_quiet == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_quiet = ((int)1);
    }
  } else {
    __pyx_v_branch = ((PyObject *)Py_None);
    __pyx_v_quiet = ((int)1);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_quiet = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_quiet == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_branch = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("freeze", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.freeze");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_branch), &PyString_Type, 1, "branch", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.branch = __pyx_v_branch;
  __pyx_t_2.quiet = __pyx_v_quiet;
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->freeze(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.freeze");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1263
 * 
 * 
 *     cdef _freeze_tree(self):             # <<<<<<<<<<<<<<
 *             self._setFrozen(True)
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__freeze_tree(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  PyObject *__pyx_v_b;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_freeze_tree");
  __pyx_v_b = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1264
 * 
 *     cdef _freeze_tree(self):
 *             self._setFrozen(True)             # <<<<<<<<<<<<<<
 * 
 *             for b in self._branches:
 */
  ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setFrozen(__pyx_v_self, 1);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1266
 *             self._setFrozen(True)
 * 
 *             for b in self._branches:             # <<<<<<<<<<<<<<
 *                 (<TreeDict>b)._freeze_tree()
 * 
 */
  if (likely(((PyObject *)__pyx_v_self->_branches) != Py_None)) {
    __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_self->_branches); __Pyx_INCREF(__pyx_t_2);
  } else {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    __Pyx_DECREF(__pyx_v_b);
    __pyx_v_b = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1267
 * 
 *             for b in self._branches:
 *                 (<TreeDict>b)._freeze_tree()             # <<<<<<<<<<<<<<
 * 
 *     ################################################################################
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_b)->__pyx_vtab)->_freeze_tree(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_b)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._freeze_tree");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1272
 *     # Methods for deleting / pruning the tree
 * 
 *     def __delattr__(self, str k):             # <<<<<<<<<<<<<<
 *         try:
 *             self._prune(k, False)
 */

static int __pyx_pf_8treedict_8treedict_8TreeDict___delattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_k); /*proto*/
static int __pyx_pf_8treedict_8treedict_8TreeDict___delattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_k) {
  PyObject *__pyx_v_ke;
  PyObject *__pyx_v_e;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__delattr__");
  __pyx_v_ke = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_k), &PyString_Type, 1, "k", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1273
 * 
 *     def __delattr__(self, str k):
 *         try:             # <<<<<<<<<<<<<<
 *             self._prune(k, False)
 *         except KeyError, ke:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1274
 *     def __delattr__(self, str k):
 *         try:
 *             self._prune(k, False)             # <<<<<<<<<<<<<<
 *         except KeyError, ke:
 *             raise AttributeError(str(ke))
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_prune(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_k, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1274; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1275
 *         try:
 *             self._prune(k, False)
 *         except KeyError, ke:             # <<<<<<<<<<<<<<
 *             raise AttributeError(str(ke))
 *         except Exception, e:
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.__delattr__");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_ke);
      __pyx_v_ke = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1276
 *             self._prune(k, False)
 *         except KeyError, ke:
 *             raise AttributeError(str(ke))             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1276; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_ke);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ke);
      __Pyx_GIVEREF(__pyx_v_ke);
      __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1276; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1276; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_builtin_AttributeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1276; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_6, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1276; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_exception_handled;
    }

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1277
 *         except KeyError, ke:
 *             raise AttributeError(str(ke))
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.__delattr__");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1278
 *             raise AttributeError(str(ke))
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, k):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__delattr__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ke);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1280
 *             raise e
 * 
 *     def __delitem__(self, k):             # <<<<<<<<<<<<<<
 *         if type(k) is not str:
 *             raise KeyError(k)
 */

static int __pyx_pf_8treedict_8treedict_8TreeDict___delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_k); /*proto*/
static int __pyx_pf_8treedict_8treedict_8TreeDict___delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_k) {
  PyObject *__pyx_v_e;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__delitem__");
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1281
 * 
 *     def __delitem__(self, k):
 *         if type(k) is not str:             # <<<<<<<<<<<<<<
 *             raise KeyError(k)
 * 
 */
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_k)) != ((PyObject *)((PyObject*)&PyString_Type)));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1282
 *     def __delitem__(self, k):
 *         if type(k) is not str:
 *             raise KeyError(k)             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_k);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_k);
    __Pyx_GIVEREF(__pyx_v_k);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __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);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1284
 *             raise KeyError(k)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self._prune(k, False)
 *         except Exception, e:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1285
 * 
 *         try:
 *             self._prune(k, False)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
      if (!(likely(PyString_CheckExact(__pyx_v_k))||((__pyx_v_k) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_k)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_prune(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((PyObject *)__pyx_v_k), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1286
 *         try:
 *             self._prune(k, False)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_4) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.__delitem__");
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_2;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1287
 *             self._prune(k, False)
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     cdef _cut(self, str k):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__delitem__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1289
 *             raise e
 * 
 *     cdef _cut(self, str k):             # <<<<<<<<<<<<<<
 * 
 *         cdef TreeDict p
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__cut(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_cut");
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1293
 *         cdef TreeDict p
 * 
 *         self._ensureWriteable(k)             # <<<<<<<<<<<<<<
 * 
 *         # Legit if this raises an error
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_ensureWriteable(__pyx_v_self, __pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1296
 * 
 *         # Legit if this raises an error
 *         cdef _PTreeNode pn = self._param_dict.pop(k)             # <<<<<<<<<<<<<<
 * 
 *         self._keyDeleted(k, pn)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->_param_dict), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __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 = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_k));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_k));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_k));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8treedict_8treedict__PTreeNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1298
 *         cdef _PTreeNode pn = self._param_dict.pop(k)
 * 
 *         self._keyDeleted(k, pn)             # <<<<<<<<<<<<<<
 * 
 *         if pn.isBranch():
 */
  ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_keyDeleted(__pyx_v_self, __pyx_v_k, __pyx_v_pn);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1300
 *         self._keyDeleted(k, pn)
 * 
 *         if pn.isBranch():             # <<<<<<<<<<<<<<
 *             p = pn.tree()
 * 
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isBranch(__pyx_v_pn);
  if (__pyx_t_4) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1301
 * 
 *         if pn.isBranch():
 *             p = pn.tree()             # <<<<<<<<<<<<<<
 * 
 *             # One of the concerns here is how items are viewed by
 */
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_v_p));
    __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1305
 *             # One of the concerns here is how items are viewed by
 *             # other references after dropping them here.
 *             p._setDangling(False)             # <<<<<<<<<<<<<<
 *             p._setDetachedDangling(False)
 *             p._resetParentNode(None)
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_setDangling(__pyx_v_p, 0);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1306
 *             # other references after dropping them here.
 *             p._setDangling(False)
 *             p._setDetachedDangling(False)             # <<<<<<<<<<<<<<
 *             p._resetParentNode(None)
 * 
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_setDetachedDangling(__pyx_v_p, 0);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1307
 *             p._setDangling(False)
 *             p._setDetachedDangling(False)
 *             p._resetParentNode(None)             # <<<<<<<<<<<<<<
 * 
 *         return pn.value()
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_resetParentNode(__pyx_v_p, ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None));
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1309
 *             p._resetParentNode(None)
 * 
 *         return pn.value()             # <<<<<<<<<<<<<<
 * 
 *     def clear(self, branch_mode = 'all'):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->value(__pyx_v_pn); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._cut");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_p);
  __Pyx_XDECREF((PyObject *)__pyx_v_pn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1311
 *         return pn.value()
 * 
 *     def clear(self, branch_mode = 'all'):             # <<<<<<<<<<<<<<
 *         """
 *         Clears branches and/or values from the current tree.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_clear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_clear[] = "\n        Clears branches and/or values from the current tree.\n\n        If branch_mode is 'all' (default), all nodes and values\n        current tree are cleared.\n\n        If branch_mode is 'only', only the branches are cleared out\n        and the values are left.\n\n        If branch_mode is 'none', the branches are left, but all the\n        values are cleared.\n\n        Example::\n        \n            >>> from treedict import TreeDict\n            >>> t = TreeDict() ; t.set('a.b', 1, 'b.c', 2, x = 1, y = 2)\n            >>> print t.makeReport()\n            a.b = 1\n            b.c = 2\n            y   = 2\n            x   = 1\n            >>> t1 = t.copy() ; t2 = t.copy()\n            >>> t.clear()\n            >>> t.isEmpty()\n            True\n            >>> \n            >>> t1.clear(branch_mode = 'none')\n            >>> print t1.makeReport()\n            a.b = 1\n            b.c = 2\n            >>> \n            >>> t2.clear(branch_mode = 'only')\n            >>> print t2.makeReport()\n            y = 2\n            x = 1\n            \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_clear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_branch_mode = 0;
  int __pyx_v_b_mode;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  PyObject *__pyx_v_k;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__branch_mode,0};
  __Pyx_RefNannySetupContext("clear");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_n_s__all);
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__branch_mode);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "clear") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_branch_mode = values[0];
  } else {
    __pyx_v_branch_mode = ((PyObject *)__pyx_n_s__all);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_branch_mode = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("clear", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.clear");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1350
 *         """
 * 
 *         cdef int b_mode = self._getBranchMode(branch_mode)             # <<<<<<<<<<<<<<
 *         cdef _PTreeNode pn
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_getBranchMode(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_branch_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_b_mode = __pyx_t_2;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1355
 *         # Check if it's a dangling node; this is bad
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self.isDangling():
 *                 self._raiseErrorAtFirstNonDanglingBranch(True)
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1356
 * 
 *         try:
 *             if self.isDangling():             # <<<<<<<<<<<<<<
 *                 self._raiseErrorAtFirstNonDanglingBranch(True)
 * 
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->isDangling(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0);
      if (__pyx_t_3) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1357
 *         try:
 *             if self.isDangling():
 *                 self._raiseErrorAtFirstNonDanglingBranch(True)             # <<<<<<<<<<<<<<
 * 
 *             # First check if it's frozen or can't be written
 */
        __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_raiseErrorAtFirstNonDanglingBranch(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L14;
      }
      __pyx_L14:;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1360
 * 
 *             # First check if it's frozen or can't be written
 *             self._ensureWriteable(None)             # <<<<<<<<<<<<<<
 * 
 *             if b_mode == i_BranchMode_All:
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_ensureWriteable(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((PyObject *)Py_None)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1362
 *             self._ensureWriteable(None)
 * 
 *             if b_mode == i_BranchMode_All:             # <<<<<<<<<<<<<<
 *                 self._param_dict.clear()
 *                 self._branches = []
 */
      __pyx_t_3 = (__pyx_v_b_mode == 1);
      if (__pyx_t_3) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1363
 * 
 *             if b_mode == i_BranchMode_All:
 *                 self._param_dict.clear()             # <<<<<<<<<<<<<<
 *                 self._branches = []
 *                 self._n_dangling = 0
 */
        __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_param_dict), __pyx_n_s__clear); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1364
 *             if b_mode == i_BranchMode_All:
 *                 self._param_dict.clear()
 *                 self._branches = []             # <<<<<<<<<<<<<<
 *                 self._n_dangling = 0
 *                 self._n_mutable = 0
 */
        __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
        __Pyx_GOTREF(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_branches);
        __Pyx_DECREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_branches));
        ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_branches = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1365
 *                 self._param_dict.clear()
 *                 self._branches = []
 *                 self._n_dangling = 0             # <<<<<<<<<<<<<<
 *                 self._n_mutable = 0
 *                 self._next_item_order_position = _orderNodeStartingValue
 */
        ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_n_dangling = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1366
 *                 self._branches = []
 *                 self._n_dangling = 0
 *                 self._n_mutable = 0             # <<<<<<<<<<<<<<
 *                 self._next_item_order_position = _orderNodeStartingValue
 *             else:
 */
        ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_n_mutable = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1367
 *                 self._n_dangling = 0
 *                 self._n_mutable = 0
 *                 self._next_item_order_position = _orderNodeStartingValue             # <<<<<<<<<<<<<<
 *             else:
 *                 for k, pn in self._param_dict.items():
 */
        ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_next_item_order_position = 0;
        goto __pyx_L15;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1369
 *                 self._next_item_order_position = _orderNodeStartingValue
 *             else:
 *                 for k, pn in self._param_dict.items():             # <<<<<<<<<<<<<<
 *                     if b_mode == i_BranchMode_Only:
 *                         if pn.isBranch():
 */
        __pyx_t_4 = PyDict_Items(((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_param_dict)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_4);
        if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
          __pyx_t_5 = 0; __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1);
        } else {
          __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        for (;;) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
            __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++;
          } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
            __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++;
          } else {
            __pyx_t_4 = PyIter_Next(__pyx_t_1);
            if (!__pyx_t_4) {
              if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              break;
            }
            __Pyx_GOTREF(__pyx_t_4);
          }
          if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
            PyObject* tuple = __pyx_t_4;
            __pyx_t_6 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_6);
            __pyx_t_7 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_7);
            if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_8treedict_8treedict__PTreeNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_v_k);
            __pyx_v_k = __pyx_t_6;
            __pyx_t_6 = 0;
            __Pyx_DECREF(((PyObject *)__pyx_v_pn));
            __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_7);
            __pyx_t_7 = 0;
          } else {
            __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_GOTREF(__pyx_t_7);
            if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_8treedict_8treedict__PTreeNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            if (__Pyx_EndUnpack(__pyx_t_8, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_v_k);
            __pyx_v_k = __pyx_t_6;
            __pyx_t_6 = 0;
            __Pyx_DECREF(((PyObject *)__pyx_v_pn));
            __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_7);
            __pyx_t_7 = 0;
          }

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1370
 *             else:
 *                 for k, pn in self._param_dict.items():
 *                     if b_mode == i_BranchMode_Only:             # <<<<<<<<<<<<<<
 *                         if pn.isBranch():
 *                             self._cut(k)
 */
          switch (__pyx_v_b_mode) {
            case 3:

            /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1371
 *                 for k, pn in self._param_dict.items():
 *                     if b_mode == i_BranchMode_Only:
 *                         if pn.isBranch():             # <<<<<<<<<<<<<<
 *                             self._cut(k)
 *                     elif b_mode == i_BranchMode_None:
 */
            __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isBranch(__pyx_v_pn);
            if (__pyx_t_3) {

              /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1372
 *                     if b_mode == i_BranchMode_Only:
 *                         if pn.isBranch():
 *                             self._cut(k)             # <<<<<<<<<<<<<<
 *                     elif b_mode == i_BranchMode_None:
 *                         if not pn.isBranch():
 */
              if (!(likely(PyString_CheckExact(__pyx_v_k))||((__pyx_v_k) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_k)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_cut(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((PyObject *)__pyx_v_k)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              goto __pyx_L18;
            }
            __pyx_L18:;
            break;

            /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1373
 *                         if pn.isBranch():
 *                             self._cut(k)
 *                     elif b_mode == i_BranchMode_None:             # <<<<<<<<<<<<<<
 *                         if not pn.isBranch():
 *                             self._cut(k)
 */
            case 2:

            /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1374
 *                             self._cut(k)
 *                     elif b_mode == i_BranchMode_None:
 *                         if not pn.isBranch():             # <<<<<<<<<<<<<<
 *                             self._cut(k)
 *         except Exception, e:
 */
            __pyx_t_3 = (!((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isBranch(__pyx_v_pn));
            if (__pyx_t_3) {

              /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1375
 *                     elif b_mode == i_BranchMode_None:
 *                         if not pn.isBranch():
 *                             self._cut(k)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
              if (!(likely(PyString_CheckExact(__pyx_v_k))||((__pyx_v_k) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_k)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_cut(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((PyObject *)__pyx_v_k)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              goto __pyx_L19;
            }
            __pyx_L19:;
            break;
          }
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __pyx_L15:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1376
 *                         if not pn.isBranch():
 *                             self._cut(k)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.clear");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_4;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1377
 *                             self._cut(k)
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     ################################################################################
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.clear");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1382
 *     # Some methods for raising attribute errors at the proper time
 * 
 *     cdef _raiseAttributeError(self, str key):             # <<<<<<<<<<<<<<
 *         raise AttributeError("branch/value/method '%s' does not exist in tree/branch '%s'." % (key, self._branchName(False, True)))
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__raiseAttributeError(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_raiseAttributeError");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1383
 * 
 *     cdef _raiseAttributeError(self, str key):
 *         raise AttributeError("branch/value/method '%s' does not exist in tree/branch '%s'." % (key, self._branchName(False, True)))             # <<<<<<<<<<<<<<
 * 
 *     cdef _raiseErrorAtFirstNonDanglingBranch(self, bint raise_attribute_error):
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_branchName(__pyx_v_self, 0, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_key));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_key));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_key));
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_AttributeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_Raise(__pyx_t_1, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._raiseAttributeError");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1385
 *         raise AttributeError("branch/value/method '%s' does not exist in tree/branch '%s'." % (key, self._branchName(False, True)))
 * 
 *     cdef _raiseErrorAtFirstNonDanglingBranch(self, bint raise_attribute_error):             # <<<<<<<<<<<<<<
 *         cdef TreeDict p = self.parentNode()
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__raiseErrorAtFirstNonDanglingBranch(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_v_raise_attribute_error) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_raiseErrorAtFirstNonDanglingBranch");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1386
 * 
 *     cdef _raiseErrorAtFirstNonDanglingBranch(self, bint raise_attribute_error):
 *         cdef TreeDict p = self.parentNode()             # <<<<<<<<<<<<<<
 * 
 *         if RUN_ASSERTS:
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->parentNode(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1391
 *             assert p is not None
 * 
 *         if not p.isDangling():             # <<<<<<<<<<<<<<
 *             if self.isDangling():
 *                 if raise_attribute_error:
 */
  __pyx_t_2 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->isDangling(__pyx_v_p, 0));
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1392
 * 
 *         if not p.isDangling():
 *             if self.isDangling():             # <<<<<<<<<<<<<<
 *                 if raise_attribute_error:
 *                     p._raiseAttributeError(self._name)
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->isDangling(__pyx_v_self, 0);
    if (__pyx_t_2) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1393
 *         if not p.isDangling():
 *             if self.isDangling():
 *                 if raise_attribute_error:             # <<<<<<<<<<<<<<
 *                     p._raiseAttributeError(self._name)
 *                 else:
 */
      if (__pyx_v_raise_attribute_error) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1394
 *             if self.isDangling():
 *                 if raise_attribute_error:
 *                     p._raiseAttributeError(self._name)             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise KeyError(self._name)
 */
        __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_raiseAttributeError(__pyx_v_p, __pyx_v_self->_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L5;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1396
 *                     p._raiseAttributeError(self._name)
 *                 else:
 *                     raise KeyError(self._name)             # <<<<<<<<<<<<<<
 *         else:
 *             p._raiseErrorAtFirstNonDanglingBranch(raise_attribute_error)
 */
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(((PyObject *)__pyx_v_self->_name));
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->_name));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_name));
        __pyx_t_3 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1398
 *                     raise KeyError(self._name)
 *         else:
 *             p._raiseErrorAtFirstNonDanglingBranch(raise_attribute_error)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_raiseErrorAtFirstNonDanglingBranch(__pyx_v_p, __pyx_v_raise_attribute_error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._raiseErrorAtFirstNonDanglingBranch");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1404
 *     # Detaching and attaching
 * 
 *     def pop(self, str key = None, bint prune_empty = False, bint silent = False):             # <<<<<<<<<<<<<<
 *         """
 *         Detach branch/value `key`, and returns the associated value.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_pop[] = "\n        Detach branch/value `key`, and returns the associated value.\n\n        If `key` is None (default), detach self from parent and return\n        self.\n\n        A TypeError is raised if called on the root node with no name.\n\n        If `prune_empty` is True, and a branch with multiple nodes is\n        given as the key, then all empty branches in the path are also\n        pruned.\n\n        If `silent` is True, then no error is raised if the key is not\n        present.\n\n        The pruned branch / value is returned (or None if `silent` is\n        True and the key does not exist).\n\n        This method is analogous to the `pop` method for dicts (with\n        extra options).\n\n\n        Example::\n\n            >>> from treedict import TreeDict\n            >>> t = TreeDict()\n            >>> t.b.c.d.e.y = 2\n            >>> t.b.c.d.e.pop('y')\n            2\n            >>> \"b.c.d.e.y\" in t\n            False\n            >>> \"b.c.d.e\" in t\n            True\n            >>> t.b.c.d.e.pop()\n            TreeDict <e>\n            >>> \"b.c.d.e\" in t\n            False\n            >>> \"b.c.d\" in t\n            True\n            >>> t.b.c.d.pop(prune_empty = True)\n            TreeDict <d>\n            >>> \"b.c.d\" in t\n            False\n            >>> \"b.c\" in t\n            True\n            >>> t.isEmpty()\n            False\n            >>> t.pop('nothere')\n            KeyError: 'nothere'\n            >>> t.pop('nothere', silent=True)\n        \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_pop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  int __pyx_v_prune_empty;
  int __pyx_v_silent;
  PyObject *__pyx_v_ke;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__prune_empty,&__pyx_n_s__silent,0};
  __Pyx_RefNannySetupContext("pop");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__prune_empty);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__silent);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "pop") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = ((PyObject *)values[0]);
    if (values[1]) {
      __pyx_v_prune_empty = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_prune_empty == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_prune_empty = ((int)0);
    }
    if (values[2]) {
      __pyx_v_silent = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_silent == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_silent = ((int)0);
    }
  } else {
    __pyx_v_key = ((PyObject *)Py_None);
    __pyx_v_prune_empty = ((int)0);
    __pyx_v_silent = ((int)0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_silent = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_silent == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  2: __pyx_v_prune_empty = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_prune_empty == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_key = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pop", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.pop");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_ke = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), &PyString_Type, 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1458
 *         """
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return self._pop(key, False, prune_empty)
 *         except KeyError, ke:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1459
 * 
 *         try:
 *             return self._pop(key, False, prune_empty)             # <<<<<<<<<<<<<<
 *         except KeyError, ke:
 *             if silent:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_pop(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key, 0, __pyx_v_prune_empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L10_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1460
 *         try:
 *             return self._pop(key, False, prune_empty)
 *         except KeyError, ke:             # <<<<<<<<<<<<<<
 *             if silent:
 *                 return None
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.pop");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_ke);
      __pyx_v_ke = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1461
 *             return self._pop(key, False, prune_empty)
 *         except KeyError, ke:
 *             if silent:             # <<<<<<<<<<<<<<
 *                 return None
 *             else:
 */
      if (__pyx_v_silent) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1462
 *         except KeyError, ke:
 *             if silent:
 *                 return None             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ke
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_None);
        __pyx_r = Py_None;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L9_except_return;
        goto __pyx_L16;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1464
 *                 return None
 *             else:
 *                 raise ke             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
        __Pyx_Raise(__pyx_v_ke, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      }
      __pyx_L16:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7_exception_handled;
    }

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1465
 *             else:
 *                 raise ke
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.pop");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1466
 *                 raise ke
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     def popitem(self, str key = None, bint prune_empty = False, bint silent = False):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L9_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.pop");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ke);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1468
 *             raise e
 * 
 *     def popitem(self, str key = None, bint prune_empty = False, bint silent = False):             # <<<<<<<<<<<<<<
 *         """
 *         Same as :meth:`pop()`, except return the pair (`key`, value)
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_popitem(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_popitem[] = "\n        Same as :meth:`pop()`, except return the pair (`key`, value)\n        instead of just the value.\n\n        If `key` is None or not given, detach self from parent and\n        return the pair (name, self), where name is the name of this\n        branch.  \n\n        A TypeError is raised if called on the root node with no name.\n\n        If `prune_empty` is True, and a branch with multiple nodes is\n        given as the key, then all empty branches in the path are also\n        pruned.\n\n        If `silent` is True, then no error is raised if the key is not\n        present.\n\n        The pruned branch / value is returned (or None if `silent` is\n        True and the key does not exist).\n\n        This method is analogous to the `popitem` method for dicts (with\n        extra options).\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_popitem(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  int __pyx_v_prune_empty;
  int __pyx_v_silent;
  PyObject *__pyx_v_ke;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__prune_empty,&__pyx_n_s__silent,0};
  __Pyx_RefNannySetupContext("popitem");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__prune_empty);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__silent);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "popitem") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = ((PyObject *)values[0]);
    if (values[1]) {
      __pyx_v_prune_empty = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_prune_empty == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_prune_empty = ((int)0);
    }
    if (values[2]) {
      __pyx_v_silent = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_silent == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_silent = ((int)0);
    }
  } else {
    __pyx_v_key = ((PyObject *)Py_None);
    __pyx_v_prune_empty = ((int)0);
    __pyx_v_silent = ((int)0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_silent = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_silent == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  2: __pyx_v_prune_empty = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_prune_empty == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_key = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("popitem", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.popitem");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_ke = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), &PyString_Type, 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1493
 *         """
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return self._pop(key, True, prune_empty)
 *         except KeyError, ke:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1494
 * 
 *         try:
 *             return self._pop(key, True, prune_empty)             # <<<<<<<<<<<<<<
 *         except KeyError, ke:
 *             if silent:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_pop(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key, 1, __pyx_v_prune_empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1494; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L10_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1495
 *         try:
 *             return self._pop(key, True, prune_empty)
 *         except KeyError, ke:             # <<<<<<<<<<<<<<
 *             if silent:
 *                 return None
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.popitem");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1495; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_ke);
      __pyx_v_ke = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1496
 *             return self._pop(key, True, prune_empty)
 *         except KeyError, ke:
 *             if silent:             # <<<<<<<<<<<<<<
 *                 return None
 *             else:
 */
      if (__pyx_v_silent) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1497
 *         except KeyError, ke:
 *             if silent:
 *                 return None             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ke
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_None);
        __pyx_r = Py_None;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L9_except_return;
        goto __pyx_L16;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1499
 *                 return None
 *             else:
 *                 raise ke             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
        __Pyx_Raise(__pyx_v_ke, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      }
      __pyx_L16:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7_exception_handled;
    }

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1500
 *             else:
 *                 raise ke
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.popitem");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1501
 *                 raise ke
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     cdef _pop(self, str name, bint return_item_pair, bint prune_empty):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1501; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L9_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.popitem");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_ke);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1503
 *             raise e
 * 
 *     cdef _pop(self, str name, bint return_item_pair, bint prune_empty):             # <<<<<<<<<<<<<<
 * 
 *         cdef TreeDict p
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__pop(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_name, int __pyx_v_return_item_pair, int __pyx_v_prune_empty) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_pop");
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1507
 *         cdef TreeDict p
 * 
 *         if name is None:             # <<<<<<<<<<<<<<
 *             if self.isDangling():
 *                 self._raiseErrorAtFirstNonDanglingBranch(True)
 */
  __pyx_t_1 = (__pyx_v_name == ((PyObject *)Py_None));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1508
 * 
 *         if name is None:
 *             if self.isDangling():             # <<<<<<<<<<<<<<
 *                 self._raiseErrorAtFirstNonDanglingBranch(True)
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->isDangling(__pyx_v_self, 0);
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1509
 *         if name is None:
 *             if self.isDangling():
 *                 self._raiseErrorAtFirstNonDanglingBranch(True)             # <<<<<<<<<<<<<<
 * 
 *             p = self.parentNode()
 */
      __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_raiseErrorAtFirstNonDanglingBranch(__pyx_v_self, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1511
 *                 self._raiseErrorAtFirstNonDanglingBranch(True)
 * 
 *             p = self.parentNode()             # <<<<<<<<<<<<<<
 * 
 *             if p is None:
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->parentNode(__pyx_v_self, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_p));
    __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1513
 *             p = self.parentNode()
 * 
 *             if p is None:             # <<<<<<<<<<<<<<
 *                 raise TypeError("Cannot detach root node.")
 * 
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_p) == Py_None);
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1514
 * 
 *             if p is None:
 *                 raise TypeError("Cannot detach root node.")             # <<<<<<<<<<<<<<
 * 
 *             p._prune(self._name, False)
 */
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_30));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_30));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_30));
      __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __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);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1516
 *                 raise TypeError("Cannot detach root node.")
 * 
 *             p._prune(self._name, False)             # <<<<<<<<<<<<<<
 * 
 *             if return_item_pair:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_prune(__pyx_v_p, __pyx_v_self->_name, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1518
 *             p._prune(self._name, False)
 * 
 *             if return_item_pair:             # <<<<<<<<<<<<<<
 *                 return (self._name, self)
 *             else:
 */
    if (__pyx_v_return_item_pair) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1519
 * 
 *             if return_item_pair:
 *                 return (self._name, self)             # <<<<<<<<<<<<<<
 *             else:
 *                 return self
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(((PyObject *)__pyx_v_self->_name));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->_name));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_name));
      __Pyx_INCREF(((PyObject *)__pyx_v_self));
      PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1521
 *                 return (self._name, self)
 *             else:
 *                 return self             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_self));
      __pyx_r = ((PyObject *)__pyx_v_self);
      goto __pyx_L0;
    }
    __pyx_L6:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1524
 * 
 *         else:
 *             return self._prune(name, prune_empty)             # <<<<<<<<<<<<<<
 * 
 *     cdef _prune(self, str k, bint aggressive):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_prune(__pyx_v_self, __pyx_v_name, __pyx_v_prune_empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._pop");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1526
 *             return self._prune(name, prune_empty)
 * 
 *     cdef _prune(self, str k, bint aggressive):             # <<<<<<<<<<<<<<
 * 
 *         checkKeyNotNone(k)
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__prune(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k, int __pyx_v_aggressive) {
  int __pyx_v_rpos;
  PyObject *__pyx_v_kl;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_bottom;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_b;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p;
  __pyx_t_8treedict_8treedict_flagtype __pyx_v_gsp;
  PyObject *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("_prune");
  __pyx_v_kl = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_bottom = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_b = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1528
 *     cdef _prune(self, str k, bint aggressive):
 * 
 *         checkKeyNotNone(k)             # <<<<<<<<<<<<<<
 * 
 *         cdef int rpos = strrfind(k, '.')
 */
  __pyx_t_1 = __pyx_f_8treedict_8treedict_checkKeyNotNone(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1530
 *         checkKeyNotNone(k)
 * 
 *         cdef int rpos = strrfind(k, '.')             # <<<<<<<<<<<<<<
 *         cdef str kl
 *         cdef TreeDict bottom, b, p
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_k));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_k));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_k));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
  __pyx_t_2 = PyObject_Call(__pyx_v_8treedict_8treedict_strrfind, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rpos = __pyx_t_3;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1534
 *         cdef TreeDict bottom, b, p
 * 
 *         cdef flagtype gsp = f_retrieve_dangling_okay             # <<<<<<<<<<<<<<
 * 
 *         if rpos != -1:
 */
  __pyx_v_gsp = 2;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1536
 *         cdef flagtype gsp = f_retrieve_dangling_okay
 * 
 *         if rpos != -1:             # <<<<<<<<<<<<<<
 * 
 *             b = self._getBranch(k[:rpos], gsp)
 */
  __pyx_t_4 = (__pyx_v_rpos != -1);
  if (__pyx_t_4) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1538
 *         if rpos != -1:
 * 
 *             b = self._getBranch(k[:rpos], gsp)             # <<<<<<<<<<<<<<
 * 
 *             if b is None:
 */
    __pyx_t_2 = PySequence_GetSlice(((PyObject *)__pyx_v_k), 0, __pyx_v_rpos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getBranch(__pyx_v_self, __pyx_t_2, __pyx_v_gsp)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_b));
    __pyx_v_b = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1540
 *             b = self._getBranch(k[:rpos], gsp)
 * 
 *             if b is None:             # <<<<<<<<<<<<<<
 *                 raise KeyError(k)
 * 
 */
    __pyx_t_4 = (((PyObject *)__pyx_v_b) == Py_None);
    if (__pyx_t_4) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1541
 * 
 *             if b is None:
 *                 raise KeyError(k)             # <<<<<<<<<<<<<<
 * 
 *             kl = k[rpos+1:]
 */
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)__pyx_v_k));
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_k));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_k));
      __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1543
 *                 raise KeyError(k)
 * 
 *             kl = k[rpos+1:]             # <<<<<<<<<<<<<<
 *         else:
 *             b = self
 */
    __pyx_t_2 = PySequence_GetSlice(((PyObject *)__pyx_v_k), (__pyx_v_rpos + 1), PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(((PyObject *)__pyx_v_kl));
    __pyx_v_kl = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1545
 *             kl = k[rpos+1:]
 *         else:
 *             b = self             # <<<<<<<<<<<<<<
 *             kl = k
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_DECREF(((PyObject *)__pyx_v_b));
    __pyx_v_b = __pyx_v_self;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1546
 *         else:
 *             b = self
 *             kl = k             # <<<<<<<<<<<<<<
 * 
 *         # The False/True here controls whether it's okay to prune a
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_k));
    __Pyx_DECREF(((PyObject *)__pyx_v_kl));
    __pyx_v_kl = __pyx_v_k;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1550
 *         # The False/True here controls whether it's okay to prune a
 *         # dangling node
 *         if not b._existsLocal(kl, True):             # <<<<<<<<<<<<<<
 *             raise KeyError(k)
 * 
 */
  __pyx_t_4 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->_existsLocal(__pyx_v_b, __pyx_v_kl, 1));
  if (__pyx_t_4) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1551
 *         # dangling node
 *         if not b._existsLocal(kl, True):
 *             raise KeyError(k)             # <<<<<<<<<<<<<<
 * 
 *         v = b._cut(kl)
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_v_k));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_k));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_k));
    __pyx_t_1 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1553
 *             raise KeyError(k)
 * 
 *         v = b._cut(kl)             # <<<<<<<<<<<<<<
 * 
 *         if aggressive:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->_cut(__pyx_v_b, __pyx_v_kl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_v);
  __pyx_v_v = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1555
 *         v = b._cut(kl)
 * 
 *         if aggressive:             # <<<<<<<<<<<<<<
 *             bottom = self._getBottomNode(k)
 * 
 */
  if (__pyx_v_aggressive) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1556
 * 
 *         if aggressive:
 *             bottom = self._getBottomNode(k)             # <<<<<<<<<<<<<<
 * 
 *             while b is not bottom and not b.isRoot() and b.isEmpty():
 */
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getBottomNode(__pyx_v_self, __pyx_v_k)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_v_bottom));
    __pyx_v_bottom = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1558
 *             bottom = self._getBottomNode(k)
 * 
 *             while b is not bottom and not b.isRoot() and b.isEmpty():             # <<<<<<<<<<<<<<
 *                 p = b.parentNode()
 *                 p._cut(b._name)
 */
    while (1) {
      __pyx_t_4 = (__pyx_v_b != __pyx_v_bottom);
      if (__pyx_t_4) {
        __pyx_t_5 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->isRoot(__pyx_v_b, 0));
        if (__pyx_t_5) {
          __pyx_t_6 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->isEmpty(__pyx_v_b, 0);
          __pyx_t_7 = __pyx_t_6;
        } else {
          __pyx_t_7 = __pyx_t_5;
        }
        __pyx_t_5 = __pyx_t_7;
      } else {
        __pyx_t_5 = __pyx_t_4;
      }
      if (!__pyx_t_5) break;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1559
 * 
 *             while b is not bottom and not b.isRoot() and b.isEmpty():
 *                 p = b.parentNode()             # <<<<<<<<<<<<<<
 *                 p._cut(b._name)
 *                 b = p
 */
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->parentNode(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__pyx_v_p));
      __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1560
 *             while b is not bottom and not b.isRoot() and b.isEmpty():
 *                 p = b.parentNode()
 *                 p._cut(b._name)             # <<<<<<<<<<<<<<
 *                 b = p
 * 
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_cut(__pyx_v_p, __pyx_v_b->_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1561
 *                 p = b.parentNode()
 *                 p._cut(b._name)
 *                 b = p             # <<<<<<<<<<<<<<
 * 
 *         return v
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_p));
      __Pyx_DECREF(((PyObject *)__pyx_v_b));
      __pyx_v_b = __pyx_v_p;
    }
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1563
 *                 b = p
 * 
 *         return v             # <<<<<<<<<<<<<<
 * 
 *     def attach(self, tree_or_key = None, TreeDict tree = None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_v);
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._prune");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_kl);
  __Pyx_DECREF((PyObject *)__pyx_v_bottom);
  __Pyx_DECREF((PyObject *)__pyx_v_b);
  __Pyx_DECREF((PyObject *)__pyx_v_p);
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1565
 *         return v
 * 
 *     def attach(self, tree_or_key = None, TreeDict tree = None,             # <<<<<<<<<<<<<<
 *                bint copy = True, bint recursive = False,
 *                bint protect_structure = False):
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_attach(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_attach[] = "\n        Attaches a TreeDict instance to the current node.\n\n        If `tree` is given, then `tree_or_key` must be a string giving\n        the key where the new tree is attached to.  If `tree` is not\n        given, then `tree_or_key` must give the TreeDict instance and\n        the key name is taken from the name of the tree `tree`.  In\n        the case of branches, this name is always the associated key\n        of the branch.\n\n        If `copy` is True (default), the the tree structure (but not\n        the values) is copied from the original.  If `copy` is False,\n        then the given tree must be the root node, in which case it is\n        simply grafted in.\n\n        If `recursive` is true, then all TreeDict instances in the\n        given tree are recursively attached as well.  If a tree is not\n        specified, then the operation is done recursively to the local\n        node.  This operation can be very useful to ensure a\n        consistent tree structure when the tree may have been formed\n        through a mix of branches and TreeDict instances.\n\n        If `protect_structure` is True, then branches cannot overwrite\n        values and vice-versa.  For example, replacing a value with a\n        branch using this function would raise a TypeError.\n        \n        Example 1::\n\n            >>> from treedict import TreeDict\n            >>> t = TreeDict('root')\n            >>> t1 = TreeDict('t1')\n            >>> t.attach(t1, name = \"new_t1\", copy = False)\n            >>> t1.rootNode()\n            TreeDict <root>\n            >>> t.new_t1 is t1\n            True\n\n        Example 2::\n        \n            >>> from treedict import TreeDict\n            >>> t = TreeDict('root')\n            >>> t1 = TreeDict('t1')\n            >>> t.attach(t1, copy = True)\n            >>> t1.rootNode()\n            TreeDict <t1>\n            >>> t.t1 is t1\n            False\n            >>> t.t1.rootNode()\n            TreeDict <root>\n\n        Exam""ple 3::\n        \n            >>> from treedict import TreeDict\n            >>> t = TreeDict('root')\n            >>> t1 = TreeDict('t1', x1 = 1, y1 = 2)\n            >>> t2 = TreeDict('t2', x2 = 10, y2 = 20)\n            >>> t.a = 1\n            >>> t.t1 = t1\n            >>> t.attach(t2)\n            >>> print t.makeReport()\n            a     = 1\n            t1    = TreeDict <t1>\n            t2.x2 = 10\n            t2.y2 = 20\n            >>> t.attach(recursive = True)\n            >>> print t.makeReport()\n            a     = 1\n            t1.y1 = 2\n            t1.x1 = 1\n            t2.x2 = 10\n            t2.y2 = 20\n            \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_attach(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tree_or_key = 0;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_tree = 0;
  int __pyx_v_copy;
  int __pyx_v_recursive;
  int __pyx_v_protect_structure;
  PyObject *__pyx_v_key;
  __pyx_t_8treedict_8treedict_flagtype __pyx_v_flags;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree_or_key,&__pyx_n_s__tree,&__pyx_n_s__copy,&__pyx_n_s__recursive,&__pyx_n_s__protect_structure,0};
  __Pyx_RefNannySetupContext("attach");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = (PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree_or_key);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
        if (value) { values[2] = value; kw_args--; }
      }
      case  3:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recursive);
        if (value) { values[3] = value; kw_args--; }
      }
      case  4:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__protect_structure);
        if (value) { values[4] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "attach") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_tree_or_key = values[0];
    __pyx_v_tree = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)values[1]);
    if (values[2]) {
      __pyx_v_copy = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_copy == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1566
 * 
 *     def attach(self, tree_or_key = None, TreeDict tree = None,
 *                bint copy = True, bint recursive = False,             # <<<<<<<<<<<<<<
 *                bint protect_structure = False):
 *         """
 */
      __pyx_v_copy = ((int)1);
    }
    if (values[3]) {
      __pyx_v_recursive = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_recursive = ((int)0);
    }
    if (values[4]) {
      __pyx_v_protect_structure = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_protect_structure == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1567
 *     def attach(self, tree_or_key = None, TreeDict tree = None,
 *                bint copy = True, bint recursive = False,
 *                bint protect_structure = False):             # <<<<<<<<<<<<<<
 *         """
 *         Attaches a TreeDict instance to the current node.
 */
      __pyx_v_protect_structure = ((int)0);
    }
  } else {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1565
 *         return v
 * 
 *     def attach(self, tree_or_key = None, TreeDict tree = None,             # <<<<<<<<<<<<<<
 *                bint copy = True, bint recursive = False,
 *                bint protect_structure = False):
 */
    __pyx_v_tree_or_key = ((PyObject *)Py_None);
    __pyx_v_tree = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1566
 * 
 *     def attach(self, tree_or_key = None, TreeDict tree = None,
 *                bint copy = True, bint recursive = False,             # <<<<<<<<<<<<<<
 *                bint protect_structure = False):
 *         """
 */
    __pyx_v_copy = ((int)1);
    __pyx_v_recursive = ((int)0);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1567
 *     def attach(self, tree_or_key = None, TreeDict tree = None,
 *                bint copy = True, bint recursive = False,
 *                bint protect_structure = False):             # <<<<<<<<<<<<<<
 *         """
 *         Attaches a TreeDict instance to the current node.
 */
    __pyx_v_protect_structure = ((int)0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  5: __pyx_v_protect_structure = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_protect_structure == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  4: __pyx_v_recursive = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  3: __pyx_v_copy = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_copy == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  2: __pyx_v_tree = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)PyTuple_GET_ITEM(__pyx_args, 1));
      case  1: __pyx_v_tree_or_key = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("attach", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.attach");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_tree);
  __pyx_v_key = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tree), __pyx_ptype_8treedict_8treedict_TreeDict, 1, "tree", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1645
 *         cdef flagtype flags
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if tree_or_key is None and tree is None:
 *                 if recursive:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1646
 * 
 *         try:
 *             if tree_or_key is None and tree is None:             # <<<<<<<<<<<<<<
 *                 if recursive:
 *                     self._recursiveAttach(f_copy if copy else 0)
 */
      __pyx_t_1 = (__pyx_v_tree_or_key == Py_None);
      if (__pyx_t_1) {
        __pyx_t_2 = (((PyObject *)__pyx_v_tree) == Py_None);
        __pyx_t_3 = __pyx_t_2;
      } else {
        __pyx_t_3 = __pyx_t_1;
      }
      if (__pyx_t_3) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1647
 *         try:
 *             if tree_or_key is None and tree is None:
 *                 if recursive:             # <<<<<<<<<<<<<<
 *                     self._recursiveAttach(f_copy if copy else 0)
 *                     return
 */
        if (__pyx_v_recursive) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1648
 *             if tree_or_key is None and tree is None:
 *                 if recursive:
 *                     self._recursiveAttach(f_copy if copy else 0)             # <<<<<<<<<<<<<<
 *                     return
 *                 else:
 */
          if (__pyx_v_copy) {
            __pyx_t_4 = 128;
          } else {
            __pyx_t_4 = 0;
          }
          __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_recursiveAttach(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1648; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1649
 *                 if recursive:
 *                     self._recursiveAttach(f_copy if copy else 0)
 *                     return             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise TypeError("Either `recursive` must be True or a tree or key must be given.")
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_r = Py_None; __Pyx_INCREF(Py_None);
          goto __pyx_L10_try_return;
          goto __pyx_L15;
        }
        /*else*/ {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1651
 *                     return
 *                 else:
 *                     raise TypeError("Either `recursive` must be True or a tree or key must be given.")             # <<<<<<<<<<<<<<
 * 
 *             if type(tree_or_key) is str:
 */
          __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
          PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_31));
          __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31));
          __pyx_t_6 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_Raise(__pyx_t_6, 0, 0);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        }
        __pyx_L15:;
        goto __pyx_L14;
      }
      __pyx_L14:;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1653
 *                     raise TypeError("Either `recursive` must be True or a tree or key must be given.")
 * 
 *             if type(tree_or_key) is str:             # <<<<<<<<<<<<<<
 *                 key = <str>tree_or_key
 *             elif type(tree_or_key) is TreeDict:
 */
      __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_tree_or_key)) == ((PyObject *)((PyObject*)&PyString_Type)));
      if (__pyx_t_3) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1654
 * 
 *             if type(tree_or_key) is str:
 *                 key = <str>tree_or_key             # <<<<<<<<<<<<<<
 *             elif type(tree_or_key) is TreeDict:
 *                 if tree is not None:
 */
        __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_v_tree_or_key)));
        __Pyx_DECREF(((PyObject *)__pyx_v_key));
        __pyx_v_key = ((PyObject *)__pyx_v_tree_or_key);
        goto __pyx_L16;
      }

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1655
 *             if type(tree_or_key) is str:
 *                 key = <str>tree_or_key
 *             elif type(tree_or_key) is TreeDict:             # <<<<<<<<<<<<<<
 *                 if tree is not None:
 *                     raise TypeError("Only one TreeDict instance can be given to attach.")
 */
      __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_tree_or_key)) == ((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict_TreeDict)));
      if (__pyx_t_3) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1656
 *                 key = <str>tree_or_key
 *             elif type(tree_or_key) is TreeDict:
 *                 if tree is not None:             # <<<<<<<<<<<<<<
 *                     raise TypeError("Only one TreeDict instance can be given to attach.")
 * 
 */
        __pyx_t_3 = (((PyObject *)__pyx_v_tree) != Py_None);
        if (__pyx_t_3) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1657
 *             elif type(tree_or_key) is TreeDict:
 *                 if tree is not None:
 *                     raise TypeError("Only one TreeDict instance can be given to attach.")             # <<<<<<<<<<<<<<
 * 
 *                 tree = <TreeDict>tree_or_key
 */
          __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1657; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_INCREF(((PyObject *)__pyx_kp_s_32));
          PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_32));
          __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
          __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1657; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_Raise(__pyx_t_5, 0, 0);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1657; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          goto __pyx_L17;
        }
        __pyx_L17:;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1659
 *                     raise TypeError("Only one TreeDict instance can be given to attach.")
 * 
 *                 tree = <TreeDict>tree_or_key             # <<<<<<<<<<<<<<
 *                 key = None
 *             else:
 */
        __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_tree_or_key)));
        __Pyx_DECREF(((PyObject *)__pyx_v_tree));
        __pyx_v_tree = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_tree_or_key);

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1660
 * 
 *                 tree = <TreeDict>tree_or_key
 *                 key = None             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError("`tree_or_key` must be either a string or TreeDict instance.")
 */
        __Pyx_INCREF(Py_None);
        __Pyx_DECREF(((PyObject *)__pyx_v_key));
        __pyx_v_key = ((PyObject *)Py_None);
        goto __pyx_L16;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1662
 *                 key = None
 *             else:
 *                 raise TypeError("`tree_or_key` must be either a string or TreeDict instance.")             # <<<<<<<<<<<<<<
 * 
 *             if key is None:
 */
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_33));
        PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_33));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_33));
        __pyx_t_6 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_Raise(__pyx_t_6, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      }
      __pyx_L16:;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1664
 *                 raise TypeError("`tree_or_key` must be either a string or TreeDict instance.")
 * 
 *             if key is None:             # <<<<<<<<<<<<<<
 *                 if RUN_ASSERTS:
 *                     assert tree is not None
 */
      __pyx_t_3 = (__pyx_v_key == ((PyObject *)Py_None));
      if (__pyx_t_3) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1668
 *                     assert tree is not None
 * 
 *                 key = tree._name             # <<<<<<<<<<<<<<
 * 
 *             if tree is None:
 */
        __Pyx_INCREF(((PyObject *)__pyx_v_tree->_name));
        __Pyx_DECREF(((PyObject *)__pyx_v_key));
        __pyx_v_key = __pyx_v_tree->_name;
        goto __pyx_L18;
      }
      __pyx_L18:;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1670
 *                 key = tree._name
 * 
 *             if tree is None:             # <<<<<<<<<<<<<<
 *                 if RUN_ASSERTS:
 *                     assert key is not None
 */
      __pyx_t_3 = (((PyObject *)__pyx_v_tree) == Py_None);
      if (__pyx_t_3) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1674
 *                     assert key is not None
 * 
 *                 tree = self._get(key, False)             # <<<<<<<<<<<<<<
 * 
 *             flags = ((f_copy if copy else 0)
 */
        __pyx_t_6 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_get(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_6);
        if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_8treedict_8treedict_TreeDict))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_DECREF(((PyObject *)__pyx_v_tree));
        __pyx_v_tree = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_6);
        __pyx_t_6 = 0;
        goto __pyx_L19;
      }
      __pyx_L19:;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1676
 *                 tree = self._get(key, False)
 * 
 *             flags = ((f_copy if copy else 0)             # <<<<<<<<<<<<<<
 *                      | (f_protect_structure if protect_structure else 0))
 * 
 */
      if (__pyx_v_copy) {
        __pyx_t_4 = 128;
      } else {
        __pyx_t_4 = 0;
      }

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1677
 * 
 *             flags = ((f_copy if copy else 0)
 *                      | (f_protect_structure if protect_structure else 0))             # <<<<<<<<<<<<<<
 * 
 *             if recursive:
 */
      if (__pyx_v_protect_structure) {
        __pyx_t_7 = 64;
      } else {
        __pyx_t_7 = 0;
      }
      __pyx_v_flags = (__pyx_t_4 | __pyx_t_7);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1679
 *                      | (f_protect_structure if protect_structure else 0))
 * 
 *             if recursive:             # <<<<<<<<<<<<<<
 *                 tree._recursiveAttach(f_copy if copy else 0)
 * 
 */
      if (__pyx_v_recursive) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1680
 * 
 *             if recursive:
 *                 tree._recursiveAttach(f_copy if copy else 0)             # <<<<<<<<<<<<<<
 * 
 *             self._attach(key, tree, flags)
 */
        if (__pyx_v_copy) {
          __pyx_t_7 = 128;
        } else {
          __pyx_t_7 = 0;
        }
        __pyx_t_6 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_tree->__pyx_vtab)->_recursiveAttach(__pyx_v_tree, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L20;
      }
      __pyx_L20:;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1682
 *                 tree._recursiveAttach(f_copy if copy else 0)
 * 
 *             self._attach(key, tree, flags)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
      __pyx_t_6 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_attach(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key, __pyx_v_tree, __pyx_v_flags); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1683
 * 
 *             self._attach(key, tree, flags)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.attach");
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_5;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1684
 *             self._attach(key, tree, flags)
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     cdef _attach(self, str name, TreeDict tree, flagtype flags):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1684; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.attach");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_key);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_DECREF((PyObject *)__pyx_v_tree);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1686
 *             raise e
 * 
 *     cdef _attach(self, str name, TreeDict tree, flagtype flags):             # <<<<<<<<<<<<<<
 * 
 *         if tree is None:
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__attach(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_name, struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_tree, __pyx_t_8treedict_8treedict_flagtype __pyx_v_flags) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_b;
  PyObject *__pyx_v_attach_name;
  PyObject *__pyx_v_old_name = 0;
  int __pyx_v_copy;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_attach");
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_INCREF((PyObject *)__pyx_v_tree);
  __pyx_v_b = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_attach_name = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1688
 *     cdef _attach(self, str name, TreeDict tree, flagtype flags):
 * 
 *         if tree is None:             # <<<<<<<<<<<<<<
 *             raise TypeError("TreeDict instance expected, got NoneType.")
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_tree) == Py_None);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1689
 * 
 *         if tree is None:
 *             raise TypeError("TreeDict instance expected, got NoneType.")             # <<<<<<<<<<<<<<
 * 
 *         cdef TreeDict b
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_34));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34));
    __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1689; __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);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1695
 * 
 *         # Get the base node to attach into
 *         if name is None:             # <<<<<<<<<<<<<<
 *             name        = tree._name
 *             attach_name = tree._name
 */
  __pyx_t_1 = (__pyx_v_name == ((PyObject *)Py_None));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1696
 *         # Get the base node to attach into
 *         if name is None:
 *             name        = tree._name             # <<<<<<<<<<<<<<
 *             attach_name = tree._name
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_tree->_name));
    __Pyx_DECREF(((PyObject *)__pyx_v_name));
    __pyx_v_name = __pyx_v_tree->_name;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1697
 *         if name is None:
 *             name        = tree._name
 *             attach_name = tree._name             # <<<<<<<<<<<<<<
 * 
 *             if not isValidName(name):
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_tree->_name));
    __Pyx_DECREF(((PyObject *)__pyx_v_attach_name));
    __pyx_v_attach_name = __pyx_v_tree->_name;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1699
 *             attach_name = tree._name
 * 
 *             if not isValidName(name):             # <<<<<<<<<<<<<<
 *                 raise NameError(("Name of tree to be attached in ('%s') "
 *                                  "not valid branch name, so alternate name must be given." )
 */
    __pyx_t_1 = (!__pyx_f_8treedict_8treedict_isValidName(__pyx_v_name));
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1702
 *                 raise NameError(("Name of tree to be attached in ('%s') "
 *                                  "not valid branch name, so alternate name must be given." )
 *                                 % name)             # <<<<<<<<<<<<<<
 *             b = self
 *         else:
 */
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), ((PyObject *)__pyx_v_name)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_builtin_NameError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __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);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1703
 *                                  "not valid branch name, so alternate name must be given." )
 *                                 % name)
 *             b = self             # <<<<<<<<<<<<<<
 *         else:
 *             b = self._getBaseOf(
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_DECREF(((PyObject *)__pyx_v_b));
    __pyx_v_b = __pyx_v_self;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1706
 *         else:
 *             b = self._getBaseOf(
 *                 name, flags | f_retrieve_dangling_okay | f_create_node_if_needed | f_atomic_set)             # <<<<<<<<<<<<<<
 *             attach_name = self._shortKeyName(name)
 * 
 */
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getBaseOf(__pyx_v_self, __pyx_v_name, (((__pyx_v_flags | 2) | 1) | 4))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_v_b));
    __pyx_v_b = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1707
 *             b = self._getBaseOf(
 *                 name, flags | f_retrieve_dangling_okay | f_create_node_if_needed | f_atomic_set)
 *             attach_name = self._shortKeyName(name)             # <<<<<<<<<<<<<<
 * 
 *         # Need to do some gymnastics as the dry_run may fail if the
 */
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_shortKeyName(__pyx_v_self, __pyx_v_name)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_v_attach_name));
    __pyx_v_attach_name = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L4:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1713
 *         # it back when we're done checking.
 * 
 *         cdef str old_name = tree._name             # <<<<<<<<<<<<<<
 *         cdef bint copy = ((flags & f_copy) != 0)
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_tree->_name));
  __pyx_v_old_name = __pyx_v_tree->_name;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1714
 * 
 *         cdef str old_name = tree._name
 *         cdef bint copy = ((flags & f_copy) != 0)             # <<<<<<<<<<<<<<
 * 
 *         if (f_already_checked & flags) == 0:
 */
  __pyx_v_copy = ((__pyx_v_flags & 128) != 0);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1716
 *         cdef bint copy = ((flags & f_copy) != 0)
 * 
 *         if (f_already_checked & flags) == 0:             # <<<<<<<<<<<<<<
 * 
 *             tree._name = attach_name
 */
  __pyx_t_1 = ((32 & __pyx_v_flags) == 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1718
 *         if (f_already_checked & flags) == 0:
 * 
 *             tree._name = attach_name             # <<<<<<<<<<<<<<
 * 
 *             try:
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_attach_name));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_attach_name));
    __Pyx_GOTREF(__pyx_v_tree->_name);
    __Pyx_DECREF(((PyObject *)__pyx_v_tree->_name));
    __pyx_v_tree->_name = __pyx_v_attach_name;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1720
 *             tree._name = attach_name
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 b._setLocalBranch(tree, flags | f_check_only)
 * 
 */
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1721
 * 
 *             try:
 *                 b._setLocalBranch(tree, flags | f_check_only)             # <<<<<<<<<<<<<<
 * 
 *                 if (not copy and tree._inPathToRoot(b)) or b._inPathToRoot(tree):
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->_setLocalBranch(__pyx_v_b, __pyx_v_tree, (__pyx_v_flags | 8)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L8;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1723
 *                 b._setLocalBranch(tree, flags | f_check_only)
 * 
 *                 if (not copy and tree._inPathToRoot(b)) or b._inPathToRoot(tree):             # <<<<<<<<<<<<<<
 *                     raise ValueError("Attaching to a child or parent node forbidden.")
 * 
 */
      __pyx_t_1 = (!__pyx_v_copy);
      if (__pyx_t_1) {
        __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_tree->__pyx_vtab)->_inPathToRoot(__pyx_v_tree, __pyx_v_b);
        __pyx_t_5 = __pyx_t_4;
      } else {
        __pyx_t_5 = __pyx_t_1;
      }
      if (!__pyx_t_5) {
        __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->_inPathToRoot(__pyx_v_b, __pyx_v_tree);
        __pyx_t_4 = __pyx_t_1;
      } else {
        __pyx_t_4 = __pyx_t_5;
      }
      if (__pyx_t_4) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1724
 * 
 *                 if (not copy and tree._inPathToRoot(b)) or b._inPathToRoot(tree):
 *                     raise ValueError("Attaching to a child or parent node forbidden.")             # <<<<<<<<<<<<<<
 * 
 *                 if not copy and tree.rootNode() is b.rootNode():
 */
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_36));
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_36));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_36));
        __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_2, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L8;}
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1726
 *                     raise ValueError("Attaching to a child or parent node forbidden.")
 * 
 *                 if not copy and tree.rootNode() is b.rootNode():             # <<<<<<<<<<<<<<
 *                     raise ValueError("Attaching a tree with same root requires copy.")
 * 
 */
      __pyx_t_4 = (!__pyx_v_copy);
      if (__pyx_t_4) {
        __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_tree->__pyx_vtab)->rootNode(__pyx_v_tree, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->rootNode(__pyx_v_b, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = (((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2) == ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_3));
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_1 = __pyx_t_5;
      } else {
        __pyx_t_1 = __pyx_t_4;
      }
      if (__pyx_t_1) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1727
 * 
 *                 if not copy and tree.rootNode() is b.rootNode():
 *                     raise ValueError("Attaching a tree with same root requires copy.")             # <<<<<<<<<<<<<<
 * 
 *                 if not copy and tree._parent is not None:
 */
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_37));
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_37));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_37));
        __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_2, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L8;}
        goto __pyx_L11;
      }
      __pyx_L11:;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1729
 *                     raise ValueError("Attaching a tree with same root requires copy.")
 * 
 *                 if not copy and tree._parent is not None:             # <<<<<<<<<<<<<<
 *                     raise ValueError("Tree to be attached (%s) must be copied or be a root tree."
 *                                      % name)
 */
      __pyx_t_1 = (!__pyx_v_copy);
      if (__pyx_t_1) {
        __pyx_t_4 = (((PyObject *)__pyx_v_tree->_parent) != Py_None);
        __pyx_t_5 = __pyx_t_4;
      } else {
        __pyx_t_5 = __pyx_t_1;
      }
      if (__pyx_t_5) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1731
 *                 if not copy and tree._parent is not None:
 *                     raise ValueError("Tree to be attached (%s) must be copied or be a root tree."
 *                                      % name)             # <<<<<<<<<<<<<<
 *             finally:
 *                 tree._name = old_name
 */
        __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_38), ((PyObject *)__pyx_v_name)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
        __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_2, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L8;}
        goto __pyx_L12;
      }
      __pyx_L12:;
    }

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1733
 *                                      % name)
 *             finally:
 *                 tree._name = old_name             # <<<<<<<<<<<<<<
 * 
 *         if (f_check_only & flags) == 0:
 */
    /*finally:*/ {
      int __pyx_why;
      PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
      int __pyx_exc_lineno;
      __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
      __pyx_why = 0; goto __pyx_L9;
      __pyx_L8: {
        __pyx_why = 4;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
        __pyx_exc_lineno = __pyx_lineno;
        goto __pyx_L9;
      }
      __pyx_L9:;
      __Pyx_INCREF(((PyObject *)__pyx_v_old_name));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_old_name));
      __Pyx_GOTREF(__pyx_v_tree->_name);
      __Pyx_DECREF(((PyObject *)__pyx_v_tree->_name));
      __pyx_v_tree->_name = __pyx_v_old_name;
      switch (__pyx_why) {
        case 4: {
          __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
          __pyx_lineno = __pyx_exc_lineno;
          __pyx_exc_type = 0;
          __pyx_exc_value = 0;
          __pyx_exc_tb = 0;
          goto __pyx_L1_error;
        }
      }
    }
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1735
 *                 tree._name = old_name
 * 
 *         if (f_check_only & flags) == 0:             # <<<<<<<<<<<<<<
 * 
 *             if copy:
 */
  __pyx_t_5 = ((8 & __pyx_v_flags) == 0);
  if (__pyx_t_5) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1737
 *         if (f_check_only & flags) == 0:
 * 
 *             if copy:             # <<<<<<<<<<<<<<
 *                 tree = tree._copy(False, False)
 * 
 */
    if (__pyx_v_copy) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1738
 * 
 *             if copy:
 *                 tree = tree._copy(False, False)             # <<<<<<<<<<<<<<
 * 
 *             tree._name = attach_name
 */
      __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_tree->__pyx_vtab)->_copy(__pyx_v_tree, 0, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_v_tree));
      __pyx_v_tree = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L15;
    }
    __pyx_L15:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1740
 *                 tree = tree._copy(False, False)
 * 
 *             tree._name = attach_name             # <<<<<<<<<<<<<<
 *             tree._resetParentNode(b)
 *             b._setLocalBranch(tree, flags | f_already_checked)
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_attach_name));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_attach_name));
    __Pyx_GOTREF(__pyx_v_tree->_name);
    __Pyx_DECREF(((PyObject *)__pyx_v_tree->_name));
    __pyx_v_tree->_name = __pyx_v_attach_name;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1741
 * 
 *             tree._name = attach_name
 *             tree._resetParentNode(b)             # <<<<<<<<<<<<<<
 *             b._setLocalBranch(tree, flags | f_already_checked)
 * 
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_tree->__pyx_vtab)->_resetParentNode(__pyx_v_tree, __pyx_v_b);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1742
 *             tree._name = attach_name
 *             tree._resetParentNode(b)
 *             b._setLocalBranch(tree, flags | f_already_checked)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->_setLocalBranch(__pyx_v_b, __pyx_v_tree, (__pyx_v_flags | 32)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L14;
  }
  __pyx_L14:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._attach");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_b);
  __Pyx_DECREF(__pyx_v_attach_name);
  __Pyx_XDECREF(__pyx_v_old_name);
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_DECREF((PyObject *)__pyx_v_tree);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1745
 * 
 * 
 *     cdef _recursiveAttach(self, flagtype flags):             # <<<<<<<<<<<<<<
 * 
 *         self._ensureWriteable(None)
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__recursiveAttach(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, __pyx_t_8treedict_8treedict_flagtype __pyx_v_flags) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  PyObject *__pyx_v_k;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  void *__pyx_t_3;
  void *__pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_recursiveAttach");
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1747
 *     cdef _recursiveAttach(self, flagtype flags):
 * 
 *         self._ensureWriteable(None)             # <<<<<<<<<<<<<<
 * 
 *         cdef _PTreeNode pn
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_ensureWriteable(__pyx_v_self, ((PyObject *)Py_None)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1751
 *         cdef _PTreeNode pn
 * 
 *         for k, pn in self._param_dict.iteritems():             # <<<<<<<<<<<<<<
 *             if pn.isTree():
 *                 pn.tree()._recursiveAttach(flags)
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_param_dict));
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_param_dict);
  __pyx_t_2 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_1, (&__pyx_t_2), ((PyObject **)(&__pyx_t_3)), ((PyObject **)(&__pyx_t_4)))) break;
    __Pyx_INCREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_v_k);
    __pyx_v_k = ((PyObject *)__pyx_t_3);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_4), __pyx_ptype_8treedict_8treedict__PTreeNode)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_4)));
    __Pyx_DECREF(((PyObject *)__pyx_v_pn));
    __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_4);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1752
 * 
 *         for k, pn in self._param_dict.iteritems():
 *             if pn.isTree():             # <<<<<<<<<<<<<<
 *                 pn.tree()._recursiveAttach(flags)
 *             if pn.isNonBranchTree():
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isTree(__pyx_v_pn);
    if (__pyx_t_5) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1753
 *         for k, pn in self._param_dict.iteritems():
 *             if pn.isTree():
 *                 pn.tree()._recursiveAttach(flags)             # <<<<<<<<<<<<<<
 *             if pn.isNonBranchTree():
 *                 self._attach(<str>k, pn.tree(), flags)
 */
      __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_6)->__pyx_vtab)->_recursiveAttach(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_6), __pyx_v_flags); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1754
 *             if pn.isTree():
 *                 pn.tree()._recursiveAttach(flags)
 *             if pn.isNonBranchTree():             # <<<<<<<<<<<<<<
 *                 self._attach(<str>k, pn.tree(), flags)
 * 
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isNonBranchTree(__pyx_v_pn);
    if (__pyx_t_5) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1755
 *                 pn.tree()._recursiveAttach(flags)
 *             if pn.isNonBranchTree():
 *                 self._attach(<str>k, pn.tree(), flags)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_attach(__pyx_v_self, ((PyObject *)__pyx_v_k), ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_7), __pyx_v_flags); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._recursiveAttach");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1758
 * 
 * 
 *     cdef bint _inPathToRoot(self, TreeDict p):             # <<<<<<<<<<<<<<
 *         if self.isRoot():
 *             return (self is p)
 */

static  int __pyx_f_8treedict_8treedict_8TreeDict__inPathToRoot(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_inPathToRoot");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1759
 * 
 *     cdef bint _inPathToRoot(self, TreeDict p):
 *         if self.isRoot():             # <<<<<<<<<<<<<<
 *             return (self is p)
 *         else:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->isRoot(__pyx_v_self, 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1760
 *     cdef bint _inPathToRoot(self, TreeDict p):
 *         if self.isRoot():
 *             return (self is p)             # <<<<<<<<<<<<<<
 *         else:
 *             if self is p:
 */
    __pyx_t_1 = (__pyx_v_self == __pyx_v_p);
    __pyx_r = __pyx_t_1;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1762
 *             return (self is p)
 *         else:
 *             if self is p:             # <<<<<<<<<<<<<<
 *                 return True
 *             else:
 */
    __pyx_t_1 = (__pyx_v_self == __pyx_v_p);
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1763
 *         else:
 *             if self is p:
 *                 return True             # <<<<<<<<<<<<<<
 *             else:
 *                 return self._parent._inPathToRoot(p)
 */
      __pyx_r = 1;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1765
 *                 return True
 *             else:
 *                 return self._parent._inPathToRoot(p)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _resetParentNode(self, TreeDict new_parent):
 */
      __pyx_r = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->_parent->__pyx_vtab)->_inPathToRoot(__pyx_v_self->_parent, __pyx_v_p);
      goto __pyx_L0;
    }
    __pyx_L4:;
  }
  __pyx_L3:;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1767
 *                 return self._parent._inPathToRoot(p)
 * 
 *     cdef void _resetParentNode(self, TreeDict new_parent):             # <<<<<<<<<<<<<<
 *         self._parent = new_parent
 * 
 */

static  void __pyx_f_8treedict_8treedict_8TreeDict__resetParentNode(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_new_parent) {
  __Pyx_RefNannySetupContext("_resetParentNode");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1768
 * 
 *     cdef void _resetParentNode(self, TreeDict new_parent):
 *         self._parent = new_parent             # <<<<<<<<<<<<<<
 * 
 *     cdef str _shortKeyName(self, str key):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_new_parent));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_new_parent));
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_v_self->_parent = __pyx_v_new_parent;

  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1770
 *         self._parent = new_parent
 * 
 *     cdef str _shortKeyName(self, str key):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the name of the object, just not within.
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__shortKeyName(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_v_pos;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_shortKeyName");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1775
 *         """
 * 
 *         cdef int pos = strrfind(key, '.')             # <<<<<<<<<<<<<<
 *         if pos == -1:
 *             return key
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_key));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_key));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_key));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
  __pyx_t_2 = PyObject_Call(__pyx_v_8treedict_8treedict_strrfind, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_pos = __pyx_t_3;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1776
 * 
 *         cdef int pos = strrfind(key, '.')
 *         if pos == -1:             # <<<<<<<<<<<<<<
 *             return key
 *         else:
 */
  __pyx_t_4 = (__pyx_v_pos == -1);
  if (__pyx_t_4) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1777
 *         cdef int pos = strrfind(key, '.')
 *         if pos == -1:
 *             return key             # <<<<<<<<<<<<<<
 *         else:
 *             return key[pos+1:]
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_key));
    __pyx_r = __pyx_v_key;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1779
 *             return key
 *         else:
 *             return key[pos+1:]             # <<<<<<<<<<<<<<
 * 
 *     ################################################################################
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_2 = PySequence_GetSlice(((PyObject *)__pyx_v_key), (__pyx_v_pos + 1), PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._shortKeyName");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1785
 * 
 *     # Freezing
 *     cpdef bint isFrozen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns True if the current branch is frozen, and False
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isFrozen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  int __pyx_f_8treedict_8treedict_8TreeDict_isFrozen(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("isFrozen");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__isFrozen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_isFrozen)) {
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1792
 *         """
 * 
 *         return _flagOn(&self._flags, f_is_frozen)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setFrozen(self, bint frozen):
 */
  __pyx_r = __pyx_f_8treedict_8treedict__flagOn((&__pyx_v_self->_flags), 1);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict.isFrozen");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1785
 * 
 *     # Freezing
 *     cpdef bint isFrozen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns True if the current branch is frozen, and False
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isFrozen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_isFrozen[] = "\n        Returns True if the current branch is frozen, and False\n        otherwise. Like a tuple or other immutable python containers,\n        the structure and values in a frozen tree cannot be changed.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isFrozen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("isFrozen");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->isFrozen(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.isFrozen");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1794
 *         return _flagOn(&self._flags, f_is_frozen)
 * 
 *     cdef void _setFrozen(self, bint frozen):             # <<<<<<<<<<<<<<
 *         _setFlag(&self._flags, f_is_frozen, frozen)
 * 
 */

static  void __pyx_f_8treedict_8treedict_8TreeDict__setFrozen(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_v_frozen) {
  __Pyx_RefNannySetupContext("_setFrozen");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1795
 * 
 *     cdef void _setFrozen(self, bint frozen):
 *         _setFlag(&self._flags, f_is_frozen, frozen)             # <<<<<<<<<<<<<<
 * 
 *     # Dangling
 */
  __pyx_f_8treedict_8treedict__setFlag((&__pyx_v_self->_flags), 1, __pyx_v_frozen);

  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1798
 * 
 *     # Dangling
 *     cpdef bint isDangling(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns True if this branch was created implicitly and is
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isDangling(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  int __pyx_f_8treedict_8treedict_8TreeDict_isDangling(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("isDangling");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__isDangling); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_isDangling)) {
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1812
 * 
 *         """
 *         return _flagOn(&self._flags, f_is_dangling)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setDangling(self, bint dangling):
 */
  __pyx_r = __pyx_f_8treedict_8treedict__flagOn((&__pyx_v_self->_flags), 2);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict.isDangling");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1798
 * 
 *     # Dangling
 *     cpdef bint isDangling(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns True if this branch was created implicitly and is
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isDangling(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_isDangling[] = "\n        Returns True if this branch was created implicitly and is\n        still dangling, and False otherwise.  Example:\n\n          >>> t = TreeDict()\n          >>> b = t.a\n          >>> t.a.isDangling()\n          True\n          >>> t.a.v = 1\n          >>> t.a.isDangling()\n          False\n          \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isDangling(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("isDangling");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->isDangling(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.isDangling");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1814
 *         return _flagOn(&self._flags, f_is_dangling)
 * 
 *     cdef void _setDangling(self, bint dangling):             # <<<<<<<<<<<<<<
 *         _setFlag(&self._flags, f_is_dangling, dangling)
 * 
 */

static  void __pyx_f_8treedict_8treedict_8TreeDict__setDangling(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_v_dangling) {
  __Pyx_RefNannySetupContext("_setDangling");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1815
 * 
 *     cdef void _setDangling(self, bint dangling):
 *         _setFlag(&self._flags, f_is_dangling, dangling)             # <<<<<<<<<<<<<<
 * 
 *     # Detached Dangling
 */
  __pyx_f_8treedict_8treedict__setFlag((&__pyx_v_self->_flags), 2, __pyx_v_dangling);

  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1818
 * 
 *     # Detached Dangling
 *     cpdef bint _isDetachedDangling(self):             # <<<<<<<<<<<<<<
 *         return _flagOn(&self._flags, f_is_detached_dangling)
 * 
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__isDetachedDangling(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  int __pyx_f_8treedict_8treedict_8TreeDict__isDetachedDangling(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_isDetachedDangling");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isDetachedDangling); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict__isDetachedDangling)) {
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1819
 *     # Detached Dangling
 *     cpdef bint _isDetachedDangling(self):
 *         return _flagOn(&self._flags, f_is_detached_dangling)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setDetachedDangling(self, bint dangling):
 */
  __pyx_r = __pyx_f_8treedict_8treedict__flagOn((&__pyx_v_self->_flags), 4);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict._isDetachedDangling");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1818
 * 
 *     # Detached Dangling
 *     cpdef bint _isDetachedDangling(self):             # <<<<<<<<<<<<<<
 *         return _flagOn(&self._flags, f_is_detached_dangling)
 * 
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__isDetachedDangling(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__isDetachedDangling(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_isDetachedDangling");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_isDetachedDangling(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._isDetachedDangling");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1821
 *         return _flagOn(&self._flags, f_is_detached_dangling)
 * 
 *     cdef void _setDetachedDangling(self, bint dangling):             # <<<<<<<<<<<<<<
 *         _setFlag(&self._flags, f_is_detached_dangling, dangling)
 * 
 */

static  void __pyx_f_8treedict_8treedict_8TreeDict__setDetachedDangling(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_v_dangling) {
  __Pyx_RefNannySetupContext("_setDetachedDangling");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1822
 * 
 *     cdef void _setDetachedDangling(self, bint dangling):
 *         _setFlag(&self._flags, f_is_detached_dangling, dangling)             # <<<<<<<<<<<<<<
 * 
 *     # Registration
 */
  __pyx_f_8treedict_8treedict__setFlag((&__pyx_v_self->_flags), 4, __pyx_v_dangling);

  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1825
 * 
 *     # Registration
 *     cpdef bint isRegistered(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if the current tree structure is registered in
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isRegistered(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  int __pyx_f_8treedict_8treedict_8TreeDict_isRegistered(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("isRegistered");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__isRegistered); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_isRegistered)) {
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1832
 *         """
 * 
 *         return _flagOn(&self._flags, f_is_registered)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setRegisteredFlag(self, bint registered):
 */
  __pyx_r = __pyx_f_8treedict_8treedict__flagOn((&__pyx_v_self->_flags), 8);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict.isRegistered");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1825
 * 
 *     # Registration
 *     cpdef bint isRegistered(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if the current tree structure is registered in
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isRegistered(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_isRegistered[] = "\n        Returns true if the current tree structure is registered in\n        the module-level tree index and can be accessed through the\n        :meth:`getTree()` function.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isRegistered(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("isRegistered");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->isRegistered(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.isRegistered");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1834
 *         return _flagOn(&self._flags, f_is_registered)
 * 
 *     cdef void _setRegisteredFlag(self, bint registered):             # <<<<<<<<<<<<<<
 *         _setFlag(&self._flags, f_is_registered, registered)
 * 
 */

static  void __pyx_f_8treedict_8treedict_8TreeDict__setRegisteredFlag(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_v_registered) {
  __Pyx_RefNannySetupContext("_setRegisteredFlag");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1835
 * 
 *     cdef void _setRegisteredFlag(self, bint registered):
 *         _setFlag(&self._flags, f_is_registered, registered)             # <<<<<<<<<<<<<<
 * 
 *     def _numDangling(self):
 */
  __pyx_f_8treedict_8treedict__setFlag((&__pyx_v_self->_flags), 8, __pyx_v_registered);

  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1837
 *         _setFlag(&self._flags, f_is_registered, registered)
 * 
 *     def _numDangling(self):             # <<<<<<<<<<<<<<
 *         return self._n_dangling
 * 
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__numDangling(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__numDangling(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_numDangling");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1838
 * 
 *     def _numDangling(self):
 *         return self._n_dangling             # <<<<<<<<<<<<<<
 * 
 *     # HasBeenCopied flag
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_n_dangling); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._numDangling");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1841
 * 
 *     # HasBeenCopied flag
 *     cdef bint hasBeenCopied(self):             # <<<<<<<<<<<<<<
 *         return _flagOn(&self._flags, f_is_already_copied)
 * 
 */

static  int __pyx_f_8treedict_8treedict_8TreeDict_hasBeenCopied(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("hasBeenCopied");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1842
 *     # HasBeenCopied flag
 *     cdef bint hasBeenCopied(self):
 *         return _flagOn(&self._flags, f_is_already_copied)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setHasBeenCopiedFlag(self, bint copied):
 */
  __pyx_r = __pyx_f_8treedict_8treedict__flagOn((&__pyx_v_self->_flags), 64);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1844
 *         return _flagOn(&self._flags, f_is_already_copied)
 * 
 *     cdef void _setHasBeenCopiedFlag(self, bint copied):             # <<<<<<<<<<<<<<
 *         _setFlag(&self._flags, f_is_already_copied, copied)
 * 
 */

static  void __pyx_f_8treedict_8treedict_8TreeDict__setHasBeenCopiedFlag(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_v_copied) {
  __Pyx_RefNannySetupContext("_setHasBeenCopiedFlag");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1845
 * 
 *     cdef void _setHasBeenCopiedFlag(self, bint copied):
 *         _setFlag(&self._flags, f_is_already_copied, copied)             # <<<<<<<<<<<<<<
 * 
 *     # HasBeenCopied flag
 */
  __pyx_f_8treedict_8treedict__setFlag((&__pyx_v_self->_flags), 64, __pyx_v_copied);

  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1848
 * 
 *     # HasBeenCopied flag
 *     cdef bint isCopyReferenced(self):             # <<<<<<<<<<<<<<
 *         return _flagOn(&self._flags, f_is_copy_referenced)
 * 
 */

static  int __pyx_f_8treedict_8treedict_8TreeDict_isCopyReferenced(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("isCopyReferenced");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1849
 *     # HasBeenCopied flag
 *     cdef bint isCopyReferenced(self):
 *         return _flagOn(&self._flags, f_is_copy_referenced)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _setCopyReferencedFlag(self, bint cr):
 */
  __pyx_r = __pyx_f_8treedict_8treedict__flagOn((&__pyx_v_self->_flags), 128);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1851
 *         return _flagOn(&self._flags, f_is_copy_referenced)
 * 
 *     cdef void _setCopyReferencedFlag(self, bint cr):             # <<<<<<<<<<<<<<
 *         _setFlag(&self._flags, f_is_copy_referenced, cr)
 * 
 */

static  void __pyx_f_8treedict_8treedict_8TreeDict__setCopyReferencedFlag(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_v_cr) {
  __Pyx_RefNannySetupContext("_setCopyReferencedFlag");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1852
 * 
 *     cdef void _setCopyReferencedFlag(self, bint cr):
 *         _setFlag(&self._flags, f_is_copy_referenced, cr)             # <<<<<<<<<<<<<<
 * 
 *     # Iterator control
 */
  __pyx_f_8treedict_8treedict__setFlag((&__pyx_v_self->_flags), 128, __pyx_v_cr);

  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1855
 * 
 *     # Iterator control
 *     cdef bint isIterReferenced(self):             # <<<<<<<<<<<<<<
 *         return _flagOn(&self._flags, f_one_iterators_referencing)
 * 
 */

static  int __pyx_f_8treedict_8treedict_8TreeDict_isIterReferenced(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("isIterReferenced");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1856
 *     # Iterator control
 *     cdef bint isIterReferenced(self):
 *         return _flagOn(&self._flags, f_one_iterators_referencing)             # <<<<<<<<<<<<<<
 * 
 *     cdef void iteratorIncRef(self):
 */
  __pyx_r = __pyx_f_8treedict_8treedict__flagOn((&__pyx_v_self->_flags), 16);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1858
 *         return _flagOn(&self._flags, f_one_iterators_referencing)
 * 
 *     cdef void iteratorIncRef(self):             # <<<<<<<<<<<<<<
 * 
 *         if not _flagOn(&self._flags, f_one_iterators_referencing):
 */

static  void __pyx_f_8treedict_8treedict_8TreeDict_iteratorIncRef(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("iteratorIncRef");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1860
 *     cdef void iteratorIncRef(self):
 * 
 *         if not _flagOn(&self._flags, f_one_iterators_referencing):             # <<<<<<<<<<<<<<
 *             _setFlag(&self._flags, f_one_iterators_referencing, True)
 * 
 */
  __pyx_t_1 = (!__pyx_f_8treedict_8treedict__flagOn((&__pyx_v_self->_flags), 16));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1861
 * 
 *         if not _flagOn(&self._flags, f_one_iterators_referencing):
 *             _setFlag(&self._flags, f_one_iterators_referencing, True)             # <<<<<<<<<<<<<<
 * 
 *             if RUN_ASSERTS:
 */
    __pyx_f_8treedict_8treedict__setFlag((&__pyx_v_self->_flags), 16, 1);
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1866
 *                 assert not _flagOn(&self._flags, f_many_iterators_referencing)
 * 
 *         elif not _flagOn(&self._flags, f_many_iterators_referencing):             # <<<<<<<<<<<<<<
 * 
 *             if RUN_ASSERTS:
 */
  __pyx_t_1 = (!__pyx_f_8treedict_8treedict__flagOn((&__pyx_v_self->_flags), 32));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1871
 *                 assert not s_IterReferenceCount in self._aux_dict
 * 
 *             self._aux_dict[s_IterReferenceCount] = 2             # <<<<<<<<<<<<<<
 *             _setFlag(&self._flags, f_many_iterators_referencing, True)
 *         else:
 */
    if (PyDict_SetItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_IterReferenceCount), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1872
 * 
 *             self._aux_dict[s_IterReferenceCount] = 2
 *             _setFlag(&self._flags, f_many_iterators_referencing, True)             # <<<<<<<<<<<<<<
 *         else:
 *             if RUN_ASSERTS:
 */
    __pyx_f_8treedict_8treedict__setFlag((&__pyx_v_self->_flags), 32, 1);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1878
 *                 assert self._aux_dict[s_IterReferenceCount] >= 1
 * 
 *             self._aux_dict[s_IterReferenceCount] += 1             # <<<<<<<<<<<<<<
 * 
 *     cdef void iteratorDecRef(self):
 */
    __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_IterReferenceCount)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyDict_SetItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_IterReferenceCount), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict.iteratorIncRef");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1880
 *             self._aux_dict[s_IterReferenceCount] += 1
 * 
 *     cdef void iteratorDecRef(self):             # <<<<<<<<<<<<<<
 * 
 *         if _flagOn(&self._flags, f_many_iterators_referencing):
 */

static  void __pyx_f_8treedict_8treedict_8TreeDict_iteratorDecRef(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  PyObject *__pyx_v_n;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("iteratorDecRef");
  __pyx_v_n = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1882
 *     cdef void iteratorDecRef(self):
 * 
 *         if _flagOn(&self._flags, f_many_iterators_referencing):             # <<<<<<<<<<<<<<
 * 
 *             if RUN_ASSERTS:
 */
  __pyx_t_1 = __pyx_f_8treedict_8treedict__flagOn((&__pyx_v_self->_flags), 32);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1887
 *                 assert s_IterReferenceCount in self._aux_dict
 * 
 *             n = self._aux_dict[s_IterReferenceCount]             # <<<<<<<<<<<<<<
 * 
 *             if n > 2:
 */
    __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_IterReferenceCount)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_n);
    __pyx_v_n = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1889
 *             n = self._aux_dict[s_IterReferenceCount]
 * 
 *             if n > 2:             # <<<<<<<<<<<<<<
 *                 self._aux_dict[s_IterReferenceCount] = n - 1
 *             else:
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_n, __pyx_int_2, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1890
 * 
 *             if n > 2:
 *                 self._aux_dict[s_IterReferenceCount] = n - 1             # <<<<<<<<<<<<<<
 *             else:
 * 
 */
      __pyx_t_2 = PyNumber_Subtract(__pyx_v_n, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_IterReferenceCount), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1896
 *                     assert self._aux_dict[s_IterReferenceCount] == 2
 * 
 *                 del self._aux_dict[s_IterReferenceCount]             # <<<<<<<<<<<<<<
 * 
 *                 _setFlag(&self._flags, f_many_iterators_referencing, False)
 */
      if (PyDict_DelItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_IterReferenceCount)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1898
 *                 del self._aux_dict[s_IterReferenceCount]
 * 
 *                 _setFlag(&self._flags, f_many_iterators_referencing, False)             # <<<<<<<<<<<<<<
 *         else:
 * 
 */
      __pyx_f_8treedict_8treedict__setFlag((&__pyx_v_self->_flags), 32, 0);
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1905
 *                 assert s_IterReferenceCount not in self._aux_dict
 * 
 *             _setFlag(&self._flags, f_one_iterators_referencing, False)             # <<<<<<<<<<<<<<
 * 
 *     def _iteratorRefCount(self):
 */
    __pyx_f_8treedict_8treedict__setFlag((&__pyx_v_self->_flags), 16, 0);
  }
  __pyx_L3:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict.iteratorDecRef");
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_n);
  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1907
 *             _setFlag(&self._flags, f_one_iterators_referencing, False)
 * 
 *     def _iteratorRefCount(self):             # <<<<<<<<<<<<<<
 *         if _flagOn(&self._flags, f_many_iterators_referencing):
 *             return self._aux_dict[s_IterReferenceCount]
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__iteratorRefCount(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__iteratorRefCount(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_iteratorRefCount");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1908
 * 
 *     def _iteratorRefCount(self):
 *         if _flagOn(&self._flags, f_many_iterators_referencing):             # <<<<<<<<<<<<<<
 *             return self._aux_dict[s_IterReferenceCount]
 *         elif _flagOn(&self._flags, f_one_iterators_referencing):
 */
  __pyx_t_1 = __pyx_f_8treedict_8treedict__flagOn((&((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_flags), 32);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1909
 *     def _iteratorRefCount(self):
 *         if _flagOn(&self._flags, f_many_iterators_referencing):
 *             return self._aux_dict[s_IterReferenceCount]             # <<<<<<<<<<<<<<
 *         elif _flagOn(&self._flags, f_one_iterators_referencing):
 *             return 1
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_IterReferenceCount)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1910
 *         if _flagOn(&self._flags, f_many_iterators_referencing):
 *             return self._aux_dict[s_IterReferenceCount]
 *         elif _flagOn(&self._flags, f_one_iterators_referencing):             # <<<<<<<<<<<<<<
 *             return 1
 *         else:
 */
  __pyx_t_1 = __pyx_f_8treedict_8treedict__flagOn((&((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_flags), 16);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1911
 *             return self._aux_dict[s_IterReferenceCount]
 *         elif _flagOn(&self._flags, f_one_iterators_referencing):
 *             return 1             # <<<<<<<<<<<<<<
 *         else:
 *             return 0
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_1);
    __pyx_r = __pyx_int_1;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1913
 *             return 1
 *         else:
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     ################################################################################
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._iteratorRefCount");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1918
 *     # Methods that return information about the tree
 * 
 *     cpdef TreeDict parentNode(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the parant node of the current node.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_parentNode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_f_8treedict_8treedict_8TreeDict_parentNode(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("parentNode");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__parentNode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_parentNode)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8treedict_8treedict_TreeDict))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1922
 *         Returns the parant node of the current node.
 *         """
 *         return self._parent             # <<<<<<<<<<<<<<
 * 
 *     cpdef TreeDict rootNode(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_r = __pyx_v_self->_parent;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.parentNode");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1918
 *     # Methods that return information about the tree
 * 
 *     cpdef TreeDict parentNode(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the parant node of the current node.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_parentNode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_parentNode[] = "\n        Returns the parant node of the current node.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_parentNode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("parentNode");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->parentNode(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.parentNode");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1924
 *         return self._parent
 * 
 *     cpdef TreeDict rootNode(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the root node of current tree.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_rootNode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_f_8treedict_8treedict_8TreeDict_rootNode(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("rootNode");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__rootNode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_rootNode)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8treedict_8treedict_TreeDict))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1929
 *         """
 * 
 *         if self._parent is None:             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_self->_parent) == Py_None);
  if (__pyx_t_3) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1930
 * 
 *         if self._parent is None:
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             return self._parent.rootNode()
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1932
 *             return self
 *         else:
 *             return self._parent.rootNode()             # <<<<<<<<<<<<<<
 * 
 *     cpdef bint isRoot(self):
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->_parent->__pyx_vtab)->rootNode(__pyx_v_self->_parent, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.rootNode");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1924
 *         return self._parent
 * 
 *     cpdef TreeDict rootNode(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the root node of current tree.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_rootNode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_rootNode[] = "\n        Returns the root node of current tree.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_rootNode(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("rootNode");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->rootNode(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.rootNode");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1934
 *             return self._parent.rootNode()
 * 
 *     cpdef bint isRoot(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns True if the current node is the root of the tree, and
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isRoot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  int __pyx_f_8treedict_8treedict_8TreeDict_isRoot(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("isRoot");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__isRoot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_isRoot)) {
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1939
 *         False otherwise.
 *         """
 *         return self._parent is None             # <<<<<<<<<<<<<<
 * 
 *     cpdef bint isEmpty(self):
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_self->_parent) == Py_None);
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict.isRoot");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1934
 *             return self._parent.rootNode()
 * 
 *     cpdef bint isRoot(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns True if the current node is the root of the tree, and
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isRoot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_isRoot[] = "\n        Returns True if the current node is the root of the tree, and\n        False otherwise.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isRoot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("isRoot");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->isRoot(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.isRoot");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1941
 *         return self._parent is None
 * 
 *     cpdef bint isEmpty(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns True if the current branch has no branches or leaves.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isEmpty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  int __pyx_f_8treedict_8treedict_8TreeDict_isEmpty(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_b;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  __Pyx_RefNannySetupContext("isEmpty");
  __pyx_v_b = Py_None; __Pyx_INCREF(Py_None);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__isEmpty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_isEmpty)) {
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1947
 *         """
 * 
 *         if len(self._param_dict) == 0:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  if (unlikely(__pyx_v_self->_param_dict == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = PyDict_Size(((PyObject *)__pyx_v_self->_param_dict)); 
  __pyx_t_3 = (__pyx_t_4 == 0);
  if (__pyx_t_3) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1948
 * 
 *         if len(self._param_dict) == 0:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         for b in self._branches:
 */
    __pyx_r = 1;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1950
 *             return True
 * 
 *         for b in self._branches:             # <<<<<<<<<<<<<<
 *             if not (<TreeDict>b).isDangling():
 *                 return False
 */
  if (likely(((PyObject *)__pyx_v_self->_branches) != Py_None)) {
    __pyx_t_4 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_self->_branches); __Pyx_INCREF(__pyx_t_1);
  } else {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
    __Pyx_DECREF(__pyx_v_b);
    __pyx_v_b = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1951
 * 
 *         for b in self._branches:
 *             if not (<TreeDict>b).isDangling():             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
    __pyx_t_3 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_b)->__pyx_vtab)->isDangling(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_b), 0));
    if (__pyx_t_3) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1952
 *         for b in self._branches:
 *             if not (<TreeDict>b).isDangling():
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *         return len(self._branches) == len(self._param_dict)
 */
      __pyx_r = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1954
 *                 return False
 * 
 *         return len(self._branches) == len(self._param_dict)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (unlikely(__pyx_v_self->_branches == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_self->_branches)); 
  if (unlikely(__pyx_v_self->_param_dict == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_5 = PyDict_Size(((PyObject *)__pyx_v_self->_param_dict)); 
  __pyx_r = (__pyx_t_4 == __pyx_t_5);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict.isEmpty");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_b);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1941
 *         return self._parent is None
 * 
 *     cpdef bint isEmpty(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns True if the current branch has no branches or leaves.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isEmpty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_isEmpty[] = "\n        Returns True if the current branch has no branches or leaves.\n        (Note that dangling branches don't count, but empty branches do.)\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isEmpty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("isEmpty");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->isEmpty(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.isEmpty");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1957
 * 
 * 
 *     cpdef bint nodeInSameTree(self, TreeDict node):             # <<<<<<<<<<<<<<
 *         """
 *         Tests whether `node` is a node in the current tree.  This is
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_nodeInSameTree(PyObject *__pyx_v_self, PyObject *__pyx_v_node); /*proto*/
static  int __pyx_f_8treedict_8treedict_8TreeDict_nodeInSameTree(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_node, int __pyx_skip_dispatch) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("nodeInSameTree");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__nodeInSameTree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_nodeInSameTree)) {
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_node));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_node));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_node));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_4;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1965
 *         """
 * 
 *         return (self.rootNode() is node.rootNode())             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->rootNode(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_node->__pyx_vtab)->rootNode(__pyx_v_node, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = (((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1) == ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_3));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  __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_WriteUnraisable("treedict.treedict.TreeDict.nodeInSameTree");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1957
 * 
 * 
 *     cpdef bint nodeInSameTree(self, TreeDict node):             # <<<<<<<<<<<<<<
 *         """
 *         Tests whether `node` is a node in the current tree.  This is
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_nodeInSameTree(PyObject *__pyx_v_self, PyObject *__pyx_v_node); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_nodeInSameTree[] = "\n        Tests whether `node` is a node in the current tree.  This is\n        equal to testing whether they have the same root node.  Note\n        that TreeDict instances stored in the tree but not attached\n        are not considered nodes of the current tree.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_nodeInSameTree(PyObject *__pyx_v_self, PyObject *__pyx_v_node) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("nodeInSameTree");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node), __pyx_ptype_8treedict_8treedict_TreeDict, 1, "node", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->nodeInSameTree(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_node), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.nodeInSameTree");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1968
 * 
 * 
 *     cpdef interactiveTree(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns an interactive version of the TreeDict for use in an
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_interactiveTree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict_interactiveTree(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("interactiveTree");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__interactiveTree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_interactiveTree)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2035
 *         """
 * 
 *         return InteractiveTreeDict(self)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__InteractiveTreeDict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.interactiveTree");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1968
 * 
 * 
 *     cpdef interactiveTree(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns an interactive version of the TreeDict for use in an
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_interactiveTree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_interactiveTree[] = "\n        Returns an interactive version of the TreeDict for use in an\n        interpreted shell.  While the branch, node, and leaf values in\n        a TreeDict instance are stored in an internal dictionary, they\n        are the attributes in an interactive TreeDict.  This allows\n        one to use tab completion in Ipython to interact with the tree\n        more easily.\n\n        The `treeDict()` method of the interactive tree returns the\n        original TreeDict instance.\n\n        Example::\n\n            In [1]: from treedict import TreeDict\n\n            In [2]: t = TreeDict(a=1,b=2,c=3,d=4)\n\n            In [3]: t.\n            t.__class__                 t.__setattr__               t.isDangling\n            t.__contains__              t.__setitem__               t.isEmpty\n            t.__copy__                  t.__sizeof__                t.isFrozen\n            t.__deepcopy__              t.__str__                   t.isMutable\n            t.__delattr__               t.__subclasshook__          t.isRegistered\n            t.__delitem__               t._branchNameOf             t.isRoot\n            t.__doc__                   t._fullNameOf               t.items\n            t.__eq__                    t._getSettingOrderPosition  t.iterbranches\n            t.__format__                t._isDetachedDangling       t.iteritems\n            t.__ge__                    t._iteratorRefCount         t.iterkeys\n            t.__getattr__               t._numDangling              t.itervalues\n            t.__getattribute__          t._numMutable               t.keys\n            t.__getitem__               t.attach                    t.makeBranch\n            t.__gt__                    t.branchName                t.makeReport\n            t.__hash__                  t.branches                  t.nodeInSameTree\n            t.__init__                  t.clear                     t.parentNode\n            t.__iter__                  t.copy                  ""    t.pop\n            t.__le__                    t.checkset                  t.popitem\n            t.__len__                   t.freeze                    t.rootNode\n            t.__lt__                    t.fromdict                  t.set\n            t.__ne__                    t.fromkeys                  t.setFromString\n            t.__new__                   t.get                       t.setdefault\n            t.__pyx_vtable__            t.getClosestKey             t.size\n            t.__reduce__                t.has_key                   t.treeName\n            t.__reduce_ex__             t.hash                      t.update\n            t.__repr__                  t.interactiveTree           t.values\n\n            In [3]: ti = t.interactiveTree()\n\n            In [4]: ti.\n            ti.__class__             ti.__module__            ti.__weakref__\n            ti.__delattr__           ti.__new__               ti._original_param_tree\n            ti.__dict__              ti.__reduce__            ti._setAttrDirect\n            ti.__doc__               ti.__reduce_ex__         ti.a\n            ti.__eq__                ti.__repr__              ti.b\n            ti.__format__            ti.__setattr__           ti.c\n            ti.__getattribute__      ti.__sizeof__            ti.d\n            ti.__hash__              ti.__str__               ti.treeDict\n            ti.__init__              ti.__subclasshook__      \n\n            In [4]: ti.a\n            Out[4]: 1\n\n            In [5]: ti.treeDict() is t\n            Out[5]: True\n\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_interactiveTree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("interactiveTree");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->interactiveTree(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.interactiveTree");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2037
 *         return InteractiveTreeDict(self)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         if self.isDangling():
 *             return "Dangling TreeDict <%s>" % self._branchName(False, True)
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__repr__");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2038
 * 
 *     def __repr__(self):
 *         if self.isDangling():             # <<<<<<<<<<<<<<
 *             return "Dangling TreeDict <%s>" % self._branchName(False, True)
 *         else:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->isDangling(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2039
 *     def __repr__(self):
 *         if self.isDangling():
 *             return "Dangling TreeDict <%s>" % self._branchName(False, True)             # <<<<<<<<<<<<<<
 *         else:
 *             return "TreeDict <%s>" % self._branchName(False, True)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_branchName(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0, 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_39), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2041
 *             return "Dangling TreeDict <%s>" % self._branchName(False, True)
 *         else:
 *             return "TreeDict <%s>" % self._branchName(False, True)             # <<<<<<<<<<<<<<
 * 
 *     cpdef str _fullNameOf(self, str key):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_branchName(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0, 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_40), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = ((PyObject *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2043
 *             return "TreeDict <%s>" % self._branchName(False, True)
 * 
 *     cpdef str _fullNameOf(self, str key):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the full name of `key`, including the root name of the tree.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__fullNameOf(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__fullNameOf(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_key, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_fullNameOf");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___fullNameOf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict__fullNameOf)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_key));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_key));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_key));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!(likely(PyString_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2048
 *         """
 * 
 *         checkKeyNotNone(key)             # <<<<<<<<<<<<<<
 *         return self._branchName(False, True) + "." + key
 * 
 */
  __pyx_t_1 = __pyx_f_8treedict_8treedict_checkKeyNotNone(__pyx_v_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2049
 * 
 *         checkKeyNotNone(key)
 *         return self._branchName(False, True) + "." + key             # <<<<<<<<<<<<<<
 * 
 *     cpdef str _branchNameOf(self, str key):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_branchName(__pyx_v_self, 0, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_v_key)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._fullNameOf");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2043
 *             return "TreeDict <%s>" % self._branchName(False, True)
 * 
 *     cpdef str _fullNameOf(self, str key):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the full name of `key`, including the root name of the tree.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__fullNameOf(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict__fullNameOf[] = "\n        Returns the full name of `key`, including the root name of the tree.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__fullNameOf(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_fullNameOf");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), &PyString_Type, 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_fullNameOf(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._fullNameOf");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2051
 *         return self._branchName(False, True) + "." + key
 * 
 *     cpdef str _branchNameOf(self, str key):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the full name of `key`, not including the root name of the tree.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__branchNameOf(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__branchNameOf(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_key, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_branchNameOf");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___branchNameOf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict__branchNameOf)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_key));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_key));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_key));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!(likely(PyString_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2056
 *         """
 * 
 *         return catNames(self._branchName(False, False), key)             # <<<<<<<<<<<<<<
 * 
 *     cpdef str treeName(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_branchName(__pyx_v_self, 0, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = ((PyObject *)__pyx_f_8treedict_8treedict_catNames(((PyObject *)__pyx_t_1), __pyx_v_key)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._branchNameOf");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2051
 *         return self._branchName(False, True) + "." + key
 * 
 *     cpdef str _branchNameOf(self, str key):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the full name of `key`, not including the root name of the tree.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__branchNameOf(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict__branchNameOf[] = "\n        Returns the full name of `key`, not including the root name of the tree.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__branchNameOf(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_branchNameOf");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), &PyString_Type, 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_branchNameOf(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._branchNameOf");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2058
 *         return catNames(self._branchName(False, False), key)
 * 
 *     cpdef str treeName(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the name of the tree (defined as the name of the root
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_treeName(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict_treeName(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("treeName");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__treeName); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_treeName)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject *)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2076
 *         """
 * 
 *         return self.rootNode()._branchName(True, True)             # <<<<<<<<<<<<<<
 * 
 *     cpdef str branchName(self, bint add_path = False, bint add_tree_name = False):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->rootNode(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1)->__pyx_vtab)->_branchName(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1), 1, 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.treeName");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2058
 *         return catNames(self._branchName(False, False), key)
 * 
 *     cpdef str treeName(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the name of the tree (defined as the name of the root
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_treeName(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_treeName[] = "\n        Returns the name of the tree (defined as the name of the root\n        node).\n\n        Example::\n\n            >>> from treedict import TreeDict\n            >>> t = TreeDict('mytree')\n            >>> t.treeName()\n            'mytree'\n            >>> t.makeBranch('a.b.c')\n            TreeDict <mytree.a.b.c>\n            >>> t.a.b.treeName()\n            'mytree'\n\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_treeName(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("treeName");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->treeName(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.treeName");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2078
 *         return self.rootNode()._branchName(True, True)
 * 
 *     cpdef str branchName(self, bint add_path = False, bint add_tree_name = False):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the name of the branch.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_branchName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict_branchName(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_branchName *__pyx_optional_args) {
  int __pyx_v_add_path = ((int)0);
  int __pyx_v_add_tree_name = ((int)0);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("branchName");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_add_path = __pyx_optional_args->add_path;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_add_tree_name = __pyx_optional_args->add_tree_name;
      }
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__branchName); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_branchName)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_add_path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_add_tree_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!(likely(PyString_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2102
 *         """
 * 
 *         return self._branchName(not add_path, add_tree_name)             # <<<<<<<<<<<<<<
 * 
 *     cdef str _branchName(self, bint local_only, bint include_tree_name):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_branchName(__pyx_v_self, (!__pyx_v_add_path), __pyx_v_add_tree_name)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.branchName");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2078
 *         return self.rootNode()._branchName(True, True)
 * 
 *     cpdef str branchName(self, bint add_path = False, bint add_tree_name = False):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the name of the branch.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_branchName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_branchName[] = "\n        Returns the name of the branch.\n\n        If `add_path` is False, returns only the local branch name;\n        otherwise, it returns the full name of the branch to the root.\n        If `add_tree_name` is True, the tree name is included in the\n        path; if `add_path` is False, `add_tree_name` is ignored.\n\n        Example::\n\n            >>> from treedict import TreeDict\n            >>> t = TreeDict('root')\n            >>> t.makeBranch(\"a.b.c\")\n            TreeDict <root.a.b.c>\n            >>> t.a.b.c.branchName()\n            'c'\n            >>> t.a.b.c.branchName(add_path = True)\n            'a.b.c'\n            >>> t.a.b.c.branchName(add_path = True, add_tree_name = True)\n            'root.a.b.c'\n            \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_branchName(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_add_path;
  int __pyx_v_add_tree_name;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8treedict_8treedict_8TreeDict_branchName __pyx_t_2;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__add_path,&__pyx_n_s__add_tree_name,0};
  __Pyx_RefNannySetupContext("branchName");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__add_path);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__add_tree_name);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "branchName") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_add_path = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_add_path == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_add_path = ((int)0);
    }
    if (values[1]) {
      __pyx_v_add_tree_name = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_add_tree_name == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_add_tree_name = ((int)0);
    }
  } else {
    __pyx_v_add_path = ((int)0);
    __pyx_v_add_tree_name = ((int)0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_add_tree_name = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_add_tree_name == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_add_path = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_add_path == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("branchName", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.branchName");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.add_path = __pyx_v_add_path;
  __pyx_t_2.add_tree_name = __pyx_v_add_tree_name;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->branchName(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.branchName");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2104
 *         return self._branchName(not add_path, add_tree_name)
 * 
 *     cdef str _branchName(self, bint local_only, bint include_tree_name):             # <<<<<<<<<<<<<<
 *         # Now a little trickier since we have to handle empty tree
 *         # names properly, so we can't special case ''
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__branchName(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_v_local_only, int __pyx_v_include_tree_name) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_branchName");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2108
 *         # names properly, so we can't special case ''
 * 
 *         cdef TreeDict p = self.parentNode()             # <<<<<<<<<<<<<<
 *         cdef str base
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->parentNode(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2111
 *         cdef str base
 * 
 *         if p is None:             # <<<<<<<<<<<<<<
 *             if include_tree_name:
 *                 return self._name
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_p) == Py_None);
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2112
 * 
 *         if p is None:
 *             if include_tree_name:             # <<<<<<<<<<<<<<
 *                 return self._name
 *             else:
 */
    if (__pyx_v_include_tree_name) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2113
 *         if p is None:
 *             if include_tree_name:
 *                 return self._name             # <<<<<<<<<<<<<<
 *             else:
 *                 return ''
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(((PyObject *)__pyx_v_self->_name));
      __pyx_r = __pyx_v_self->_name;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2115
 *                 return self._name
 *             else:
 *                 return ''             # <<<<<<<<<<<<<<
 *         else:
 *             if local_only:
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
      __pyx_r = __pyx_kp_s_41;
      goto __pyx_L0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2117
 *                 return ''
 *         else:
 *             if local_only:             # <<<<<<<<<<<<<<
 *                 return self._name
 * 
 */
    if (__pyx_v_local_only) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2118
 *         else:
 *             if local_only:
 *                 return self._name             # <<<<<<<<<<<<<<
 * 
 *             if p.isRoot():
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(((PyObject *)__pyx_v_self->_name));
      __pyx_r = __pyx_v_self->_name;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2120
 *                 return self._name
 * 
 *             if p.isRoot():             # <<<<<<<<<<<<<<
 *                 if include_tree_name:
 *                     return p._name + '.' + self._name
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->isRoot(__pyx_v_p, 0);
    if (__pyx_t_2) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2121
 * 
 *             if p.isRoot():
 *                 if include_tree_name:             # <<<<<<<<<<<<<<
 *                     return p._name + '.' + self._name
 *                 else:
 */
      if (__pyx_v_include_tree_name) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2122
 *             if p.isRoot():
 *                 if include_tree_name:
 *                     return p._name + '.' + self._name             # <<<<<<<<<<<<<<
 *                 else:
 *                     return self._name
 */
        __Pyx_XDECREF(((PyObject *)__pyx_r));
        __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_p->_name), ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_v_self->_name)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __pyx_r = __pyx_t_3;
        __pyx_t_3 = 0;
        goto __pyx_L0;
        goto __pyx_L7;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2124
 *                     return p._name + '.' + self._name
 *                 else:
 *                     return self._name             # <<<<<<<<<<<<<<
 *             else:
 *                 return p._branchName(False, include_tree_name) + '.' + self._name
 */
        __Pyx_XDECREF(((PyObject *)__pyx_r));
        __Pyx_INCREF(((PyObject *)__pyx_v_self->_name));
        __pyx_r = __pyx_v_self->_name;
        goto __pyx_L0;
      }
      __pyx_L7:;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2126
 *                     return self._name
 *             else:
 *                 return p._branchName(False, include_tree_name) + '.' + self._name             # <<<<<<<<<<<<<<
 * 
 *     def makeReport(self, bint recursive = True, bint add_path = False, bint add_tree_name = True):
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_branchName(__pyx_v_p, 0, __pyx_v_include_tree_name)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyNumber_Add(__pyx_t_3, ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_v_self->_name)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }
    __pyx_L6:;
  }
  __pyx_L3:;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._branchName");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2128
 *                 return p._branchName(False, include_tree_name) + '.' + self._name
 * 
 *     def makeReport(self, bint recursive = True, bint add_path = False, bint add_tree_name = True):             # <<<<<<<<<<<<<<
 *         """
 *         Creates a report listing all values present in this node,
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_makeReport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_makeReport[] = "\n        Creates a report listing all values present in this node,\n        formatted as ``[branch].name = value``.  Parameters are\n        reported in the exact order they were first set.\n\n        If `add_path` is True, then the full path of each value is\n        given instead of just the path from the current node.  If, in\n        addition, `add_tree_name` is True, the name of the tree is\n        prepended to the path.  (Note: if self.treeName() is not a\n        valid python variable name, then it is enclosed in single\n        quotes, and if it is '', it is omitted.) `add_tree_name` is\n        ignored if `add_path` is False.\n\n        If recursive is True, then all values in this node and in all\n        subnodes are listed; otherwise, only local values are\n        returned.\n\n        Example::\n\n            >>> from treedict import TreeDict\n            >>> \n            >>> t = TreeDict(\"mytree\")\n            >>> t.x = 1\n            >>> t.y = 2\n            >>> t.a.z = [1,2,3]\n            >>> t.a.y = {1 : 2}\n            >>> t.b.x = \"hello\"\n            >>> t.a.x = None\n            >>> t.b.z = 2\n            >>> \n            >>> print t.makeReport()\n            x   = 1\n            y   = 2\n            a.z = [1, 2, 3]\n            a.y = {1: 2}\n            a.x = None\n            b.x = 'hello'\n            b.z = 2\n            >>> print t.a.makeReport()\n            z = [1, 2, 3]\n            y = {1: 2}\n            x = None\n            >>> print t.a.makeReport(add_path = True)\n            mytree.a.z = [1, 2, 3]\n            mytree.a.y = {1: 2}\n            mytree.a.x = None\n            >>> print t.a.makeReport(add_path = True, add_tree_name = False)\n            a.z = [1, 2, 3]\n            a.y = {1: 2}\n            a.x = None\n            \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_makeReport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_recursive;
  int __pyx_v_add_path;
  int __pyx_v_add_tree_name;
  PyObject *__pyx_v_tn;
  PyObject *__pyx_v_prepend_list;
  PyObject *__pyx_v_prepend_string = 0;
  PyObject *__pyx_v_value_list;
  PyObject *__pyx_v_variable_space;
  PyObject *__pyx_v_k;
  PyObject *__pyx_v_v;
  PyObject *__pyx_v_o;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  struct __pyx_opt_args_8treedict_8treedict_8TreeDict_branchName __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  struct __pyx_opt_args_8treedict_8treedict_8TreeDict_iteritems __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__recursive,&__pyx_n_s__add_path,&__pyx_n_s__add_tree_name,0};
  __Pyx_RefNannySetupContext("makeReport");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recursive);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__add_path);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__add_tree_name);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "makeReport") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_recursive = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_recursive = ((int)1);
    }
    if (values[1]) {
      __pyx_v_add_path = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_add_path == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_add_path = ((int)0);
    }
    if (values[2]) {
      __pyx_v_add_tree_name = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_add_tree_name == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_add_tree_name = ((int)1);
    }
  } else {
    __pyx_v_recursive = ((int)1);
    __pyx_v_add_path = ((int)0);
    __pyx_v_add_tree_name = ((int)1);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_add_tree_name = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_add_tree_name == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  2: __pyx_v_add_path = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_add_path == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_recursive = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("makeReport", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.makeReport");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_tn = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_prepend_list = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_value_list = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_variable_space = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_o = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2182
 *         """
 * 
 *         if add_path and add_tree_name:             # <<<<<<<<<<<<<<
 *             tn = self.treeName()
 * 
 */
  if (__pyx_v_add_path) {
    __pyx_t_1 = __pyx_v_add_tree_name;
  } else {
    __pyx_t_1 = __pyx_v_add_path;
  }
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2183
 * 
 *         if add_path and add_tree_name:
 *             tn = self.treeName()             # <<<<<<<<<<<<<<
 * 
 *         prepend_list = [((tn if isValidName(tn) else '%s' % tn)
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->treeName(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_tn);
    __pyx_v_tn = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2186
 * 
 *         prepend_list = [((tn if isValidName(tn) else '%s' % tn)
 *                          if add_path and add_tree_name and len(tn) != 0 else ""),             # <<<<<<<<<<<<<<
 *                         self.branchName(False, False) if add_path else ""]
 * 
 */
  if (__pyx_v_add_path) {
    if (__pyx_v_add_tree_name) {
      __pyx_t_3 = PyObject_Length(__pyx_v_tn); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = (__pyx_t_3 != 0);
      __pyx_t_4 = __pyx_t_1;
    } else {
      __pyx_t_4 = __pyx_v_add_tree_name;
    }
    __pyx_t_1 = __pyx_t_4;
  } else {
    __pyx_t_1 = __pyx_v_add_path;
  }
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2185
 *             tn = self.treeName()
 * 
 *         prepend_list = [((tn if isValidName(tn) else '%s' % tn)             # <<<<<<<<<<<<<<
 *                          if add_path and add_tree_name and len(tn) != 0 else ""),
 *                         self.branchName(False, False) if add_path else ""]
 */
    if (!(likely(PyString_CheckExact(__pyx_v_tn))||((__pyx_v_tn) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_tn)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_f_8treedict_8treedict_isValidName(((PyObject *)__pyx_v_tn))) {
      __Pyx_INCREF(__pyx_v_tn);
      __pyx_t_5 = __pyx_v_tn;
    } else {
      __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_v_tn); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __pyx_t_5 = __pyx_t_6;
      __pyx_t_6 = 0;
    }
    __pyx_t_2 = __pyx_t_5;
    __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
    __pyx_t_2 = __pyx_kp_s_41;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2187
 *         prepend_list = [((tn if isValidName(tn) else '%s' % tn)
 *                          if add_path and add_tree_name and len(tn) != 0 else ""),
 *                         self.branchName(False, False) if add_path else ""]             # <<<<<<<<<<<<<<
 * 
 *         cdef str prepend_string = ".".join([k for k in prepend_list if len(<str>k) != 0])
 */
  if (__pyx_v_add_path) {
    __pyx_t_7.__pyx_n = 2;
    __pyx_t_7.add_path = 0;
    __pyx_t_7.add_tree_name = 0;
    __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->branchName(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0, &__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __pyx_t_6 = 0;
  } else {
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
    __pyx_t_5 = __pyx_kp_s_41;
  }
  __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_t_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
  __pyx_t_2 = 0;
  __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_prepend_list));
  __pyx_v_prepend_list = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2189
 *                         self.branchName(False, False) if add_path else ""]
 * 
 *         cdef str prepend_string = ".".join([k for k in prepend_list if len(<str>k) != 0])             # <<<<<<<<<<<<<<
 * 
 *         if len(prepend_string) != 0:
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_3), __pyx_n_s__join); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  if (likely(((PyObject *)__pyx_v_prepend_list) != Py_None)) {
    __pyx_t_3 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_prepend_list); __Pyx_INCREF(__pyx_t_2);
  } else {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
    __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_8); __pyx_t_3++;
    __Pyx_DECREF(__pyx_v_k);
    __pyx_v_k = __pyx_t_8;
    __pyx_t_8 = 0;
    __pyx_t_9 = PyObject_Length(__pyx_v_k); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = (__pyx_t_9 != 0);
    if (__pyx_t_1) {
      if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_v_k))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L9;
    }
    __pyx_L9:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_prepend_string = ((PyObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2191
 *         cdef str prepend_string = ".".join([k for k in prepend_list if len(<str>k) != 0])
 * 
 *         if len(prepend_string) != 0:             # <<<<<<<<<<<<<<
 *             prepend_string += '.'
 * 
 */
  __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_prepend_string)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (__pyx_t_3 != 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2192
 * 
 *         if len(prepend_string) != 0:
 *             prepend_string += '.'             # <<<<<<<<<<<<<<
 * 
 *         value_list = [(self._getSettingOrderPosition(k), prepend_string + k, v)
 */
    __pyx_t_5 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_prepend_string), ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (!(likely(PyString_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_prepend_string));
    __pyx_v_prepend_string = ((PyObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2194
 *             prepend_string += '.'
 * 
 *         value_list = [(self._getSettingOrderPosition(k), prepend_string + k, v)             # <<<<<<<<<<<<<<
 *                       for k, v in self.iteritems(recursive, 'none')]
 * 
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2195
 * 
 *         value_list = [(self._getSettingOrderPosition(k), prepend_string + k, v)
 *                       for k, v in self.iteritems(recursive, 'none')]             # <<<<<<<<<<<<<<
 * 
 *         if len(value_list) == 0:
 */
  __pyx_t_10.__pyx_n = 2;
  __pyx_t_10.recursive = __pyx_v_recursive;
  __pyx_t_10.branch_mode = ((PyObject *)__pyx_n_s__none);
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->iteritems(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0, &__pyx_t_10)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_3 = 0; __pyx_t_6 = __pyx_t_2; __Pyx_INCREF(__pyx_t_6);
  } else {
    __pyx_t_3 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_6))) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_6)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_6))) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
    } else {
      __pyx_t_2 = PyIter_Next(__pyx_t_6);
      if (!__pyx_t_2) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
      PyObject* tuple = __pyx_t_2;
      __pyx_t_8 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_8);
      __pyx_t_11 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_k);
      __pyx_v_k = __pyx_t_8;
      __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_11;
      __pyx_t_11 = 0;
    } else {
      __pyx_t_12 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_12, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_11 = __Pyx_UnpackItem(__pyx_t_12, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      if (__Pyx_EndUnpack(__pyx_t_12, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_v_k);
      __pyx_v_k = __pyx_t_8;
      __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_11;
      __pyx_t_11 = 0;
    }

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2194
 *             prepend_string += '.'
 * 
 *         value_list = [(self._getSettingOrderPosition(k), prepend_string + k, v)             # <<<<<<<<<<<<<<
 *                       for k, v in self.iteritems(recursive, 'none')]
 * 
 */
    if (!(likely(PyString_CheckExact(__pyx_v_k))||((__pyx_v_k) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_k)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_getSettingOrderPosition(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((PyObject *)__pyx_v_k), 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = PyNumber_Add(((PyObject *)__pyx_v_prepend_string), __pyx_v_k); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_v_v);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_v);
    __Pyx_GIVEREF(__pyx_v_v);
    __pyx_t_2 = 0;
    __pyx_t_11 = 0;
    if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_8))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_t_5));
  __Pyx_DECREF(((PyObject *)__pyx_v_value_list));
  __pyx_v_value_list = __pyx_t_5;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2197
 *                       for k, v in self.iteritems(recursive, 'none')]
 * 
 *         if len(value_list) == 0:             # <<<<<<<<<<<<<<
 *             return ""
 * 
 */
  if (unlikely(__pyx_v_value_list == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_value_list)); 
  __pyx_t_1 = (__pyx_t_3 == 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2198
 * 
 *         if len(value_list) == 0:
 *             return ""             # <<<<<<<<<<<<<<
 * 
 *         variable_space = max([len(k) for o,k,v in value_list])
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
    __pyx_r = ((PyObject *)__pyx_kp_s_41);
    goto __pyx_L0;
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2200
 *             return ""
 * 
 *         variable_space = max([len(k) for o,k,v in value_list])             # <<<<<<<<<<<<<<
 * 
 *         return "\n".join([ (k + " "*(variable_space - len(k)) + " = " + repr(v))
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  if (likely(((PyObject *)__pyx_v_value_list) != Py_None)) {
    __pyx_t_3 = 0; __pyx_t_6 = ((PyObject *)__pyx_v_value_list); __Pyx_INCREF(__pyx_t_6);
  } else {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_6)) break;
    __pyx_t_8 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_8); __pyx_t_3++;
    if (PyTuple_CheckExact(__pyx_t_8) && likely(PyTuple_GET_SIZE(__pyx_t_8) == 3)) {
      PyObject* tuple = __pyx_t_8;
      __pyx_t_11 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_11);
      __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
      __pyx_t_12 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_v_o);
      __pyx_v_o = __pyx_t_11;
      __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_v_k);
      __pyx_v_k = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_12;
      __pyx_t_12 = 0;
    } else {
      __pyx_t_13 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_11 = __Pyx_UnpackItem(__pyx_t_13, 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_13, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_12 = __Pyx_UnpackItem(__pyx_t_13, 2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      if (__Pyx_EndUnpack(__pyx_t_13, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_v_o);
      __pyx_v_o = __pyx_t_11;
      __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_v_k);
      __pyx_v_k = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_12;
      __pyx_t_12 = 0;
    }
    __pyx_t_9 = PyObject_Length(__pyx_v_k); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_8))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_builtin_max, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_v_variable_space);
  __pyx_v_variable_space = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2202
 *         variable_space = max([len(k) for o,k,v in value_list])
 * 
 *         return "\n".join([ (k + " "*(variable_space - len(k)) + " = " + repr(v))             # <<<<<<<<<<<<<<
 *                            for (o, k, v) in sorted(value_list)])
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_44), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2203
 * 
 *         return "\n".join([ (k + " "*(variable_space - len(k)) + " = " + repr(v))
 *                            for (o, k, v) in sorted(value_list)])             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(((PyObject *)__pyx_v_value_list));
  PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_value_list));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_value_list));
  __pyx_t_12 = PyObject_Call(__pyx_builtin_sorted, __pyx_t_8, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyList_CheckExact(__pyx_t_12) || PyTuple_CheckExact(__pyx_t_12)) {
    __pyx_t_3 = 0; __pyx_t_8 = __pyx_t_12; __Pyx_INCREF(__pyx_t_8);
  } else {
    __pyx_t_3 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
  }
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_8))) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_8)) break;
      __pyx_t_12 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_3); __Pyx_INCREF(__pyx_t_12); __pyx_t_3++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_8))) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
      __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_3); __Pyx_INCREF(__pyx_t_12); __pyx_t_3++;
    } else {
      __pyx_t_12 = PyIter_Next(__pyx_t_8);
      if (!__pyx_t_12) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_12);
    }
    if (PyTuple_CheckExact(__pyx_t_12) && likely(PyTuple_GET_SIZE(__pyx_t_12) == 3)) {
      PyObject* tuple = __pyx_t_12;
      __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
      __pyx_t_11 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_11);
      __pyx_t_13 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_v_o);
      __pyx_v_o = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_k);
      __pyx_v_k = __pyx_t_11;
      __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_13;
      __pyx_t_13 = 0;
    } else {
      __pyx_t_14 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_14, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = __Pyx_UnpackItem(__pyx_t_14, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_13 = __Pyx_UnpackItem(__pyx_t_14, 2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      if (__Pyx_EndUnpack(__pyx_t_14, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_v_o);
      __pyx_v_o = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_k);
      __pyx_v_k = __pyx_t_11;
      __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_13;
      __pyx_t_13 = 0;
    }

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2202
 *         variable_space = max([len(k) for o,k,v in value_list])
 * 
 *         return "\n".join([ (k + " "*(variable_space - len(k)) + " = " + repr(v))             # <<<<<<<<<<<<<<
 *                            for (o, k, v) in sorted(value_list)])
 * 
 */
    __pyx_t_9 = PyObject_Length(__pyx_v_k); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = PyNumber_Subtract(__pyx_v_variable_space, __pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_45), __pyx_t_13); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_12));
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyNumber_Add(__pyx_v_k, ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
    __pyx_t_12 = PyNumber_Add(__pyx_t_13, ((PyObject *)__pyx_kp_s_46)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyObject_Repr(__pyx_v_v); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_11 = PyNumber_Add(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (unlikely(PyList_Append(__pyx_t_6, (PyObject*)__pyx_t_11))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(((PyObject *)__pyx_t_6));
  PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_6));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  __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_8);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.makeReport");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_tn);
  __Pyx_DECREF(__pyx_v_prepend_list);
  __Pyx_XDECREF(__pyx_v_prepend_string);
  __Pyx_DECREF(__pyx_v_value_list);
  __Pyx_DECREF(__pyx_v_variable_space);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_DECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2206
 * 
 * 
 *     cpdef tuple _getSettingOrderPosition(self, str name):             # <<<<<<<<<<<<<<
 * 
 *         # make sure it's present
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__getSettingOrderPosition(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__getSettingOrderPosition(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_name, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_key_list = 0;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_t = 0;
  PyObject *__pyx_v_order = 0;
  size_t __pyx_v_idx;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  PyObject *__pyx_v_k;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  size_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("_getSettingOrderPosition");
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_43); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict__getSettingOrderPosition)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_name));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_name));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_name));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject *)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2209
 * 
 *         # make sure it's present
 *         self._get(name, False)             # <<<<<<<<<<<<<<
 * 
 *         cdef list key_list = name.split('.')
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_get(__pyx_v_self, __pyx_v_name, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2211
 *         self._get(name, False)
 * 
 *         cdef list key_list = name.split('.')             # <<<<<<<<<<<<<<
 *         cdef TreeDict t = self
 *         cdef list order = [None]*len(key_list)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_name), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_key_list = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2212
 * 
 *         cdef list key_list = name.split('.')
 *         cdef TreeDict t = self             # <<<<<<<<<<<<<<
 *         cdef list order = [None]*len(key_list)
 *         cdef size_t idx
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_v_t = __pyx_v_self;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2213
 *         cdef list key_list = name.split('.')
 *         cdef TreeDict t = self
 *         cdef list order = [None]*len(key_list)             # <<<<<<<<<<<<<<
 *         cdef size_t idx
 *         cdef _PTreeNode pn
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(Py_None);
  PyList_SET_ITEM(__pyx_t_2, 0, Py_None);
  __Pyx_GIVEREF(Py_None);
  if (unlikely(__pyx_v_key_list == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_key_list)); 
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_t_2), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_order = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2217
 *         cdef _PTreeNode pn
 * 
 *         for idx, k in enumerate(key_list):             # <<<<<<<<<<<<<<
 *             pn = t._getLocalPTNode(k)
 * 
 */
  __pyx_t_5 = 0;
  if (likely(((PyObject *)__pyx_v_key_list) != Py_None)) {
    __pyx_t_4 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_key_list); __Pyx_INCREF(__pyx_t_1);
  } else {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
    __Pyx_DECREF(__pyx_v_k);
    __pyx_v_k = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_idx = __pyx_t_5;
    __pyx_t_5 = (__pyx_t_5 + 1);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2218
 * 
 *         for idx, k in enumerate(key_list):
 *             pn = t._getLocalPTNode(k)             # <<<<<<<<<<<<<<
 * 
 *             order[idx] = pn.orderPosition()
 */
    if (!(likely(PyString_CheckExact(__pyx_v_k))||((__pyx_v_k) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_k)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_t->__pyx_vtab)->_getLocalPTNode(__pyx_v_t, ((PyObject *)__pyx_v_k))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_v_pn));
    __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2220
 *             pn = t._getLocalPTNode(k)
 * 
 *             order[idx] = pn.orderPosition()             # <<<<<<<<<<<<<<
 * 
 *             if idx < len(key_list) - 1:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->orderPosition(__pyx_v_pn); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_order), __pyx_v_idx, __pyx_t_3, sizeof(size_t)+1, __Pyx_PyInt_FromSize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2222
 *             order[idx] = pn.orderPosition()
 * 
 *             if idx < len(key_list) - 1:             # <<<<<<<<<<<<<<
 *                 t = pn.tree()
 * 
 */
    if (unlikely(__pyx_v_key_list == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_key_list)); 
    __pyx_t_7 = (__pyx_v_idx < (__pyx_t_6 - 1));
    if (__pyx_t_7) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2223
 * 
 *             if idx < len(key_list) - 1:
 *                 t = pn.tree()             # <<<<<<<<<<<<<<
 * 
 *         return tuple(order)
 */
      __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_v_t));
      __pyx_v_t = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2225
 *                 t = pn.tree()
 * 
 *         return tuple(order)             # <<<<<<<<<<<<<<
 * 
 *     ################################################################################
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  if (unlikely(__pyx_v_order == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = ((PyObject *)PyList_AsTuple(__pyx_v_order)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._getSettingOrderPosition");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key_list);
  __Pyx_XDECREF((PyObject *)__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_order);
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2206
 * 
 * 
 *     cpdef tuple _getSettingOrderPosition(self, str name):             # <<<<<<<<<<<<<<
 * 
 *         # make sure it's present
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__getSettingOrderPosition(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__getSettingOrderPosition(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_getSettingOrderPosition");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), &PyString_Type, 1, "name", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_getSettingOrderPosition(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_name, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._getSettingOrderPosition");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2234
 *     # First the methods that interface to the outside world
 * 
 *     def __getattr__(self, str k):             # <<<<<<<<<<<<<<
 * 
 *         # Different from get in that we handle non-existant branches
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_k); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_k) {
  __pyx_t_8treedict_8treedict_flagtype __pyx_v_gsp;
  int __pyx_v_allow_dangling_nodes;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  long __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__getattr__");
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_k), &PyString_Type, 1, "k", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2241
 *         # The _getattr__called is to detect programming errors
 * 
 *         if _flagOn(&self._flags, f_getattr_called):             # <<<<<<<<<<<<<<
 *             raise Exception("Programming Error: Multiple (recursive?) __getattr__ with '%s'" % k)
 * 
 */
  __pyx_t_1 = __pyx_f_8treedict_8treedict__flagOn((&((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_flags), 1024);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2242
 * 
 *         if _flagOn(&self._flags, f_getattr_called):
 *             raise Exception("Programming Error: Multiple (recursive?) __getattr__ with '%s'" % k)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_47), ((PyObject *)__pyx_v_k)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2246
 * 
 *         cdef flagtype gsp = (f_retrieve_dangling_okay
 *                              | (f_create_node_if_needed if not self.isFrozen() else 0))             # <<<<<<<<<<<<<<
 * 
 *         cdef bint allow_dangling_nodes = False if self.isFrozen() else True
 */
  if ((!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->isFrozen(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0))) {
    __pyx_t_4 = 1;
  } else {
    __pyx_t_4 = 0;
  }
  __pyx_v_gsp = (2 | __pyx_t_4);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2248
 *                              | (f_create_node_if_needed if not self.isFrozen() else 0))
 * 
 *         cdef bint allow_dangling_nodes = False if self.isFrozen() else True             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  if (((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->isFrozen(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0)) {
    __pyx_t_1 = 0;
  } else {
    __pyx_t_1 = 1;
  }
  __pyx_v_allow_dangling_nodes = __pyx_t_1;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2250
 *         cdef bint allow_dangling_nodes = False if self.isFrozen() else True
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             _setFlagOn(&self._flags, f_getattr_called)
 * 
 */
  /*try:*/ {
    {
      PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
      __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
      __Pyx_XGOTREF(__pyx_save_exc_type);
      __Pyx_XGOTREF(__pyx_save_exc_value);
      __Pyx_XGOTREF(__pyx_save_exc_tb);
      /*try:*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2251
 * 
 *         try:
 *             _setFlagOn(&self._flags, f_getattr_called)             # <<<<<<<<<<<<<<
 * 
 *             if self._existsLocal(k, allow_dangling_nodes):
 */
        __pyx_f_8treedict_8treedict__setFlagOn((&((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_flags), 1024);

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2253
 *             _setFlagOn(&self._flags, f_getattr_called)
 * 
 *             if self._existsLocal(k, allow_dangling_nodes):             # <<<<<<<<<<<<<<
 *                 return self._getLocal(k, allow_dangling_nodes)
 *             elif not self.isFrozen():
 */
        __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_existsLocal(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_k, __pyx_v_allow_dangling_nodes);
        if (__pyx_t_1) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2254
 * 
 *             if self._existsLocal(k, allow_dangling_nodes):
 *                 return self._getLocal(k, allow_dangling_nodes)             # <<<<<<<<<<<<<<
 *             elif not self.isFrozen():
 *                 return self._newLocalBranch(k, f_create_node_if_needed | f_create_dangling)
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_getLocal(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_k, __pyx_v_allow_dangling_nodes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2254; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_r = __pyx_t_2;
          __pyx_t_2 = 0;
          goto __pyx_L13_try_return;
          goto __pyx_L17;
        }

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2255
 *             if self._existsLocal(k, allow_dangling_nodes):
 *                 return self._getLocal(k, allow_dangling_nodes)
 *             elif not self.isFrozen():             # <<<<<<<<<<<<<<
 *                 return self._newLocalBranch(k, f_create_node_if_needed | f_create_dangling)
 *             else:
 */
        __pyx_t_1 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->isFrozen(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0));
        if (__pyx_t_1) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2256
 *                 return self._getLocal(k, allow_dangling_nodes)
 *             elif not self.isFrozen():
 *                 return self._newLocalBranch(k, f_create_node_if_needed | f_create_dangling)             # <<<<<<<<<<<<<<
 *             else:
 *                 self._raiseAttributeError(k)
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_newLocalBranch(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_k, 17)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2256; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_r = __pyx_t_2;
          __pyx_t_2 = 0;
          goto __pyx_L13_try_return;
          goto __pyx_L17;
        }
        /*else*/ {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2258
 *                 return self._newLocalBranch(k, f_create_node_if_needed | f_create_dangling)
 *             else:
 *                 self._raiseAttributeError(k)             # <<<<<<<<<<<<<<
 * 
 *         except Exception, e:
 */
          __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_raiseAttributeError(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2258; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __pyx_L17:;
      }
      __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
      __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
      __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
      goto __pyx_L16_try_end;
      __pyx_L13_try_return:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L6;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2260
 *                 self._raiseAttributeError(k)
 * 
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
      __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
      if (__pyx_t_5) {
        __Pyx_AddTraceback("treedict.treedict.TreeDict.__getattr__");
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2260; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_v_e);
        __pyx_v_e = __pyx_t_3;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2261
 * 
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *         finally:
 */
        __Pyx_Raise(__pyx_v_e, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L10_exception_handled;
      }
      __pyx_L11_except_error:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L7;
      __pyx_L10_exception_handled:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      __pyx_L16_try_end:;
    }
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2264
 * 
 *         finally:
 *             _setFlagOff(&self._flags, f_getattr_called)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L6: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 3; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    __pyx_f_8treedict_8treedict__setFlagOff((&((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_flags), 1024);
    switch (__pyx_why) {
      case 3: goto __pyx_L0;
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__getattr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2266
 *             _setFlagOff(&self._flags, f_getattr_called)
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         if type(key) is not str:
 *             raise KeyError("'%s' (Indexing keys must be strings, not %s)"
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("__getitem__");
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2267
 * 
 *     def __getitem__(self, key):
 *         if type(key) is not str:             # <<<<<<<<<<<<<<
 *             raise KeyError("'%s' (Indexing keys must be strings, not %s)"
 *                            % (repr(key), repr(type(key))))
 */
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_key)) != ((PyObject *)((PyObject*)&PyString_Type)));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2269
 *         if type(key) is not str:
 *             raise KeyError("'%s' (Indexing keys must be strings, not %s)"
 *                            % (repr(key), repr(type(key))))             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __pyx_t_2 = PyObject_Repr(__pyx_v_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Repr(((PyObject *)Py_TYPE(__pyx_v_key))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2271
 *                            % (repr(key), repr(type(key))))
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return self._get(key,False)
 *         except Exception, e:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2272
 * 
 *         try:
 *             return self._get(key,False)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
      __Pyx_XDECREF(__pyx_r);
      if (!(likely(PyString_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_key)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2272; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_get(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((PyObject *)__pyx_v_key), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2272; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L10_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2273
 *         try:
 *             return self._get(key,False)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.__getitem__");
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_4;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2274
 *             return self._get(key,False)
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     cpdef get(self, str key, default_value = _NoDefault):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2274; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__getitem__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2276
 *             raise e
 * 
 *     cpdef get(self, str key, default_value = _NoDefault):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the value/branch associated with the key `key`.  If
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict_get(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_key, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_get *__pyx_optional_args) {
  PyObject *__pyx_v_default_value = __pyx_k_49;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("get");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_default_value = __pyx_optional_args->default_value;
    }
  }
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_get)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_key));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_key));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_key));
      __Pyx_INCREF(__pyx_v_default_value);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_default_value);
      __Pyx_GIVEREF(__pyx_v_default_value);
      __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2295
 *         """
 * 
 *         checkKeyNotNone(key)             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_t_1 = __pyx_f_8treedict_8treedict_checkKeyNotNone(__pyx_v_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2297
 *         checkKeyNotNone(key)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return self._get(key,False)
 *         except KeyError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2298
 * 
 *         try:
 *             return self._get(key,False)             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             if default_value is not _NoDefault:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_get(__pyx_v_self, __pyx_v_key, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2298; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L10_try_end;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2299
 *         try:
 *             return self._get(key,False)
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             if default_value is not _NoDefault:
 *                 return default_value
 */
    __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_4) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.get");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2300
 *             return self._get(key,False)
 *         except KeyError:
 *             if default_value is not _NoDefault:             # <<<<<<<<<<<<<<
 *                 return default_value
 *             else:
 */
      __pyx_t_5 = (__pyx_v_default_value != ((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict__NoDefault)));
      if (__pyx_t_5) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2301
 *         except KeyError:
 *             if default_value is not _NoDefault:
 *                 return default_value             # <<<<<<<<<<<<<<
 *             else:
 *                 raise KeyError(self._fullNameOf(key))
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_default_value);
        __pyx_r = __pyx_v_default_value;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L6_except_return;
        goto __pyx_L13;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2303
 *                 return default_value
 *             else:
 *                 raise KeyError(self._fullNameOf(key))             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
        __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_fullNameOf(__pyx_v_self, __pyx_v_key, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_Raise(__pyx_t_6, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __pyx_L13:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L4_exception_handled;
    }

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2304
 *             else:
 *                 raise KeyError(self._fullNameOf(key))
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_4) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.get");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2305
 *                 raise KeyError(self._fullNameOf(key))
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     ################################################################################
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L10_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.get");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2276
 *             raise e
 * 
 *     cpdef get(self, str key, default_value = _NoDefault):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the value/branch associated with the key `key`.  If
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_get[] = "\n        Returns the value/branch associated with the key `key`.  If\n        `default_value` is given, and the `key` is not present, then\n        `default_value` is returned; otherwise, a KeyError is raised.\n\n        Example::\n\n            >>> from treedict import TreeDict\n            >>> t = TreeDict(x = 1)\n            >>> t.get(\"x\")\n            1\n            >>> t.get(\"y\")\n            KeyError: 'root.y'\n            >>> t.get(\"y\", [])\n            []\n\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default_value = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8treedict_8treedict_8TreeDict_get __pyx_t_2;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__default_value,0};
  __Pyx_RefNannySetupContext("get");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = __pyx_k_49;
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[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_value);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = ((PyObject *)values[0]);
    __pyx_v_default_value = values[1];
  } else {
    __pyx_v_default_value = __pyx_k_49;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_default_value = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_key = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  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 = 2276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.get");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), &PyString_Type, 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.default_value = __pyx_v_default_value;
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->get(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.get");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2310
 *     # existence checks
 * 
 *     def __contains__(self, k):             # <<<<<<<<<<<<<<
 *         try:
 *             return self.exists(k)
 */

static int __pyx_pf_8treedict_8treedict_8TreeDict___contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_k); /*proto*/
static int __pyx_pf_8treedict_8treedict_8TreeDict___contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_k) {
  PyObject *__pyx_v_e;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__contains__");
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2311
 * 
 *     def __contains__(self, k):
 *         try:             # <<<<<<<<<<<<<<
 *             return self.exists(k)
 *         except Exception, e:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2312
 *     def __contains__(self, k):
 *         try:
 *             return self.exists(k)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
      __pyx_r = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->exists(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_k);
      goto __pyx_L9_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L9_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2313
 *         try:
 *             return self.exists(k)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_1 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_1) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.__contains__");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2314
 *             return self.exists(k)
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     def has_key(self, key):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2314; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__contains__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2316
 *             raise e
 * 
 *     def has_key(self, key):             # <<<<<<<<<<<<<<
 *         """
 *         Returns True if `key` is in the tree and False otherwise.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_has_key[] = "\n        Returns True if `key` is in the tree and False otherwise.\n\n        This is analogous to the `has_key` dict method.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("has_key");
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2322
 *         This is analogous to the `has_key` dict method.
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             return self.exists(key)
 *         except Exception, e:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2323
 *         """
 *         try:
 *             return self.exists(key)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->exists(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L9_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L9_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2324
 *         try:
 *             return self.exists(key)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.has_key");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2325
 *             return self.exists(key)
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     cdef bint exists(self, k):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2325; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.has_key");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2327
 *             raise e
 * 
 *     cdef bint exists(self, k):             # <<<<<<<<<<<<<<
 *         if type(k) is not str or k is None:
 *             return False
 */

static  int __pyx_f_8treedict_8treedict_8TreeDict_exists(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("exists");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2328
 * 
 *     cdef bint exists(self, k):
 *         if type(k) is not str or k is None:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_k)) != ((PyObject *)((PyObject*)&PyString_Type)));
  if (!__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_k == Py_None);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2329
 *     cdef bint exists(self, k):
 *         if type(k) is not str or k is None:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return self._exists(<str>k, False)
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2331
 *             return False
 *         else:
 *             return self._exists(<str>k, False)             # <<<<<<<<<<<<<<
 * 
 *     ##############################
 */
    __pyx_r = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_exists(__pyx_v_self, ((PyObject *)__pyx_v_k), 0);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2337
 *     # based on these
 * 
 *     cdef _PTreeNode _getPTNode(self, str k):             # <<<<<<<<<<<<<<
 *         cdef TreeDict p
 *         cdef _PTreeNode pn
 */

static  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_f_8treedict_8treedict_8TreeDict__getPTNode(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  int __pyx_v_pos;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_getPTNode");
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2340
 *         cdef TreeDict p
 *         cdef _PTreeNode pn
 *         cdef int pos = strfind(k, ".")             # <<<<<<<<<<<<<<
 * 
 *         if pos == -1:
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_k));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_k));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_k));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
  __pyx_t_2 = PyObject_Call(__pyx_v_8treedict_8treedict_strfind, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_pos = __pyx_t_3;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2342
 *         cdef int pos = strfind(k, ".")
 * 
 *         if pos == -1:             # <<<<<<<<<<<<<<
 *             return self._getLocalPTNode(k)
 *         else:
 */
  __pyx_t_4 = (__pyx_v_pos == -1);
  if (__pyx_t_4) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2343
 * 
 *         if pos == -1:
 *             return self._getLocalPTNode(k)             # <<<<<<<<<<<<<<
 *         else:
 *             pn = self._getLocalPTNode(k[:pos])
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getLocalPTNode(__pyx_v_self, __pyx_v_k)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2345
 *             return self._getLocalPTNode(k)
 *         else:
 *             pn = self._getLocalPTNode(k[:pos])             # <<<<<<<<<<<<<<
 * 
 *             if pn is None or not pn.isTree():
 */
    __pyx_t_2 = PySequence_GetSlice(((PyObject *)__pyx_v_k), 0, __pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getLocalPTNode(__pyx_v_self, __pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_pn));
    __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2347
 *             pn = self._getLocalPTNode(k[:pos])
 * 
 *             if pn is None or not pn.isTree():             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    __pyx_t_4 = (((PyObject *)__pyx_v_pn) == Py_None);
    if (!__pyx_t_4) {
      __pyx_t_5 = (!((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isTree(__pyx_v_pn));
      __pyx_t_6 = __pyx_t_5;
    } else {
      __pyx_t_6 = __pyx_t_4;
    }
    if (__pyx_t_6) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2348
 * 
 *             if pn is None or not pn.isTree():
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *             return pn.tree()._getPTNode(k[pos+1:])
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(Py_None);
      __pyx_r = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None);
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2350
 *                 return None
 * 
 *             return pn.tree()._getPTNode(k[pos+1:])             # <<<<<<<<<<<<<<
 * 
 *     cdef _PTreeNode _getLocalPTNode(self, str k):
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_GetSlice(((PyObject *)__pyx_v_k), (__pyx_v_pos + 1), PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1)->__pyx_vtab)->_getPTNode(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1), __pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_r = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_7);
    __pyx_t_7 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._getPTNode");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2352
 *             return pn.tree()._getPTNode(k[pos+1:])
 * 
 *     cdef _PTreeNode _getLocalPTNode(self, str k):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */

static  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_f_8treedict_8treedict_8TreeDict__getLocalPTNode(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_getLocalPTNode");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2354
 *     cdef _PTreeNode _getLocalPTNode(self, str k):
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return (<_PTreeNode> self._param_dict[k])
 * 
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2355
 * 
 *         try:
 *             return (<_PTreeNode> self._param_dict[k])             # <<<<<<<<<<<<<<
 * 
 *         except KeyError:
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->_param_dict), ((PyObject *)__pyx_v_k)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2355; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_1)));
      __pyx_r = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L10_try_end;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2357
 *             return (<_PTreeNode> self._param_dict[k])
 * 
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict._getLocalPTNode");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2357; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2358
 * 
 *         except KeyError:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     ##############################
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(Py_None);
      __pyx_r = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_except_return;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L10_try_end:;
  }

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._getLocalPTNode");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2363
 *     # General value retrieval / existance checking
 * 
 *     cdef _get(self, str k, bint dangling_okay):             # <<<<<<<<<<<<<<
 *         cdef _PTreeNode pn = self._getPTNode(k)
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__get(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k, int __pyx_v_dangling_okay) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_get");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2364
 * 
 *     cdef _get(self, str k, bint dangling_okay):
 *         cdef _PTreeNode pn = self._getPTNode(k)             # <<<<<<<<<<<<<<
 * 
 *         if pn is None or (not dangling_okay and pn.isDanglingBranch()):
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getPTNode(__pyx_v_self, __pyx_v_k)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2366
 *         cdef _PTreeNode pn = self._getPTNode(k)
 * 
 *         if pn is None or (not dangling_okay and pn.isDanglingBranch()):             # <<<<<<<<<<<<<<
 *             raise KeyError
 *         else:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_pn) == Py_None);
  if (!__pyx_t_2) {
    __pyx_t_3 = (!__pyx_v_dangling_okay);
    if (__pyx_t_3) {
      __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isDanglingBranch(__pyx_v_pn);
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_5;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2367
 * 
 *         if pn is None or (not dangling_okay and pn.isDanglingBranch()):
 *             raise KeyError             # <<<<<<<<<<<<<<
 *         else:
 *             return pn.value()
 */
    __Pyx_Raise(__pyx_builtin_KeyError, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2369
 *             raise KeyError
 *         else:
 *             return pn.value()             # <<<<<<<<<<<<<<
 * 
 *     cdef _getLocal(self, str k, bint dangling_okay):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->value(__pyx_v_pn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._get");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2371
 *             return pn.value()
 * 
 *     cdef _getLocal(self, str k, bint dangling_okay):             # <<<<<<<<<<<<<<
 *         cdef _PTreeNode pn = self._getLocalPTNode(k)
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__getLocal(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k, int __pyx_v_dangling_okay) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_getLocal");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2372
 * 
 *     cdef _getLocal(self, str k, bint dangling_okay):
 *         cdef _PTreeNode pn = self._getLocalPTNode(k)             # <<<<<<<<<<<<<<
 * 
 *         if pn is None or (not dangling_okay and pn.isDanglingBranch()):
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getLocalPTNode(__pyx_v_self, __pyx_v_k)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2374
 *         cdef _PTreeNode pn = self._getLocalPTNode(k)
 * 
 *         if pn is None or (not dangling_okay and pn.isDanglingBranch()):             # <<<<<<<<<<<<<<
 *             raise KeyError
 *         else:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_pn) == Py_None);
  if (!__pyx_t_2) {
    __pyx_t_3 = (!__pyx_v_dangling_okay);
    if (__pyx_t_3) {
      __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isDanglingBranch(__pyx_v_pn);
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_5;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2375
 * 
 *         if pn is None or (not dangling_okay and pn.isDanglingBranch()):
 *             raise KeyError             # <<<<<<<<<<<<<<
 *         else:
 *             return pn.value()
 */
    __Pyx_Raise(__pyx_builtin_KeyError, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2377
 *             raise KeyError
 *         else:
 *             return pn.value()             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _exists(self, str k, bint dangling_okay):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->value(__pyx_v_pn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._getLocal");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2379
 *             return pn.value()
 * 
 *     cdef bint _exists(self, str k, bint dangling_okay):             # <<<<<<<<<<<<<<
 * 
 *         cdef _PTreeNode pn = self._getPTNode(k)
 */

static  int __pyx_f_8treedict_8treedict_8TreeDict__exists(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k, int __pyx_v_dangling_okay) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_exists");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2381
 *     cdef bint _exists(self, str k, bint dangling_okay):
 * 
 *         cdef _PTreeNode pn = self._getPTNode(k)             # <<<<<<<<<<<<<<
 * 
 *         if pn is None:
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getPTNode(__pyx_v_self, __pyx_v_k)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2383
 *         cdef _PTreeNode pn = self._getPTNode(k)
 * 
 *         if pn is None:             # <<<<<<<<<<<<<<
 *             return False
 *         elif dangling_okay:
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_pn) == Py_None);
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2384
 * 
 *         if pn is None:
 *             return False             # <<<<<<<<<<<<<<
 *         elif dangling_okay:
 *             return True
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2385
 *         if pn is None:
 *             return False
 *         elif dangling_okay:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  if (__pyx_v_dangling_okay) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2386
 *             return False
 *         elif dangling_okay:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return not pn.isDanglingTree()
 */
    __pyx_r = 1;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2388
 *             return True
 *         else:
 *             return not pn.isDanglingTree()             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _existsLocal(self, str k, bint dangling_okay):
 */
    __pyx_r = (!((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isDanglingTree(__pyx_v_pn));
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict._exists");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pn);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2390
 *             return not pn.isDanglingTree()
 * 
 *     cdef bint _existsLocal(self, str k, bint dangling_okay):             # <<<<<<<<<<<<<<
 *         cdef _PTreeNode pn
 * 
 */

static  int __pyx_f_8treedict_8treedict_8TreeDict__existsLocal(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k, int __pyx_v_dangling_okay) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_existsLocal");
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2393
 *         cdef _PTreeNode pn
 * 
 *         if dangling_okay:             # <<<<<<<<<<<<<<
 *             return (k in self._param_dict)
 *         else:
 */
  if (__pyx_v_dangling_okay) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2394
 * 
 *         if dangling_okay:
 *             return (k in self._param_dict)             # <<<<<<<<<<<<<<
 *         else:
 *             pn = self._getLocalPTNode(k)
 */
    if (unlikely(((PyObject *)__pyx_v_self->_param_dict) == Py_None)) {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {
      __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_self->_param_dict), ((PyObject *)__pyx_v_k)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_r = __pyx_t_1;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2396
 *             return (k in self._param_dict)
 *         else:
 *             pn = self._getLocalPTNode(k)             # <<<<<<<<<<<<<<
 * 
 *             if pn is None:
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getLocalPTNode(__pyx_v_self, __pyx_v_k)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_pn));
    __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2398
 *             pn = self._getLocalPTNode(k)
 * 
 *             if pn is None:             # <<<<<<<<<<<<<<
 *                 return False
 *             else:
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_pn) == Py_None);
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2399
 * 
 *             if pn is None:
 *                 return False             # <<<<<<<<<<<<<<
 *             else:
 *                 return not pn.isDanglingTree()
 */
      __pyx_r = 0;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2401
 *                 return False
 *             else:
 *                 return not pn.isDanglingTree()             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_r = (!((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isDanglingTree(__pyx_v_pn));
      goto __pyx_L0;
    }
    __pyx_L4:;
  }
  __pyx_L3:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict._existsLocal");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2407
 *     # Master Functions for getting branches
 * 
 *     cdef TreeDict _getLocalBranch(self, str k, flagtype gsp):             # <<<<<<<<<<<<<<
 *         cdef _PTreeNode pn
 * 
 */

static  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_f_8treedict_8treedict_8TreeDict__getLocalBranch(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k, __pyx_t_8treedict_8treedict_flagtype __pyx_v_gsp) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __pyx_t_8treedict_8treedict_flagtype __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("_getLocalBranch");
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2410
 *         cdef _PTreeNode pn
 * 
 *         if self._existsLocal(k, True):             # <<<<<<<<<<<<<<
 *             pn = self._getLocalPTNode(k)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_existsLocal(__pyx_v_self, __pyx_v_k, 1);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2411
 * 
 *         if self._existsLocal(k, True):
 *             pn = self._getLocalPTNode(k)             # <<<<<<<<<<<<<<
 * 
 *             if not pn.isBranch():
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getLocalPTNode(__pyx_v_self, __pyx_v_k)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_pn));
    __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2413
 *             pn = self._getLocalPTNode(k)
 * 
 *             if not pn.isBranch():             # <<<<<<<<<<<<<<
 *                 if (gsp & f_retrieve_treedict_value_okay) and pn.isTree():
 *                     return pn.tree()
 */
    __pyx_t_1 = (!((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isBranch(__pyx_v_pn));
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2414
 * 
 *             if not pn.isBranch():
 *                 if (gsp & f_retrieve_treedict_value_okay) and pn.isTree():             # <<<<<<<<<<<<<<
 *                     return pn.tree()
 *                 elif (gsp & f_protect_structure) == 0:
 */
      if ((__pyx_v_gsp & 256)) {
        __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isTree(__pyx_v_pn);
        __pyx_t_3 = __pyx_t_1;
      } else {
        __pyx_t_3 = (__pyx_v_gsp & 256);
      }
      if (__pyx_t_3) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2415
 *             if not pn.isBranch():
 *                 if (gsp & f_retrieve_treedict_value_okay) and pn.isTree():
 *                     return pn.tree()             # <<<<<<<<<<<<<<
 *                 elif (gsp & f_protect_structure) == 0:
 *                     if (gsp & f_create_node_if_needed):
 */
        __Pyx_XDECREF(((PyObject *)__pyx_r));
        __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
        __pyx_t_2 = 0;
        goto __pyx_L0;
        goto __pyx_L5;
      }

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2416
 *                 if (gsp & f_retrieve_treedict_value_okay) and pn.isTree():
 *                     return pn.tree()
 *                 elif (gsp & f_protect_structure) == 0:             # <<<<<<<<<<<<<<
 *                     if (gsp & f_create_node_if_needed):
 *                         return self._newLocalBranch(k, gsp)
 */
      __pyx_t_3 = ((__pyx_v_gsp & 64) == 0);
      if (__pyx_t_3) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2417
 *                     return pn.tree()
 *                 elif (gsp & f_protect_structure) == 0:
 *                     if (gsp & f_create_node_if_needed):             # <<<<<<<<<<<<<<
 *                         return self._newLocalBranch(k, gsp)
 *                     else:
 */
        __pyx_t_4 = (__pyx_v_gsp & 1);
        if (__pyx_t_4) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2418
 *                 elif (gsp & f_protect_structure) == 0:
 *                     if (gsp & f_create_node_if_needed):
 *                         return self._newLocalBranch(k, gsp)             # <<<<<<<<<<<<<<
 *                     else:
 *                         return None
 */
          __Pyx_XDECREF(((PyObject *)__pyx_r));
          __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_newLocalBranch(__pyx_v_self, __pyx_v_k, __pyx_v_gsp)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
          __pyx_t_2 = 0;
          goto __pyx_L0;
          goto __pyx_L6;
        }
        /*else*/ {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2420
 *                         return self._newLocalBranch(k, gsp)
 *                     else:
 *                         return None             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise TypeError("Node \"%s\" is not a branch as required."
 */
          __Pyx_XDECREF(((PyObject *)__pyx_r));
          __Pyx_INCREF(Py_None);
          __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None);
          goto __pyx_L0;
        }
        __pyx_L6:;
        goto __pyx_L5;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2423
 *                 else:
 *                     raise TypeError("Node \"%s\" is not a branch as required."
 *                                     % self._fullNameOf(k) )             # <<<<<<<<<<<<<<
 * 
 *             if pn.isDanglingBranch() and not (gsp & f_retrieve_dangling_okay):
 */
        __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_fullNameOf(__pyx_v_self, __pyx_v_k, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_50), __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_5));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2425
 *                                     % self._fullNameOf(k) )
 * 
 *             if pn.isDanglingBranch() and not (gsp & f_retrieve_dangling_okay):             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isDanglingBranch(__pyx_v_pn);
    if (__pyx_t_3) {
      __pyx_t_1 = (!(__pyx_v_gsp & 2));
      __pyx_t_6 = __pyx_t_1;
    } else {
      __pyx_t_6 = __pyx_t_3;
    }
    if (__pyx_t_6) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2426
 * 
 *             if pn.isDanglingBranch() and not (gsp & f_retrieve_dangling_okay):
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *             return pn.tree()
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(Py_None);
      __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None);
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2428
 *                 return None
 * 
 *             return pn.tree()             # <<<<<<<<<<<<<<
 * 
 *         elif (gsp & f_create_node_if_needed):
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2430
 *             return pn.tree()
 * 
 *         elif (gsp & f_create_node_if_needed):             # <<<<<<<<<<<<<<
 *             return self._newLocalBranch(k, gsp)
 * 
 */
  __pyx_t_4 = (__pyx_v_gsp & 1);
  if (__pyx_t_4) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2431
 * 
 *         elif (gsp & f_create_node_if_needed):
 *             return self._newLocalBranch(k, gsp)             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_newLocalBranch(__pyx_v_self, __pyx_v_k, __pyx_v_gsp)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2434
 * 
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(Py_None);
    __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._getLocalBranch");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2437
 * 
 * 
 *     cdef TreeDict _getBranch(self, str k, flagtype gsp):             # <<<<<<<<<<<<<<
 * 
 *         cdef int pos = strfind(k, '.')
 */

static  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_f_8treedict_8treedict_8TreeDict__getBranch(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k, __pyx_t_8treedict_8treedict_flagtype __pyx_v_gsp) {
  int __pyx_v_pos;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_getBranch");
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2439
 *     cdef TreeDict _getBranch(self, str k, flagtype gsp):
 * 
 *         cdef int pos = strfind(k, '.')             # <<<<<<<<<<<<<<
 *         cdef str k1
 *         cdef TreeDict p
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_k));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_k));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_k));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
  __pyx_t_2 = PyObject_Call(__pyx_v_8treedict_8treedict_strfind, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_pos = __pyx_t_3;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2443
 *         cdef TreeDict p
 * 
 *         if pos != -1:             # <<<<<<<<<<<<<<
 *             p = self._getLocalBranch(k[:pos], gsp)
 *             return p._getBranch(k[pos+1:], gsp)
 */
  __pyx_t_4 = (__pyx_v_pos != -1);
  if (__pyx_t_4) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2444
 * 
 *         if pos != -1:
 *             p = self._getLocalBranch(k[:pos], gsp)             # <<<<<<<<<<<<<<
 *             return p._getBranch(k[pos+1:], gsp)
 *         else:
 */
    __pyx_t_2 = PySequence_GetSlice(((PyObject *)__pyx_v_k), 0, __pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getLocalBranch(__pyx_v_self, __pyx_t_2, __pyx_v_gsp)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_p));
    __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2445
 *         if pos != -1:
 *             p = self._getLocalBranch(k[:pos], gsp)
 *             return p._getBranch(k[pos+1:], gsp)             # <<<<<<<<<<<<<<
 *         else:
 *             return self._getLocalBranch(k, gsp)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_1 = PySequence_GetSlice(((PyObject *)__pyx_v_k), (__pyx_v_pos + 1), PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_getBranch(__pyx_v_p, __pyx_t_1, __pyx_v_gsp)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2447
 *             return p._getBranch(k[pos+1:], gsp)
 *         else:
 *             return self._getLocalBranch(k, gsp)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getLocalBranch(__pyx_v_self, __pyx_v_k, __pyx_v_gsp)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._getBranch");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_p);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2453
 *     # Convenience wrapper functions for above functions
 * 
 *     cdef TreeDict _getBaseOf(self, str key, flagtype gsp):             # <<<<<<<<<<<<<<
 *         cdef int pos = strrfind(key, '.')
 * 
 */

static  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_f_8treedict_8treedict_8TreeDict__getBaseOf(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_key, __pyx_t_8treedict_8treedict_flagtype __pyx_v_gsp) {
  int __pyx_v_pos;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_getBaseOf");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2454
 * 
 *     cdef TreeDict _getBaseOf(self, str key, flagtype gsp):
 *         cdef int pos = strrfind(key, '.')             # <<<<<<<<<<<<<<
 * 
 *         if pos == -1:
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_key));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_key));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_key));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
  __pyx_t_2 = PyObject_Call(__pyx_v_8treedict_8treedict_strrfind, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_pos = __pyx_t_3;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2456
 *         cdef int pos = strrfind(key, '.')
 * 
 *         if pos == -1:             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
  __pyx_t_4 = (__pyx_v_pos == -1);
  if (__pyx_t_4) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2457
 * 
 *         if pos == -1:
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             return self._getBranch(key[:pos], gsp)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2459
 *             return self
 *         else:
 *             return self._getBranch(key[:pos], gsp)             # <<<<<<<<<<<<<<
 * 
 *     cdef TreeDict _getBottomNode(self, str key):
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_2 = PySequence_GetSlice(((PyObject *)__pyx_v_key), 0, __pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getBranch(__pyx_v_self, __pyx_t_2, __pyx_v_gsp)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._getBaseOf");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2461
 *             return self._getBranch(key[:pos], gsp)
 * 
 *     cdef TreeDict _getBottomNode(self, str key):             # <<<<<<<<<<<<<<
 *         # When we start supporting relative links, this will become
 *         # more useful; for now we don't.
 */

static  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_f_8treedict_8treedict_8TreeDict__getBottomNode(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_key) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("_getBottomNode");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2465
 *         # more useful; for now we don't.
 * 
 *         return self             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2471
 *     # Methods relating to branch creation and manipulation
 * 
 *     def makeBranch(self, str name, bint only_new = False):             # <<<<<<<<<<<<<<
 *         """
 *         Explicitly creates a branch named `name` and returns it.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_makeBranch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_makeBranch[] = "\n        Explicitly creates a branch named `name` and returns it.\n\n        If `only_new` is True, and `name` is already present, a\n        ValueError is raised. Otherwise, a ValueError is raised only\n        if `name` refers to a non-branch value, and an existing branch\n        is returned if present.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_makeBranch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  int __pyx_v_only_new;
  PyObject *__pyx_v_v;
  __pyx_t_8treedict_8treedict_flagtype __pyx_v_gsp;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_b = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__only_new,0};
  __Pyx_RefNannySetupContext("makeBranch");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__only_new);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "makeBranch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2471; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_name = ((PyObject *)values[0]);
    if (values[1]) {
      __pyx_v_only_new = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_only_new == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2471; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_only_new = ((int)0);
    }
  } else {
    __pyx_v_only_new = ((int)0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_only_new = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_only_new == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2471; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_name = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("makeBranch", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2471; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.makeBranch");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), &PyString_Type, 1, "name", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2481
 *         """
 * 
 *         checkKeyNotNone(name)             # <<<<<<<<<<<<<<
 * 
 *         if self._exists(name, False):
 */
  __pyx_t_1 = __pyx_f_8treedict_8treedict_checkKeyNotNone(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2483
 *         checkKeyNotNone(name)
 * 
 *         if self._exists(name, False):             # <<<<<<<<<<<<<<
 *             if not only_new:
 *                 v = self._get(name, False)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_exists(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_name, 0);
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2484
 * 
 *         if self._exists(name, False):
 *             if not only_new:             # <<<<<<<<<<<<<<
 *                 v = self._get(name, False)
 * 
 */
    __pyx_t_2 = (!__pyx_v_only_new);
    if (__pyx_t_2) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2485
 *         if self._exists(name, False):
 *             if not only_new:
 *                 v = self._get(name, False)             # <<<<<<<<<<<<<<
 * 
 *                 if type(v) is TreeDict:
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_get(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_name, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2487
 *                 v = self._get(name, False)
 * 
 *                 if type(v) is TreeDict:             # <<<<<<<<<<<<<<
 *                     return v
 *                 else:
 */
      __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_v)) == ((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict_TreeDict)));
      if (__pyx_t_2) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2488
 * 
 *                 if type(v) is TreeDict:
 *                     return v             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError("'%s' already exists as non-branch key; cannot create new branch."
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_v);
        __pyx_r = __pyx_v_v;
        goto __pyx_L0;
        goto __pyx_L8;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2491
 *                 else:
 *                     raise ValueError("'%s' already exists as non-branch key; cannot create new branch."
 *                                      % name)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError("'%s' already exists; cannot create new branch."
 */
        __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_51), ((PyObject *)__pyx_v_name)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_1, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L8:;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2494
 *             else:
 *                 raise ValueError("'%s' already exists; cannot create new branch."
 *                                  % name)             # <<<<<<<<<<<<<<
 * 
 *         cdef flagtype gsp = (f_retrieve_dangling_okay | f_create_node_if_needed
 */
      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_v_name)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2496
 *                                  % name)
 * 
 *         cdef flagtype gsp = (f_retrieve_dangling_okay | f_create_node_if_needed             # <<<<<<<<<<<<<<
 *                              | f_atomic_set | f_create_dangling)
 * 
 */
  __pyx_v_gsp = 23;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2499
 *                              | f_atomic_set | f_create_dangling)
 * 
 *         cdef TreeDict b = self._getBranch(name, gsp)             # <<<<<<<<<<<<<<
 * 
 *         b._attachDanglingSelf()
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_getBranch(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_name, __pyx_v_gsp)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_b = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2501
 *         cdef TreeDict b = self._getBranch(name, gsp)
 * 
 *         b._attachDanglingSelf()             # <<<<<<<<<<<<<<
 * 
 *         if RUN_ASSERTS:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->_attachDanglingSelf(__pyx_v_b); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2513
 *             assert name in self
 * 
 *         return b             # <<<<<<<<<<<<<<
 * 
 *     cdef TreeDict _newLocalBranch(self, str k, flagtype gsp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_b));
  __pyx_r = ((PyObject *)__pyx_v_b);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.makeBranch");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_XDECREF((PyObject *)__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2515
 *         return b
 * 
 *     cdef TreeDict _newLocalBranch(self, str k, flagtype gsp):             # <<<<<<<<<<<<<<
 * 
 *         cdef TreeDict b
 */

static  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_f_8treedict_8treedict_8TreeDict__newLocalBranch(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_k, __pyx_t_8treedict_8treedict_flagtype __pyx_v_gsp) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_b;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __pyx_t_8treedict_8treedict_flagtype __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_newLocalBranch");
  __pyx_v_b = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2519
 *         cdef TreeDict b
 * 
 *         b = newTreeDict(k, False)             # <<<<<<<<<<<<<<
 * 
 *         b._parent = self
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8treedict_8treedict_newTreeDict(__pyx_v_k, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_b));
  __pyx_v_b = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2521
 *         b = newTreeDict(k, False)
 * 
 *         b._parent = self             # <<<<<<<<<<<<<<
 *         b._flags = self._flags & f_newbranch_propegating_flags
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_b->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_b->_parent));
  __pyx_v_b->_parent = __pyx_v_self;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2522
 * 
 *         b._parent = self
 *         b._flags = self._flags & f_newbranch_propegating_flags             # <<<<<<<<<<<<<<
 * 
 *         if gsp & f_atomic_set:
 */
  __pyx_v_b->_flags = (__pyx_v_self->_flags & 9);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2524
 *         b._flags = self._flags & f_newbranch_propegating_flags
 * 
 *         if gsp & f_atomic_set:             # <<<<<<<<<<<<<<
 *             b._setDangling(True)
 *             b._setDetachedDangling(True)
 */
  __pyx_t_2 = (__pyx_v_gsp & 4);
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2525
 * 
 *         if gsp & f_atomic_set:
 *             b._setDangling(True)             # <<<<<<<<<<<<<<
 *             b._setDetachedDangling(True)
 * 
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->_setDangling(__pyx_v_b, 1);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2526
 *         if gsp & f_atomic_set:
 *             b._setDangling(True)
 *             b._setDetachedDangling(True)             # <<<<<<<<<<<<<<
 * 
 *             if RUN_ASSERTS:
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->_setDetachedDangling(__pyx_v_b, 1);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2531
 *                 n_d = self._n_dangling
 * 
 *             self._setLocalBranch(b, f_check_only)             # <<<<<<<<<<<<<<
 * 
 *             if RUN_ASSERTS:
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setLocalBranch(__pyx_v_self, __pyx_v_b, 8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2536
 *                 assert n_d == self._n_dangling
 * 
 *         elif gsp & f_create_dangling:             # <<<<<<<<<<<<<<
 *             b._setDangling(True)
 *             self._setLocalBranch(b, 0)
 */
  __pyx_t_2 = (__pyx_v_gsp & 16);
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2537
 * 
 *         elif gsp & f_create_dangling:
 *             b._setDangling(True)             # <<<<<<<<<<<<<<
 *             self._setLocalBranch(b, 0)
 * 
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->_setDangling(__pyx_v_b, 1);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2538
 *         elif gsp & f_create_dangling:
 *             b._setDangling(True)
 *             self._setLocalBranch(b, 0)             # <<<<<<<<<<<<<<
 * 
 *             b._setDangling(True if (gsp & f_create_dangling) else False)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setLocalBranch(__pyx_v_self, __pyx_v_b, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2540
 *             self._setLocalBranch(b, 0)
 * 
 *             b._setDangling(True if (gsp & f_create_dangling) else False)             # <<<<<<<<<<<<<<
 *             self._setLocalBranch(b, 0)
 * 
 */
    if ((__pyx_v_gsp & 16)) {
      __pyx_t_3 = 1;
    } else {
      __pyx_t_3 = 0;
    }
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->_setDangling(__pyx_v_b, __pyx_t_3);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2541
 * 
 *             b._setDangling(True if (gsp & f_create_dangling) else False)
 *             self._setLocalBranch(b, 0)             # <<<<<<<<<<<<<<
 * 
 *         return b
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setLocalBranch(__pyx_v_self, __pyx_v_b, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2543
 *             self._setLocalBranch(b, 0)
 * 
 *         return b             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_b));
  __pyx_r = __pyx_v_b;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._newLocalBranch");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_b);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2546
 * 
 * 
 *     cdef _setLocalBranch(self, TreeDict tree, flagtype gsp):             # <<<<<<<<<<<<<<
 * 
 *         self._setLocal(tree._name, tree, gsp)
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__setLocalBranch(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_tree, __pyx_t_8treedict_8treedict_flagtype __pyx_v_gsp) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_setLocalBranch");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2548
 *     cdef _setLocalBranch(self, TreeDict tree, flagtype gsp):
 * 
 *         self._setLocal(tree._name, tree, gsp)             # <<<<<<<<<<<<<<
 * 
 *         if not (gsp & f_check_only):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setLocal(__pyx_v_self, __pyx_v_tree->_name, ((PyObject *)__pyx_v_tree), __pyx_v_gsp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2550
 *         self._setLocal(tree._name, tree, gsp)
 * 
 *         if not (gsp & f_check_only):             # <<<<<<<<<<<<<<
 * 
 *             if RUN_ASSERTS:
 */
  __pyx_t_2 = (!(__pyx_v_gsp & 8));
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2559
 *                     assert tree is not t
 * 
 *             self._branches.append(tree)             # <<<<<<<<<<<<<<
 * 
 *     cdef _attachDanglingSelf(self):
 */
    if (unlikely(__pyx_v_self->_branches == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_self->_branches), ((PyObject *)__pyx_v_tree)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._setLocalBranch");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2561
 *             self._branches.append(tree)
 * 
 *     cdef _attachDanglingSelf(self):             # <<<<<<<<<<<<<<
 * 
 *         if not self.isDangling():
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__attachDanglingSelf(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_attachDanglingSelf");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2563
 *     cdef _attachDanglingSelf(self):
 * 
 *         if not self.isDangling():             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->isDangling(__pyx_v_self, 0));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2564
 * 
 *         if not self.isDangling():
 *             return             # <<<<<<<<<<<<<<
 * 
 *         cdef TreeDict p = self.parentNode()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2566
 *             return
 * 
 *         cdef TreeDict p = self.parentNode()             # <<<<<<<<<<<<<<
 * 
 *         if RUN_ASSERTS:
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->parentNode(__pyx_v_self, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2572
 * 
 *         # See if the base needs to be attached
 *         p._attachDanglingSelf()             # <<<<<<<<<<<<<<
 * 
 *         self._setDangling(False)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_attachDanglingSelf(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2574
 *         p._attachDanglingSelf()
 * 
 *         self._setDangling(False)             # <<<<<<<<<<<<<<
 * 
 *         if RUN_ASSERTS:
 */
  ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setDangling(__pyx_v_self, 0);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2579
 *             assert not self.isDangling()
 * 
 *         if self._isDetachedDangling():             # <<<<<<<<<<<<<<
 *             self._setDetachedDangling(False)
 *             p._setLocalBranch(self, f_already_checked)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_isDetachedDangling(__pyx_v_self, 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2580
 * 
 *         if self._isDetachedDangling():
 *             self._setDetachedDangling(False)             # <<<<<<<<<<<<<<
 *             p._setLocalBranch(self, f_already_checked)
 * 
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setDetachedDangling(__pyx_v_self, 0);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2581
 *         if self._isDetachedDangling():
 *             self._setDetachedDangling(False)
 *             p._setLocalBranch(self, f_already_checked)             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_setLocalBranch(__pyx_v_p, __pyx_v_self, 32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2587
 *                 assert p._n_dangling != 0
 * 
 *             p._n_dangling -= 1             # <<<<<<<<<<<<<<
 * 
 *         if s_dangling_reference_queue in self._aux_dict:
 */
    __pyx_v_p->_n_dangling -= 1;
  }
  __pyx_L4:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2589
 *             p._n_dangling -= 1
 * 
 *         if s_dangling_reference_queue in self._aux_dict:             # <<<<<<<<<<<<<<
 *             del self._aux_dict[s_dangling_reference_queue]
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self->_aux_dict) == Py_None)) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else {
    __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_dangling_reference_queue)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2590
 * 
 *         if s_dangling_reference_queue in self._aux_dict:
 *             del self._aux_dict[s_dangling_reference_queue]             # <<<<<<<<<<<<<<
 * 
 *     ###############################################################################
 */
    if (PyDict_DelItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_dangling_reference_queue)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._attachDanglingSelf");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2595
 *     # Equality comparisons
 * 
 *     def __richcmp__(p1, p2, int t):             # <<<<<<<<<<<<<<
 * 
 *         cdef bint are_equal
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___richcmp__(PyObject *__pyx_v_p1, PyObject *__pyx_v_p2, int __pyx_v_t); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___richcmp__(PyObject *__pyx_v_p1, PyObject *__pyx_v_p2, int __pyx_v_t) {
  int __pyx_v_are_equal;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("__richcmp__");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2599
 *         cdef bint are_equal
 * 
 *         if type(p1) is not TreeDict:             # <<<<<<<<<<<<<<
 *             if RUN_ASSERTS:
 *                 assert type(p2) is TreeDict
 */
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_p1)) != ((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict_TreeDict)));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2603
 *                 assert type(p2) is TreeDict
 * 
 *             if isinstance(p1, dict):             # <<<<<<<<<<<<<<
 *                 are_equal = (dict((<TreeDict>p2).iteritems()) == p1)
 *             else:
 */
    __pyx_t_1 = PyDict_Check(__pyx_v_p1); 
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2604
 * 
 *             if isinstance(p1, dict):
 *                 are_equal = (dict((<TreeDict>p2).iteritems()) == p1)             # <<<<<<<<<<<<<<
 *             else:
 *                 are_equal = False
 */
      __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_p2)->__pyx_vtab)->iteritems(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_p2), 0, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __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 = PyObject_Call(((PyObject *)((PyObject*)&PyDict_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_p1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_are_equal = __pyx_t_1;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2606
 *                 are_equal = (dict((<TreeDict>p2).iteritems()) == p1)
 *             else:
 *                 are_equal = False             # <<<<<<<<<<<<<<
 * 
 *         elif type(p2) is not TreeDict:
 */
      __pyx_v_are_equal = 0;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2608
 *                 are_equal = False
 * 
 *         elif type(p2) is not TreeDict:             # <<<<<<<<<<<<<<
 *             if RUN_ASSERTS:
 *                 assert type(p1) is TreeDict
 */
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_p2)) != ((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict_TreeDict)));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2612
 *                 assert type(p1) is TreeDict
 * 
 *             if isinstance(p2, dict):             # <<<<<<<<<<<<<<
 *                 are_equal = (dict((<TreeDict>p1).iteritems()) == p2)
 *             else:
 */
    __pyx_t_1 = PyDict_Check(__pyx_v_p2); 
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2613
 * 
 *             if isinstance(p2, dict):
 *                 are_equal = (dict((<TreeDict>p1).iteritems()) == p2)             # <<<<<<<<<<<<<<
 *             else:
 *                 are_equal = False
 */
      __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_p1)->__pyx_vtab)->iteritems(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_p1), 0, NULL)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyDict_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_p2, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_are_equal = __pyx_t_1;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2615
 *                 are_equal = (dict((<TreeDict>p1).iteritems()) == p2)
 *             else:
 *                 are_equal = False             # <<<<<<<<<<<<<<
 * 
 *         elif p1 is None or p2 is None:
 */
      __pyx_v_are_equal = 0;
    }
    __pyx_L7:;
    goto __pyx_L5;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2617
 *                 are_equal = False
 * 
 *         elif p1 is None or p2 is None:             # <<<<<<<<<<<<<<
 *             are_equal = False
 * 
 */
  __pyx_t_1 = (__pyx_v_p1 == Py_None);
  if (!__pyx_t_1) {
    __pyx_t_4 = (__pyx_v_p2 == Py_None);
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_1;
  }
  if (__pyx_t_5) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2618
 * 
 *         elif p1 is None or p2 is None:
 *             are_equal = False             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_v_are_equal = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2621
 * 
 *         else:
 *             are_equal = (<TreeDict>p1)._isEqual(<TreeDict>p2)             # <<<<<<<<<<<<<<
 * 
 *         if t == 2:              # ==
 */
    __pyx_v_are_equal = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_p1)->__pyx_vtab)->_isEqual(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_p1), ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_p2));
  }
  __pyx_L5:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2623
 *             are_equal = (<TreeDict>p1)._isEqual(<TreeDict>p2)
 * 
 *         if t == 2:              # ==             # <<<<<<<<<<<<<<
 *             return are_equal
 *         elif t == 3:            # !=
 */
  switch (__pyx_v_t) {
    case 2:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2624
 * 
 *         if t == 2:              # ==
 *             return are_equal             # <<<<<<<<<<<<<<
 *         elif t == 3:            # !=
 *             return not are_equal
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_are_equal); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2625
 *         if t == 2:              # ==
 *             return are_equal
 *         elif t == 3:            # !=             # <<<<<<<<<<<<<<
 *             return not are_equal
 *         else:
 */
    case 3:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2626
 *             return are_equal
 *         elif t == 3:            # !=
 *             return not are_equal             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong((!__pyx_v_are_equal)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2628
 *             return not are_equal
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _isEqual(self, TreeDict p):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__richcmp__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2630
 *             return False
 * 
 *     cdef bint _isEqual(self, TreeDict p):             # <<<<<<<<<<<<<<
 * 
 *         cdef size_t i
 */

static  int __pyx_f_8treedict_8treedict_8TreeDict__isEqual(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p) {
  int __pyx_v_self_dng;
  int __pyx_v_other_dng;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn1;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn2;
  PyObject *__pyx_v_k;
  int __pyx_r;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  void *__pyx_t_7;
  void *__pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("_isEqual");
  __pyx_v_pn1 = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_pn2 = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2634
 *         cdef size_t i
 * 
 *         if p is None:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_p) == Py_None);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2635
 * 
 *         if p is None:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         # The tricky thing is that equality testing needs to ignore
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2640
 *         # any dangling nodes, as they don't really exist...
 * 
 *         cdef bint self_dng  = self.isDangling()             # <<<<<<<<<<<<<<
 *         cdef bint other_dng = p.isDangling()
 * 
 */
  __pyx_v_self_dng = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->isDangling(__pyx_v_self, 0);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2641
 * 
 *         cdef bint self_dng  = self.isDangling()
 *         cdef bint other_dng = p.isDangling()             # <<<<<<<<<<<<<<
 * 
 *         if self_dng != other_dng:
 */
  __pyx_v_other_dng = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->isDangling(__pyx_v_p, 0);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2643
 *         cdef bint other_dng = p.isDangling()
 * 
 *         if self_dng != other_dng:             # <<<<<<<<<<<<<<
 *             return False
 *         elif self_dng and other_dng:
 */
  __pyx_t_1 = (__pyx_v_self_dng != __pyx_v_other_dng);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2644
 * 
 *         if self_dng != other_dng:
 *             return False             # <<<<<<<<<<<<<<
 *         elif self_dng and other_dng:
 *             return True
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2645
 *         if self_dng != other_dng:
 *             return False
 *         elif self_dng and other_dng:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  if (__pyx_v_self_dng) {
    __pyx_t_1 = __pyx_v_other_dng;
  } else {
    __pyx_t_1 = __pyx_v_self_dng;
  }
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2646
 *             return False
 *         elif self_dng and other_dng:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         # Attempt reject based on other equality measures
 */
    __pyx_r = 1;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2649
 * 
 *         # Attempt reject based on other equality measures
 *         if (len(self._param_dict) - self._n_dangling             # <<<<<<<<<<<<<<
 *             != len(p._param_dict) - p._n_dangling):
 *             return False
 */
  if (unlikely(__pyx_v_self->_param_dict == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = PyDict_Size(((PyObject *)__pyx_v_self->_param_dict)); 

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2650
 *         # Attempt reject based on other equality measures
 *         if (len(self._param_dict) - self._n_dangling
 *             != len(p._param_dict) - p._n_dangling):             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  if (unlikely(__pyx_v_p->_param_dict == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = PyDict_Size(((PyObject *)__pyx_v_p->_param_dict)); 
  __pyx_t_1 = ((__pyx_t_2 - __pyx_v_self->_n_dangling) != (__pyx_t_3 - __pyx_v_p->_n_dangling));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2651
 *         if (len(self._param_dict) - self._n_dangling
 *             != len(p._param_dict) - p._n_dangling):
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         if self._n_mutable != p._n_mutable:
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2653
 *             return False
 * 
 *         if self._n_mutable != p._n_mutable:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_n_mutable != __pyx_v_p->_n_mutable);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2654
 * 
 *         if self._n_mutable != p._n_mutable:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         if self._getImmutableItemsHash() != p._getImmutableItemsHash():
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2656
 *             return False
 * 
 *         if self._getImmutableItemsHash() != p._getImmutableItemsHash():             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getImmutableItemsHash(__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_getImmutableItemsHash(__pyx_v_p)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2657
 * 
 *         if self._getImmutableItemsHash() != p._getImmutableItemsHash():
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         cdef _PTreeNode pn1, pn2
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2661
 *         cdef _PTreeNode pn1, pn2
 * 
 *         for k, pn1 in self._param_dict.iteritems():             # <<<<<<<<<<<<<<
 * 
 *             if pn1.isImmutable():
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_param_dict));
  __Pyx_XDECREF(__pyx_t_6);
  __pyx_t_6 = ((PyObject *)__pyx_v_self->_param_dict);
  __pyx_t_3 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_6, (&__pyx_t_3), ((PyObject **)(&__pyx_t_7)), ((PyObject **)(&__pyx_t_8)))) break;
    __Pyx_INCREF(((PyObject *)__pyx_t_7));
    __Pyx_DECREF(__pyx_v_k);
    __pyx_v_k = ((PyObject *)__pyx_t_7);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_8), __pyx_ptype_8treedict_8treedict__PTreeNode)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_8)));
    __Pyx_DECREF(((PyObject *)__pyx_v_pn1));
    __pyx_v_pn1 = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_8);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2663
 *         for k, pn1 in self._param_dict.iteritems():
 * 
 *             if pn1.isImmutable():             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn1->__pyx_vtab)->isImmutable(__pyx_v_pn1);
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2664
 * 
 *             if pn1.isImmutable():
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             if pn1.isDanglingTree():
 */
      goto __pyx_L8_continue;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2666
 *                 continue
 * 
 *             if pn1.isDanglingTree():             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn1->__pyx_vtab)->isDanglingTree(__pyx_v_pn1);
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2667
 * 
 *             if pn1.isDanglingTree():
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             try:
 */
      goto __pyx_L8_continue;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2669
 *                 continue
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 pn2 = p._param_dict[k]
 *             except KeyError:
 */
    {
      PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
      __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
      __Pyx_XGOTREF(__pyx_save_exc_type);
      __Pyx_XGOTREF(__pyx_save_exc_value);
      __Pyx_XGOTREF(__pyx_save_exc_tb);
      /*try:*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2670
 * 
 *             try:
 *                 pn2 = p._param_dict[k]             # <<<<<<<<<<<<<<
 *             except KeyError:
 *                 return False
 */
        __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_p->_param_dict), __pyx_v_k); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2670; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        __Pyx_GOTREF(__pyx_t_5);
        if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_8treedict_8treedict__PTreeNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2670; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
        __Pyx_DECREF(((PyObject *)__pyx_v_pn2));
        __pyx_v_pn2 = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_5);
        __pyx_t_5 = 0;
      }
      __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
      __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
      __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
      goto __pyx_L19_try_end;
      __pyx_L12_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2671
 *             try:
 *                 pn2 = p._param_dict[k]
 *             except KeyError:             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
      __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
      if (__pyx_t_9) {
        __Pyx_AddTraceback("treedict.treedict.TreeDict._isEqual");
        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_10);

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2672
 *                 pn2 = p._param_dict[k]
 *             except KeyError:
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *             if not pn1.isEqual(pn2):
 */
        __pyx_r = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L15_except_return;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L13_exception_handled;
      }
      __pyx_L14_except_error:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L1_error;
      __pyx_L15_except_return:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L0;
      __pyx_L13_exception_handled:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      __pyx_L19_try_end:;
    }

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2674
 *                 return False
 * 
 *             if not pn1.isEqual(pn2):             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
    __pyx_t_1 = (!((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn1->__pyx_vtab)->isEqual(__pyx_v_pn1, __pyx_v_pn2));
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2675
 * 
 *             if not pn1.isEqual(pn2):
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *         return True
 */
      __pyx_r = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L0;
      goto __pyx_L22;
    }
    __pyx_L22:;
    __pyx_L8_continue:;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2677
 *                 return False
 * 
 *         return True             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 1;
  goto __pyx_L0;

  __pyx_r = 0;
  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_10);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict._isEqual");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_pn1);
  __Pyx_DECREF((PyObject *)__pyx_v_pn2);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2683
 *     # hash stuff
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         if not self.isFrozen():
 *             raise TypeError("Only frozen trees are python hashable.")
 */

static long __pyx_pf_8treedict_8treedict_8TreeDict___hash__(PyObject *__pyx_v_self); /*proto*/
static long __pyx_pf_8treedict_8treedict_8TreeDict___hash__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_s;
  long __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  long __pyx_t_4;
  __Pyx_RefNannySetupContext("__hash__");
  __pyx_v_s = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2684
 * 
 *     def __hash__(self):
 *         if not self.isFrozen():             # <<<<<<<<<<<<<<
 *             raise TypeError("Only frozen trees are python hashable.")
 * 
 */
  __pyx_t_1 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->isFrozen(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2685
 *     def __hash__(self):
 *         if not self.isFrozen():
 *             raise TypeError("Only frozen trees are python hashable.")             # <<<<<<<<<<<<<<
 * 
 *         if self.isMutable():
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_54));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_54));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_54));
    __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2685; __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);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2687
 *             raise TypeError("Only frozen trees are python hashable.")
 * 
 *         if self.isMutable():             # <<<<<<<<<<<<<<
 *             s = self._firstMutableType()
 *             if s is not None:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->isMutable(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2688
 * 
 *         if self.isMutable():
 *             s = self._firstMutableType()             # <<<<<<<<<<<<<<
 *             if s is not None:
 *                 raise TypeError("Node '%s' (and possibly more) not hashable." % s)
 */
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_firstMutableType(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_s);
    __pyx_v_s = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2689
 *         if self.isMutable():
 *             s = self._firstMutableType()
 *             if s is not None:             # <<<<<<<<<<<<<<
 *                 raise TypeError("Node '%s' (and possibly more) not hashable." % s)
 * 
 */
    __pyx_t_1 = (__pyx_v_s != Py_None);
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2690
 *             s = self._firstMutableType()
 *             if s is not None:
 *                 raise TypeError("Node '%s' (and possibly more) not hashable." % s)             # <<<<<<<<<<<<<<
 * 
 *         return hash(self._self_immutable_hash())
 */
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_55), __pyx_v_s); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2690; __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);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2692
 *                 raise TypeError("Node '%s' (and possibly more) not hashable." % s)
 * 
 *         return hash(self._self_immutable_hash())             # <<<<<<<<<<<<<<
 * 
 *     cdef str _firstMutableType(self):
 */
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_self_immutable_hash(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_Hash(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__hash__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_s);
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2694
 *         return hash(self._self_immutable_hash())
 * 
 *     cdef str _firstMutableType(self):             # <<<<<<<<<<<<<<
 *         cdef _PTreeNode pn
 *         cdef str s
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__firstMutableType(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  PyObject *__pyx_v_s;
  PyObject *__pyx_v_k;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  void *__pyx_t_3;
  void *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("_firstMutableType");
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_s = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2700
 *         # Mutable tests; if there are no mutable items, then go with
 * 
 *         for k, pn in self._param_dict.iteritems():             # <<<<<<<<<<<<<<
 *             if pn.isMutable() or (pn.isTree() and pn.tree().isMutable()):
 *                 return k
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_param_dict));
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_param_dict);
  __pyx_t_2 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_1, (&__pyx_t_2), ((PyObject **)(&__pyx_t_3)), ((PyObject **)(&__pyx_t_4)))) break;
    __Pyx_INCREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_v_k);
    __pyx_v_k = ((PyObject *)__pyx_t_3);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_4), __pyx_ptype_8treedict_8treedict__PTreeNode)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_4)));
    __Pyx_DECREF(((PyObject *)__pyx_v_pn));
    __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_4);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2701
 * 
 *         for k, pn in self._param_dict.iteritems():
 *             if pn.isMutable() or (pn.isTree() and pn.tree().isMutable()):             # <<<<<<<<<<<<<<
 *                 return k
 * 
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isMutable(__pyx_v_pn);
    if (!__pyx_t_5) {
      __pyx_t_6 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isTree(__pyx_v_pn);
      if (__pyx_t_6) {
        __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_7)->__pyx_vtab)->isMutable(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_7), 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_9 = __pyx_t_8;
      } else {
        __pyx_t_9 = __pyx_t_6;
      }
      __pyx_t_6 = __pyx_t_9;
    } else {
      __pyx_t_6 = __pyx_t_5;
    }
    if (__pyx_t_6) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2702
 *         for k, pn in self._param_dict.iteritems():
 *             if pn.isMutable() or (pn.isTree() and pn.tree().isMutable()):
 *                 return k             # <<<<<<<<<<<<<<
 * 
 *             if pn.isBranch():
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      if (!(likely(PyString_CheckExact(__pyx_v_k))||((__pyx_v_k) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_k)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_INCREF(__pyx_v_k);
      __pyx_r = ((PyObject *)__pyx_v_k);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2704
 *                 return k
 * 
 *             if pn.isBranch():             # <<<<<<<<<<<<<<
 *                 s = pn.tree()._firstMutableType()
 *                 if s is not None:
 */
    __pyx_t_6 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isBranch(__pyx_v_pn);
    if (__pyx_t_6) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2705
 * 
 *             if pn.isBranch():
 *                 s = pn.tree()._firstMutableType()             # <<<<<<<<<<<<<<
 *                 if s is not None:
 *                     return k + "." + s
 */
      __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_10 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_7)->__pyx_vtab)->_firstMutableType(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_7))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_s));
      __pyx_v_s = ((PyObject *)__pyx_t_10);
      __pyx_t_10 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2706
 *             if pn.isBranch():
 *                 s = pn.tree()._firstMutableType()
 *                 if s is not None:             # <<<<<<<<<<<<<<
 *                     return k + "." + s
 * 
 */
      __pyx_t_6 = (__pyx_v_s != ((PyObject *)Py_None));
      if (__pyx_t_6) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2707
 *                 s = pn.tree()._firstMutableType()
 *                 if s is not None:
 *                     return k + "." + s             # <<<<<<<<<<<<<<
 * 
 *         return None
 */
        __Pyx_XDECREF(((PyObject *)__pyx_r));
        __pyx_t_10 = PyNumber_Add(__pyx_v_k, ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_7 = PyNumber_Add(__pyx_t_10, ((PyObject *)__pyx_v_s)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (!(likely(PyString_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_7)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_r = ((PyObject *)__pyx_t_7);
        __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
        goto __pyx_L7;
      }
      __pyx_L7:;
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2709
 *                     return k + "." + s
 * 
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     cpdef bint isMutable(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(Py_None);
  __pyx_r = ((PyObject *)Py_None);
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._firstMutableType");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_DECREF(__pyx_v_s);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2711
 *         return None
 * 
 *     cpdef bint isMutable(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if the current tree is frozen and contains no
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isMutable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  int __pyx_f_8treedict_8treedict_8TreeDict_isMutable(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  PyObject *__pyx_v_k;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  void *__pyx_t_5;
  void *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("isMutable");
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__isMutable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_isMutable)) {
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2720
 *         # cause it just does quick checks
 * 
 *         if not self.isFrozen():             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  __pyx_t_3 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->isFrozen(__pyx_v_self, 0));
  if (__pyx_t_3) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2721
 * 
 *         if not self.isFrozen():
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         if self._n_mutable != 0:
 */
    __pyx_r = 1;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2723
 *             return True
 * 
 *         if self._n_mutable != 0:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  __pyx_t_3 = (__pyx_v_self->_n_mutable != 0);
  if (__pyx_t_3) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2724
 * 
 *         if self._n_mutable != 0:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         cdef _PTreeNode pn
 */
    __pyx_r = 1;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2728
 *         cdef _PTreeNode pn
 * 
 *         for k, pn in self._param_dict.iteritems():             # <<<<<<<<<<<<<<
 *             if pn.isTree() and pn.tree().isMutable():
 *                 return True
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_param_dict));
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_param_dict);
  __pyx_t_4 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_1, (&__pyx_t_4), ((PyObject **)(&__pyx_t_5)), ((PyObject **)(&__pyx_t_6)))) break;
    __Pyx_INCREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(__pyx_v_k);
    __pyx_v_k = ((PyObject *)__pyx_t_5);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_6), __pyx_ptype_8treedict_8treedict__PTreeNode)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_6)));
    __Pyx_DECREF(((PyObject *)__pyx_v_pn));
    __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_6);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2729
 * 
 *         for k, pn in self._param_dict.iteritems():
 *             if pn.isTree() and pn.tree().isMutable():             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isTree(__pyx_v_pn);
    if (__pyx_t_3) {
      __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2)->__pyx_vtab)->isMutable(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2), 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = __pyx_t_7;
    } else {
      __pyx_t_8 = __pyx_t_3;
    }
    if (__pyx_t_8) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2730
 *         for k, pn in self._param_dict.iteritems():
 *             if pn.isTree() and pn.tree().isMutable():
 *                 return True             # <<<<<<<<<<<<<<
 * 
 *         return False
 */
      __pyx_r = 1;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2732
 *                 return True
 * 
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def _numMutable(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict.isMutable");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2711
 *         return None
 * 
 *     cpdef bint isMutable(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if the current tree is frozen and contains no
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isMutable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_isMutable[] = "\n        Returns true if the current tree is frozen and contains no\n        mutable values, otherwise returns False.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_isMutable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("isMutable");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->isMutable(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.isMutable");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2734
 *         return False
 * 
 *     def _numMutable(self):             # <<<<<<<<<<<<<<
 *         # For testing
 *         return self._n_mutable
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__numMutable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict__numMutable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_numMutable");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2736
 *     def _numMutable(self):
 *         # For testing
 *         return self._n_mutable             # <<<<<<<<<<<<<<
 * 
 *     ########################################
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_n_mutable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._numMutable");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2741
 *     # Hashes that handle mutability, for things like database lookups, etc.
 * 
 *     cpdef hash(self, str key=None, bint add_name = False, keys=None):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a hash of the current tree / branch and all
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_hash(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict_hash(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_hash *__pyx_optional_args) {
  PyObject *__pyx_v_key = ((PyObject *)Py_None);
  int __pyx_v_add_name = ((int)0);
  PyObject *__pyx_v_keys = ((PyObject *)Py_None);
  PyObject *__pyx_v_key_set;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("hash");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_key = __pyx_optional_args->key;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_add_name = __pyx_optional_args->add_name;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_keys = __pyx_optional_args->keys;
        }
      }
    }
  }
  __pyx_v_key_set = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__hash); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_hash)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_add_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(((PyObject *)__pyx_v_key));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_key));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_key));
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_keys);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_keys);
      __Pyx_GIVEREF(__pyx_v_keys);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2741; __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;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2798
 * 
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             if add_name:
 *                 if key is not None:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2799
 *         """
 *         try:
 *             if add_name:             # <<<<<<<<<<<<<<
 *                 if key is not None:
 *                     return self._reportable_hash(self._shortKeyName(key), self._item_hash(key))
 */
      if (__pyx_v_add_name) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2800
 *         try:
 *             if add_name:
 *                 if key is not None:             # <<<<<<<<<<<<<<
 *                     return self._reportable_hash(self._shortKeyName(key), self._item_hash(key))
 *                 elif keys is not None:
 */
        __pyx_t_4 = (__pyx_v_key != ((PyObject *)Py_None));
        if (__pyx_t_4) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2801
 *             if add_name:
 *                 if key is not None:
 *                     return self._reportable_hash(self._shortKeyName(key), self._item_hash(key))             # <<<<<<<<<<<<<<
 *                 elif keys is not None:
 *                     raise TypeError("'add_name=True' not available for set of keys.")
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_shortKeyName(__pyx_v_self, __pyx_v_key)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_item_hash(__pyx_v_self, __pyx_v_key)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_reportable_hash(__pyx_v_self, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L7_try_return;
          goto __pyx_L12;
        }

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2802
 *                 if key is not None:
 *                     return self._reportable_hash(self._shortKeyName(key), self._item_hash(key))
 *                 elif keys is not None:             # <<<<<<<<<<<<<<
 *                     raise TypeError("'add_name=True' not available for set of keys.")
 *                 else:
 */
        __pyx_t_4 = (__pyx_v_keys != Py_None);
        if (__pyx_t_4) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2803
 *                     return self._reportable_hash(self._shortKeyName(key), self._item_hash(key))
 *                 elif keys is not None:
 *                     raise TypeError("'add_name=True' not available for set of keys.")             # <<<<<<<<<<<<<<
 *                 else:
 *                     return self._reportable_hash(self._name, self._self_hash())
 */
          __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_INCREF(((PyObject *)__pyx_kp_s_57));
          PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_57));
          __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_57));
          __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_Raise(__pyx_t_2, 0, 0);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          goto __pyx_L12;
        }
        /*else*/ {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2805
 *                     raise TypeError("'add_name=True' not available for set of keys.")
 *                 else:
 *                     return self._reportable_hash(self._name, self._self_hash())             # <<<<<<<<<<<<<<
 *             else:
 *                 if key is not None:
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_self_hash(__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_reportable_hash(__pyx_v_self, __pyx_v_self->_name, ((PyObject *)__pyx_t_2))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L7_try_return;
        }
        __pyx_L12:;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2807
 *                     return self._reportable_hash(self._name, self._self_hash())
 *             else:
 *                 if key is not None:             # <<<<<<<<<<<<<<
 *                     return self._item_hash(key)
 *                 elif keys is not None:
 */
        __pyx_t_4 = (__pyx_v_key != ((PyObject *)Py_None));
        if (__pyx_t_4) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2808
 *             else:
 *                 if key is not None:
 *                     return self._item_hash(key)             # <<<<<<<<<<<<<<
 *                 elif keys is not None:
 *                     key_set = keys if type(keys) is set else set(keys)
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_item_hash(__pyx_v_self, __pyx_v_key)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2808; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L7_try_return;
          goto __pyx_L13;
        }

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2809
 *                 if key is not None:
 *                     return self._item_hash(key)
 *                 elif keys is not None:             # <<<<<<<<<<<<<<
 *                     key_set = keys if type(keys) is set else set(keys)
 * 
 */
        __pyx_t_4 = (__pyx_v_keys != Py_None);
        if (__pyx_t_4) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2810
 *                     return self._item_hash(key)
 *                 elif keys is not None:
 *                     key_set = keys if type(keys) is set else set(keys)             # <<<<<<<<<<<<<<
 * 
 *                     if len(<set>key_set) == self._size(True, i_BranchMode_None):
 */
          __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_keys)) == ((PyObject *)((PyObject*)&PySet_Type)));
          if (__pyx_t_4) {
            __Pyx_INCREF(__pyx_v_keys);
            __pyx_t_3 = __pyx_v_keys;
          } else {
            __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2810; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_INCREF(__pyx_v_keys);
            PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_keys);
            __Pyx_GIVEREF(__pyx_v_keys);
            __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PySet_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2810; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __pyx_t_3 = __pyx_t_1;
            __pyx_t_1 = 0;
          }
          __Pyx_DECREF(__pyx_v_key_set);
          __pyx_v_key_set = __pyx_t_3;
          __pyx_t_3 = 0;

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2812
 *                     key_set = keys if type(keys) is set else set(keys)
 * 
 *                     if len(<set>key_set) == self._size(True, i_BranchMode_None):             # <<<<<<<<<<<<<<
 *                         return self._self_hash()
 *                     else:
 */
          if (unlikely(((PyObject *)__pyx_v_key_set) == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2812; __pyx_clineno = __LINE__; goto __pyx_L3_error;} 
          }
          __pyx_t_5 = PySet_Size(((PyObject *)((PyObject *)__pyx_v_key_set))); 
          __pyx_t_4 = (__pyx_t_5 == ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_size(__pyx_v_self, 1, 2));
          if (__pyx_t_4) {

            /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2813
 * 
 *                     if len(<set>key_set) == self._size(True, i_BranchMode_None):
 *                         return self._self_hash()             # <<<<<<<<<<<<<<
 *                     else:
 *                         return self._item_set_hash(<set>key_set)
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_self_hash(__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_r = __pyx_t_3;
            __pyx_t_3 = 0;
            goto __pyx_L7_try_return;
            goto __pyx_L14;
          }
          /*else*/ {

            /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2815
 *                         return self._self_hash()
 *                     else:
 *                         return self._item_set_hash(<set>key_set)             # <<<<<<<<<<<<<<
 *                 else:
 *                     return self._self_hash()
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_item_set_hash(__pyx_v_self, ((PyObject *)__pyx_v_key_set))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_r = __pyx_t_3;
            __pyx_t_3 = 0;
            goto __pyx_L7_try_return;
          }
          __pyx_L14:;
          goto __pyx_L13;
        }
        /*else*/ {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2817
 *                         return self._item_set_hash(<set>key_set)
 *                 else:
 *                     return self._self_hash()             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_self_hash(__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L7_try_return;
        }
        __pyx_L13:;
      }
      __pyx_L11:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L10_try_end;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2818
 *                 else:
 *                     return self._self_hash()
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.hash");
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2818; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_1;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2819
 *                     return self._self_hash()
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     cdef str _reportable_hash(self, str key, str digest):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2819; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L10_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.hash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_key_set);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2741
 *     # Hashes that handle mutability, for things like database lookups, etc.
 * 
 *     cpdef hash(self, str key=None, bint add_name = False, keys=None):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a hash of the current tree / branch and all
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_hash(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_hash[] = "\n        Returns a hash of the current tree / branch and all\n        sub-branches.  The hash is based on an md5 hash, and can be\n        used as a unique identifier for the tree and its values.\n\n        If `key` is given, the hash of the branch/value `key` is\n        returned.\n\n        If `add_name` is True, then the name of the local tree is\n        included in the hash.  That is, two branches have the same\n        hash only if they also have the same name, otherwise this is\n        dropped.\n\n        If `keys` is given, it must be an iterable returning keys, and\n        the hash is taken only over these keys.\n\n        One usecase for this method is for caching values; if the\n        input parameters for a calculation are all contained in a\n        TreeDict, then the results can be cached by the hash of that\n        paramtree to avoid repeating calculations.\n        \n        Unrecognized value types are first pickled, and then the hash\n        is taken over the pickled string.  If this value is immutable,\n        this hash is cached for future reference.\n\n        Hashes have the following properties:\n\n        - Hashes of frozen trees and hashes of unfrozen trees are\n          equal, i.e. the frozenness is not considered in the hash.\n          \n        - The hash of a tree with separate, non-branch TreeDict\n          instances in the tree will be different from the hash of a\n          similar tree with the TreeDicts set as branches.\n\n\n        Example::\n        \n            >>> from treedict import TreeDict\n            >>> t = TreeDict()\n            >>> t.set('br.x', 1, 'br.c.y', 2, x = 1, y = 2)\n            >>> t.hash()\n            'ypXSDHXSEg'\n            >>> t.hash('br')\n            '8uMbRZ88dg'\n            >>> t.br.hash()\n            '8uMbRZ88dg'\n            >>> t.br.hash(add_name = True)\n            'br-8uMbRZ88dg'\n            >>> t.hash('x')\n            'xMpCOKC5I4'\n            >>> t.hash(keys = ['x', 'y'])\n    ""        'wgrU12pd1m'\n            >>> t.hash('nothere')\n            KeyError: 'root.nothere'\n            \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_hash(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  int __pyx_v_add_name;
  PyObject *__pyx_v_keys = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8treedict_8treedict_8TreeDict_hash __pyx_t_2;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__add_name,&__pyx_n_s__keys,0};
  __Pyx_RefNannySetupContext("hash");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__add_name);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__keys);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "hash") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2741; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = ((PyObject *)values[0]);
    if (values[1]) {
      __pyx_v_add_name = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_add_name == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2741; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_add_name = ((int)0);
    }
    __pyx_v_keys = values[2];
  } else {
    __pyx_v_key = ((PyObject *)Py_None);
    __pyx_v_add_name = ((int)0);
    __pyx_v_keys = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_keys = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_add_name = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_add_name == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2741; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_key = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hash", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2741; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.hash");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), &PyString_Type, 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.key = __pyx_v_key;
  __pyx_t_2.add_name = __pyx_v_add_name;
  __pyx_t_2.keys = __pyx_v_keys;
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->hash(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.hash");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2821
 *             raise e
 * 
 *     cdef str _reportable_hash(self, str key, str digest):             # <<<<<<<<<<<<<<
 *         return key + "-" + digest
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__reportable_hash(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_digest) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_reportable_hash");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2822
 * 
 *     cdef str _reportable_hash(self, str key, str digest):
 *         return key + "-" + digest             # <<<<<<<<<<<<<<
 * 
 *     cdef str _encode_hash(self, str s):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_key), ((PyObject *)__pyx_kp_s_58)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_v_digest)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._reportable_hash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2824
 *         return key + "-" + digest
 * 
 *     cdef str _encode_hash(self, str s):             # <<<<<<<<<<<<<<
 *         return (b64encode(s).replace('=', '').replace('+', '').replace('/',''))[:10]
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__encode_hash(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_encode_hash");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2825
 * 
 *     cdef str _encode_hash(self, str s):
 *         return (b64encode(s).replace('=', '').replace('+', '').replace('/',''))[:10]             # <<<<<<<<<<<<<<
 * 
 *     # Hash for a list of keys
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_s));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_s));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_s));
  __pyx_t_2 = PyObject_Call(__pyx_v_8treedict_8treedict_b64encode, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__replace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_59));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_59));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_59));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_kp_s_41));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__replace); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __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(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_60));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_kp_s_41));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
  __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__replace); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_61));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_61));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_61));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_kp_s_41));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
  __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PySequence_GetSlice(__pyx_t_2, 0, 10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._encode_hash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2828
 * 
 *     # Hash for a list of keys
 *     cdef str _item_set_hash(self, set keys):             # <<<<<<<<<<<<<<
 *         cdef str key
 *         cdef _PTreeNode pn
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__item_set_hash(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_keys) {
  PyObject *__pyx_v_key;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  PyObject *__pyx_v_h;
  PyObject *__pyx_v_hf;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_item_set_hash");
  __pyx_v_key = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_h = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_hf = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2832
 *         cdef _PTreeNode pn
 * 
 *         h = md5()             # <<<<<<<<<<<<<<
 *         hf = getattr(h, 'update')
 * 
 */
  __pyx_t_1 = PyObject_Call(__pyx_v_8treedict_8treedict_md5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_h);
  __pyx_v_h = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2833
 * 
 *         h = md5()
 *         hf = getattr(h, 'update')             # <<<<<<<<<<<<<<
 * 
 *         for key in sorted(keys):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_h, ((PyObject *)__pyx_n_s__update)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_hf);
  __pyx_v_hf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2835
 *         hf = getattr(h, 'update')
 * 
 *         for key in sorted(keys):             # <<<<<<<<<<<<<<
 * 
 *             pn = <_PTreeNode> self._getPTNode(key)
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_keys));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_keys));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_keys));
  __pyx_t_3 = PyObject_Call(__pyx_builtin_sorted, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1);
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_1))) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    } else {
      __pyx_t_3 = PyIter_Next(__pyx_t_1);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (!(likely(PyString_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_key));
    __pyx_v_key = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2837
 *         for key in sorted(keys):
 * 
 *             pn = <_PTreeNode> self._getPTNode(key)             # <<<<<<<<<<<<<<
 *             if pn is None:
 *                 raise KeyError(self._fullNameOf(key))
 */
    __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getPTNode(__pyx_v_self, __pyx_v_key)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_v_pn));
    __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2838
 * 
 *             pn = <_PTreeNode> self._getPTNode(key)
 *             if pn is None:             # <<<<<<<<<<<<<<
 *                 raise KeyError(self._fullNameOf(key))
 * 
 */
    __pyx_t_4 = (((PyObject *)__pyx_v_pn) == Py_None);
    if (__pyx_t_4) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2839
 *             pn = <_PTreeNode> self._getPTNode(key)
 *             if pn is None:
 *                 raise KeyError(self._fullNameOf(key))             # <<<<<<<<<<<<<<
 * 
 *             pn.runFullHash(hf)
 */
      __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_fullNameOf(__pyx_v_self, __pyx_v_key, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2841
 *                 raise KeyError(self._fullNameOf(key))
 * 
 *             pn.runFullHash(hf)             # <<<<<<<<<<<<<<
 * 
 *         return self._encode_hash(h.digest())
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->runFullHash(__pyx_v_pn, __pyx_v_hf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2843
 *             pn.runFullHash(hf)
 * 
 *         return self._encode_hash(h.digest())             # <<<<<<<<<<<<<<
 * 
 *     # Hash for specific item
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_h, __pyx_n_s__digest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_encode_hash(__pyx_v_self, ((PyObject *)__pyx_t_3))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._item_set_hash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_key);
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_DECREF(__pyx_v_h);
  __Pyx_DECREF(__pyx_v_hf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2846
 * 
 *     # Hash for specific item
 *     cdef str _item_hash(self, str key):             # <<<<<<<<<<<<<<
 * 
 *         cdef _PTreeNode pn = <_PTreeNode> self._getPTNode(key)
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__item_hash(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_key) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_item_hash");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2848
 *     cdef str _item_hash(self, str key):
 * 
 *         cdef _PTreeNode pn = <_PTreeNode> self._getPTNode(key)             # <<<<<<<<<<<<<<
 * 
 *         if pn is None:
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getPTNode(__pyx_v_self, __pyx_v_key)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2850
 *         cdef _PTreeNode pn = <_PTreeNode> self._getPTNode(key)
 * 
 *         if pn is None:             # <<<<<<<<<<<<<<
 *             raise KeyError(self._fullNameOf(key))
 * 
 */
  __pyx_t_2 = (((PyObject *)__pyx_v_pn) == Py_None);
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2851
 * 
 *         if pn is None:
 *             raise KeyError(self._fullNameOf(key))             # <<<<<<<<<<<<<<
 * 
 *         return self._encode_hash(pn.fullHash())
 */
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_fullNameOf(__pyx_v_self, __pyx_v_key, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2853
 *             raise KeyError(self._fullNameOf(key))
 * 
 *         return self._encode_hash(pn.fullHash())             # <<<<<<<<<<<<<<
 * 
 *     # Hash for a whole tree
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->fullHash(__pyx_v_pn)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_encode_hash(__pyx_v_self, ((PyObject *)__pyx_t_1))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._item_hash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2856
 * 
 *     # Hash for a whole tree
 *     cdef str _self_hash(self):             # <<<<<<<<<<<<<<
 *         h = md5()
 *         self._runFullHash(getattr(h, 'update'))
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__self_hash(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  PyObject *__pyx_v_h;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_self_hash");
  __pyx_v_h = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2857
 *     # Hash for a whole tree
 *     cdef str _self_hash(self):
 *         h = md5()             # <<<<<<<<<<<<<<
 *         self._runFullHash(getattr(h, 'update'))
 *         return self._encode_hash(h.digest())
 */
  __pyx_t_1 = PyObject_Call(__pyx_v_8treedict_8treedict_md5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_h);
  __pyx_v_h = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2858
 *     cdef str _self_hash(self):
 *         h = md5()
 *         self._runFullHash(getattr(h, 'update'))             # <<<<<<<<<<<<<<
 *         return self._encode_hash(h.digest())
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_h, ((PyObject *)__pyx_n_s__update)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_runFullHash(__pyx_v_self, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2859
 *         h = md5()
 *         self._runFullHash(getattr(h, 'update'))
 *         return self._encode_hash(h.digest())             # <<<<<<<<<<<<<<
 * 
 *     # Hash for a whole tree
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_h, __pyx_n_s__digest); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_encode_hash(__pyx_v_self, ((PyObject *)__pyx_t_1))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._self_hash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2862
 * 
 *     # Hash for a whole tree
 *     cdef str _self_immutable_hash(self):             # <<<<<<<<<<<<<<
 *         h = md5()
 *         self._runImmutableHash(getattr(h, 'update'))
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__self_immutable_hash(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  PyObject *__pyx_v_h;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_self_immutable_hash");
  __pyx_v_h = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2863
 *     # Hash for a whole tree
 *     cdef str _self_immutable_hash(self):
 *         h = md5()             # <<<<<<<<<<<<<<
 *         self._runImmutableHash(getattr(h, 'update'))
 *         return self._encode_hash(h.digest())
 */
  __pyx_t_1 = PyObject_Call(__pyx_v_8treedict_8treedict_md5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_h);
  __pyx_v_h = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2864
 *     cdef str _self_immutable_hash(self):
 *         h = md5()
 *         self._runImmutableHash(getattr(h, 'update'))             # <<<<<<<<<<<<<<
 *         return self._encode_hash(h.digest())
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_h, ((PyObject *)__pyx_n_s__update)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_runImmutableHash(__pyx_v_self, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2865
 *         h = md5()
 *         self._runImmutableHash(getattr(h, 'update'))
 *         return self._encode_hash(h.digest())             # <<<<<<<<<<<<<<
 * 
 *     ##################################################
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_h, __pyx_n_s__digest); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_encode_hash(__pyx_v_self, ((PyObject *)__pyx_t_1))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._self_immutable_hash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2875
 *     # Thus we need to do this sort to ensure proper order.
 * 
 *     cdef _runFullHash(self, hf):             # <<<<<<<<<<<<<<
 * 
 *         # Need to specifically account for the case of recursion
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__runFullHash(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_hf) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  PyObject *__pyx_v_k;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("_runFullHash");
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2879
 *         # Need to specifically account for the case of recursion
 * 
 *         if _flagOn(&self._flags, f_visited_by_hash_function):             # <<<<<<<<<<<<<<
 *             raise RuntimeError("Infinite recusion encountered in hashing.")
 * 
 */
  __pyx_t_1 = __pyx_f_8treedict_8treedict__flagOn((&__pyx_v_self->_flags), 256);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2880
 * 
 *         if _flagOn(&self._flags, f_visited_by_hash_function):
 *             raise RuntimeError("Infinite recusion encountered in hashing.")             # <<<<<<<<<<<<<<
 * 
 *         if self.isDangling():
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_62));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_62));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_62));
    __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2882
 *             raise RuntimeError("Infinite recusion encountered in hashing.")
 * 
 *         if self.isDangling():             # <<<<<<<<<<<<<<
 *             raise TypeError("Dangling nodes not hashable.")
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->isDangling(__pyx_v_self, 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2883
 * 
 *         if self.isDangling():
 *             raise TypeError("Dangling nodes not hashable.")             # <<<<<<<<<<<<<<
 * 
 *         # This takes care of all the mutable items
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_63));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_63));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_63));
    __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2888
 *         cdef _PTreeNode pn
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             _setFlagOn(&self._flags, f_visited_by_hash_function)
 * 
 */
  /*try:*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2889
 * 
 *         try:
 *             _setFlagOn(&self._flags, f_visited_by_hash_function)             # <<<<<<<<<<<<<<
 * 
 *             hf(self._getImmutableItemsHash())
 */
    __pyx_f_8treedict_8treedict__setFlagOn((&__pyx_v_self->_flags), 256);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2891
 *             _setFlagOn(&self._flags, f_visited_by_hash_function)
 * 
 *             hf(self._getImmutableItemsHash())             # <<<<<<<<<<<<<<
 * 
 *             for k, pn in sorted(self._param_dict.iteritems()):
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getImmutableItemsHash(__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2891; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2891; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __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 = PyObject_Call(__pyx_v_hf, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2891; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2893
 *             hf(self._getImmutableItemsHash())
 * 
 *             for k, pn in sorted(self._param_dict.iteritems()):             # <<<<<<<<<<<<<<
 *                 if not pn.isImmutable() and not pn.isDanglingTree():
 *                     self._update_hash_with_key(hf, k)
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self->_param_dict), __pyx_n_s__iteritems); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_sorted, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2);
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
      } else {
        __pyx_t_3 = PyIter_Next(__pyx_t_2);
        if (!__pyx_t_3) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L6;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
        PyObject* tuple = __pyx_t_3;
        __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
        if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_8treedict_8treedict__PTreeNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_v_k);
        __pyx_v_k = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_v_pn));
        __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_6);
        __pyx_t_6 = 0;
      } else {
        __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_GOTREF(__pyx_t_6);
        if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_8treedict_8treedict__PTreeNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L6;}
        if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_v_k);
        __pyx_v_k = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_v_pn));
        __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_6);
        __pyx_t_6 = 0;
      }

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2894
 * 
 *             for k, pn in sorted(self._param_dict.iteritems()):
 *                 if not pn.isImmutable() and not pn.isDanglingTree():             # <<<<<<<<<<<<<<
 *                     self._update_hash_with_key(hf, k)
 *                     self._update_hash_with_context(hf, pn)
 */
      __pyx_t_1 = (!((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isImmutable(__pyx_v_pn));
      if (__pyx_t_1) {
        __pyx_t_8 = (!((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isDanglingTree(__pyx_v_pn));
        __pyx_t_9 = __pyx_t_8;
      } else {
        __pyx_t_9 = __pyx_t_1;
      }
      if (__pyx_t_9) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2895
 *             for k, pn in sorted(self._param_dict.iteritems()):
 *                 if not pn.isImmutable() and not pn.isDanglingTree():
 *                     self._update_hash_with_key(hf, k)             # <<<<<<<<<<<<<<
 *                     self._update_hash_with_context(hf, pn)
 *                     pn.runFullHash(hf)
 */
        if (!(likely(PyString_CheckExact(__pyx_v_k))||((__pyx_v_k) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_k)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_update_hash_with_key(__pyx_v_self, __pyx_v_hf, ((PyObject *)__pyx_v_k)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2896
 *                 if not pn.isImmutable() and not pn.isDanglingTree():
 *                     self._update_hash_with_key(hf, k)
 *                     self._update_hash_with_context(hf, pn)             # <<<<<<<<<<<<<<
 *                     pn.runFullHash(hf)
 * 
 */
        __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_update_hash_with_context(__pyx_v_self, __pyx_v_hf, __pyx_v_pn); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2896; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2897
 *                     self._update_hash_with_key(hf, k)
 *                     self._update_hash_with_context(hf, pn)
 *                     pn.runFullHash(hf)             # <<<<<<<<<<<<<<
 * 
 *         finally:
 */
        __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->runFullHash(__pyx_v_pn, __pyx_v_hf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L10;
      }
      __pyx_L10:;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2900
 * 
 *         finally:
 *             _setFlagOff(&self._flags, f_visited_by_hash_function)             # <<<<<<<<<<<<<<
 * 
 *     cdef _runImmutableHash(self, hf):
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L7;
    __pyx_L6: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L7;
    }
    __pyx_L7:;
    __pyx_f_8treedict_8treedict__setFlagOff((&__pyx_v_self->_flags), 256);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._runFullHash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2902
 *             _setFlagOff(&self._flags, f_visited_by_hash_function)
 * 
 *     cdef _runImmutableHash(self, hf):             # <<<<<<<<<<<<<<
 * 
 *         if _flagOn(&self._flags, f_visited_by_im_hash_function):
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__runImmutableHash(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_hf) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  PyObject *__pyx_v_k;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("_runImmutableHash");
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2904
 *     cdef _runImmutableHash(self, hf):
 * 
 *         if _flagOn(&self._flags, f_visited_by_im_hash_function):             # <<<<<<<<<<<<<<
 *             raise RuntimeError("Infinite recusion encountered in hashing.")
 * 
 */
  __pyx_t_1 = __pyx_f_8treedict_8treedict__flagOn((&__pyx_v_self->_flags), 512);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2905
 * 
 *         if _flagOn(&self._flags, f_visited_by_im_hash_function):
 *             raise RuntimeError("Infinite recusion encountered in hashing.")             # <<<<<<<<<<<<<<
 * 
 *         if self.isDangling():
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_62));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_62));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_62));
    __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2905; __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);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2907
 *             raise RuntimeError("Infinite recusion encountered in hashing.")
 * 
 *         if self.isDangling():             # <<<<<<<<<<<<<<
 *             raise TypeError("Dangling nodes not hashable.")
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->isDangling(__pyx_v_self, 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2908
 * 
 *         if self.isDangling():
 *             raise TypeError("Dangling nodes not hashable.")             # <<<<<<<<<<<<<<
 * 
 *         cdef TreeDict b
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_63));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_63));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_63));
    __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2913
 *         cdef _PTreeNode pn
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             _setFlagOn(&self._flags, f_visited_by_im_hash_function)
 * 
 */
  /*try:*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2914
 * 
 *         try:
 *             _setFlagOn(&self._flags, f_visited_by_im_hash_function)             # <<<<<<<<<<<<<<
 * 
 *             # This takes care of all the immutable local values
 */
    __pyx_f_8treedict_8treedict__setFlagOn((&__pyx_v_self->_flags), 512);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2917
 * 
 *             # This takes care of all the immutable local values
 *             hf(self._getImmutableItemsHash())             # <<<<<<<<<<<<<<
 * 
 *             for k, pn in sorted(self._param_dict.iteritems()):
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getImmutableItemsHash(__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2917; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2917; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __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 = PyObject_Call(__pyx_v_hf, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2917; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2919
 *             hf(self._getImmutableItemsHash())
 * 
 *             for k, pn in sorted(self._param_dict.iteritems()):             # <<<<<<<<<<<<<<
 *                 if pn.isBranch() and not pn.isDanglingBranch():
 *                     self._update_hash_with_key(hf, k)
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self->_param_dict), __pyx_n_s__iteritems); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_sorted, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L6;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2);
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L6;}
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
      } else {
        __pyx_t_3 = PyIter_Next(__pyx_t_2);
        if (!__pyx_t_3) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L6;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
        PyObject* tuple = __pyx_t_3;
        __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
        if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_8treedict_8treedict__PTreeNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_v_k);
        __pyx_v_k = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_v_pn));
        __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_6);
        __pyx_t_6 = 0;
      } else {
        __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_GOTREF(__pyx_t_6);
        if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_8treedict_8treedict__PTreeNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L6;}
        if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_v_k);
        __pyx_v_k = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_v_pn));
        __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_6);
        __pyx_t_6 = 0;
      }

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2920
 * 
 *             for k, pn in sorted(self._param_dict.iteritems()):
 *                 if pn.isBranch() and not pn.isDanglingBranch():             # <<<<<<<<<<<<<<
 *                     self._update_hash_with_key(hf, k)
 *                     self._update_hash_with_context(hf, pn)
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isBranch(__pyx_v_pn);
      if (__pyx_t_1) {
        __pyx_t_8 = (!((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isDanglingBranch(__pyx_v_pn));
        __pyx_t_9 = __pyx_t_8;
      } else {
        __pyx_t_9 = __pyx_t_1;
      }
      if (__pyx_t_9) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2921
 *             for k, pn in sorted(self._param_dict.iteritems()):
 *                 if pn.isBranch() and not pn.isDanglingBranch():
 *                     self._update_hash_with_key(hf, k)             # <<<<<<<<<<<<<<
 *                     self._update_hash_with_context(hf, pn)
 *                     pn.runImmutableHash(hf)
 */
        if (!(likely(PyString_CheckExact(__pyx_v_k))||((__pyx_v_k) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_k)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2921; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_update_hash_with_key(__pyx_v_self, __pyx_v_hf, ((PyObject *)__pyx_v_k)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2921; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2922
 *                 if pn.isBranch() and not pn.isDanglingBranch():
 *                     self._update_hash_with_key(hf, k)
 *                     self._update_hash_with_context(hf, pn)             # <<<<<<<<<<<<<<
 *                     pn.runImmutableHash(hf)
 *         finally:
 */
        __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_update_hash_with_context(__pyx_v_self, __pyx_v_hf, __pyx_v_pn); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2922; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2923
 *                     self._update_hash_with_key(hf, k)
 *                     self._update_hash_with_context(hf, pn)
 *                     pn.runImmutableHash(hf)             # <<<<<<<<<<<<<<
 *         finally:
 *             _setFlagOff(&self._flags, f_visited_by_im_hash_function)
 */
        __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->runImmutableHash(__pyx_v_pn, __pyx_v_hf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2923; __pyx_clineno = __LINE__; goto __pyx_L6;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L10;
      }
      __pyx_L10:;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2925
 *                     pn.runImmutableHash(hf)
 *         finally:
 *             _setFlagOff(&self._flags, f_visited_by_im_hash_function)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L7;
    __pyx_L6: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L7;
    }
    __pyx_L7:;
    __pyx_f_8treedict_8treedict__setFlagOff((&__pyx_v_self->_flags), 512);
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._runImmutableHash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2929
 * 
 *     # Now going back on the immutable hash cases
 *     cdef str _getImmutableItemsHash(self):             # <<<<<<<<<<<<<<
 *         cdef _PTreeNode pn
 *         cdef str hs
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__getImmutableItemsHash(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  PyObject *__pyx_v_hs;
  PyObject *__pyx_v_h;
  PyObject *__pyx_v_hf;
  PyObject *__pyx_v_k;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_getImmutableItemsHash");
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_hs = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_h = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_hf = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2933
 *         cdef str hs
 * 
 *         if self.isDangling():             # <<<<<<<<<<<<<<
 *             raise TypeError("Dangling nodes not hashable.")
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->isDangling(__pyx_v_self, 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2934
 * 
 *         if self.isDangling():
 *             raise TypeError("Dangling nodes not hashable.")             # <<<<<<<<<<<<<<
 * 
 *         if s_immutable_items_hash not in self._aux_dict:
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_63));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_63));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_63));
    __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2934; __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);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2936
 *             raise TypeError("Dangling nodes not hashable.")
 * 
 *         if s_immutable_items_hash not in self._aux_dict:             # <<<<<<<<<<<<<<
 *             h = md5()
 *             hf = getattr(h, 'update')
 */
  if (unlikely(((PyObject *)__pyx_v_self->_aux_dict) == Py_None)) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else {
    __pyx_t_1 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_immutable_items_hash)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2937
 * 
 *         if s_immutable_items_hash not in self._aux_dict:
 *             h = md5()             # <<<<<<<<<<<<<<
 *             hf = getattr(h, 'update')
 * 
 */
    __pyx_t_3 = PyObject_Call(__pyx_v_8treedict_8treedict_md5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_h);
    __pyx_v_h = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2938
 *         if s_immutable_items_hash not in self._aux_dict:
 *             h = md5()
 *             hf = getattr(h, 'update')             # <<<<<<<<<<<<<<
 * 
 *             for k, pn in sorted(self._param_dict.iteritems()):
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_h, ((PyObject *)__pyx_n_s__update)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_hf);
    __pyx_v_hf = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2940
 *             hf = getattr(h, 'update')
 * 
 *             for k, pn in sorted(self._param_dict.iteritems()):             # <<<<<<<<<<<<<<
 *                 if pn.isImmutable():
 *                     self._update_hash_with_key(hf, k)
 */
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self->_param_dict), __pyx_n_s__iteritems); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __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 = 2940; __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 = PyObject_Call(__pyx_builtin_sorted, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_4 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
      } else {
        __pyx_t_2 = PyIter_Next(__pyx_t_3);
        if (!__pyx_t_2) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
        PyObject* tuple = __pyx_t_2;
        __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
        if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_8treedict_8treedict__PTreeNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_v_k);
        __pyx_v_k = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_v_pn));
        __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_6);
        __pyx_t_6 = 0;
      } else {
        __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_8treedict_8treedict__PTreeNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_v_k);
        __pyx_v_k = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_v_pn));
        __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_6);
        __pyx_t_6 = 0;
      }

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2941
 * 
 *             for k, pn in sorted(self._param_dict.iteritems()):
 *                 if pn.isImmutable():             # <<<<<<<<<<<<<<
 *                     self._update_hash_with_key(hf, k)
 *                     self._update_hash_with_context(hf, pn)
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isImmutable(__pyx_v_pn);
      if (__pyx_t_1) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2942
 *             for k, pn in sorted(self._param_dict.iteritems()):
 *                 if pn.isImmutable():
 *                     self._update_hash_with_key(hf, k)             # <<<<<<<<<<<<<<
 *                     self._update_hash_with_context(hf, pn)
 *                     pn.runImmutableHash(hf)
 */
        if (!(likely(PyString_CheckExact(__pyx_v_k))||((__pyx_v_k) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_k)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_update_hash_with_key(__pyx_v_self, __pyx_v_hf, ((PyObject *)__pyx_v_k)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2943
 *                 if pn.isImmutable():
 *                     self._update_hash_with_key(hf, k)
 *                     self._update_hash_with_context(hf, pn)             # <<<<<<<<<<<<<<
 *                     pn.runImmutableHash(hf)
 * 
 */
        __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_update_hash_with_context(__pyx_v_self, __pyx_v_hf, __pyx_v_pn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2944
 *                     self._update_hash_with_key(hf, k)
 *                     self._update_hash_with_context(hf, pn)
 *                     pn.runImmutableHash(hf)             # <<<<<<<<<<<<<<
 * 
 *             hs = h.hexdigest()
 */
        __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->runImmutableHash(__pyx_v_pn, __pyx_v_hf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2946
 *                     pn.runImmutableHash(hf)
 * 
 *             hs = h.hexdigest()             # <<<<<<<<<<<<<<
 *             self._aux_dict[s_immutable_items_hash] = hs
 *             return hs
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_h, __pyx_n_s__hexdigest); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_hs));
    __pyx_v_hs = ((PyObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2947
 * 
 *             hs = h.hexdigest()
 *             self._aux_dict[s_immutable_items_hash] = hs             # <<<<<<<<<<<<<<
 *             return hs
 * 
 */
    if (PyDict_SetItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_immutable_items_hash), ((PyObject *)__pyx_v_hs)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2948
 *             hs = h.hexdigest()
 *             self._aux_dict[s_immutable_items_hash] = hs
 *             return hs             # <<<<<<<<<<<<<<
 * 
 *         return <str>self._aux_dict[s_immutable_items_hash]
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_hs));
    __pyx_r = __pyx_v_hs;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2950
 *             return hs
 * 
 *         return <str>self._aux_dict[s_immutable_items_hash]             # <<<<<<<<<<<<<<
 * 
 *     cdef _update_hash_with_key(self, hf, str key):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_immutable_items_hash)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_t_2)));
  __pyx_r = ((PyObject *)__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._getImmutableItemsHash");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_DECREF(__pyx_v_hs);
  __Pyx_DECREF(__pyx_v_h);
  __Pyx_DECREF(__pyx_v_hf);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2952
 *         return <str>self._aux_dict[s_immutable_items_hash]
 * 
 *     cdef _update_hash_with_key(self, hf, str key):             # <<<<<<<<<<<<<<
 *         hf("$S$")
 *         hf(key)
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__update_hash_with_key(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_hf, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_update_hash_with_key");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2953
 * 
 *     cdef _update_hash_with_key(self, hf, str key):
 *         hf("$S$")             # <<<<<<<<<<<<<<
 *         hf(key)
 *         hf("$E$")
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_66));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_66));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_66));
  __pyx_t_2 = PyObject_Call(__pyx_v_hf, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2954
 *     cdef _update_hash_with_key(self, hf, str key):
 *         hf("$S$")
 *         hf(key)             # <<<<<<<<<<<<<<
 *         hf("$E$")
 * 
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_key));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_key));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_key));
  __pyx_t_1 = PyObject_Call(__pyx_v_hf, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2955
 *         hf("$S$")
 *         hf(key)
 *         hf("$E$")             # <<<<<<<<<<<<<<
 * 
 *     cdef _update_hash_with_context(self, hf, _PTreeNode pn):
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_67));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_67));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_67));
  __pyx_t_2 = PyObject_Call(__pyx_v_hf, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._update_hash_with_key");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2957
 *         hf("$E$")
 * 
 *     cdef _update_hash_with_context(self, hf, _PTreeNode pn):             # <<<<<<<<<<<<<<
 *         # Any context-based information
 *         if pn.isBranch():
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__update_hash_with_context(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_hf, struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_update_hash_with_context");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2959
 *     cdef _update_hash_with_context(self, hf, _PTreeNode pn):
 *         # Any context-based information
 *         if pn.isBranch():             # <<<<<<<<<<<<<<
 *             hf("$BRANCH$")
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isBranch(__pyx_v_pn);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2960
 *         # Any context-based information
 *         if pn.isBranch():
 *             hf("$BRANCH$")             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_68));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_68));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_68));
    __pyx_t_3 = PyObject_Call(__pyx_v_hf, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._update_hash_with_context");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2966
 *     # All functions dealing with caching, tracking, etc.
 * 
 *     cdef void _keyDeleted(self, str key, _PTreeNode pn):             # <<<<<<<<<<<<<<
 *         cdef size_t i
 * 
 */

static  void __pyx_f_8treedict_8treedict_8TreeDict__keyDeleted(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn) {
  size_t __pyx_v_i;
  PyObject *__pyx_v_v;
  PyObject *__pyx_v_b;
  PyObject *__pyx_v_l;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_t_wr;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_t_pn;
  PyObject *__pyx_v_tree_wr;
  PyObject *__pyx_v_key_name;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("_keyDeleted");
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_b = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_l = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_t_wr = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_t_pn = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_tree_wr = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_key_name = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2969
 *         cdef size_t i
 * 
 *         if pn.isMutable():             # <<<<<<<<<<<<<<
 *             self._n_mutable -= 1
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isMutable(__pyx_v_pn);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2970
 * 
 *         if pn.isMutable():
 *             self._n_mutable -= 1             # <<<<<<<<<<<<<<
 * 
 *             if RUN_ASSERTS:
 */
    __pyx_v_self->_n_mutable -= 1;
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2975
 *                 assert self._n_mutable >= 0
 * 
 *         elif pn.isImmutable():             # <<<<<<<<<<<<<<
 *             self._resetImmutableHashes()
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isImmutable(__pyx_v_pn);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2976
 * 
 *         elif pn.isImmutable():
 *             self._resetImmutableHashes()             # <<<<<<<<<<<<<<
 * 
 *         elif pn.isBranch():
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_resetImmutableHashes(__pyx_v_self);
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2978
 *             self._resetImmutableHashes()
 * 
 *         elif pn.isBranch():             # <<<<<<<<<<<<<<
 *             v = pn.value()
 *             for i, b in enumerate(self._branches):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isBranch(__pyx_v_pn);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2979
 * 
 *         elif pn.isBranch():
 *             v = pn.value()             # <<<<<<<<<<<<<<
 *             for i, b in enumerate(self._branches):
 *                 if b is v:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->value(__pyx_v_pn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_v);
    __pyx_v_v = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2980
 *         elif pn.isBranch():
 *             v = pn.value()
 *             for i, b in enumerate(self._branches):             # <<<<<<<<<<<<<<
 *                 if b is v:
 *                     del self._branches[i]
 */
    __pyx_t_3 = 0;
    if (likely(((PyObject *)__pyx_v_self->_branches) != Py_None)) {
      __pyx_t_4 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_self->_branches); __Pyx_INCREF(__pyx_t_2);
    } else {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    for (;;) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++;
      __Pyx_DECREF(__pyx_v_b);
      __pyx_v_b = __pyx_t_5;
      __pyx_t_5 = 0;
      __pyx_v_i = __pyx_t_3;
      __pyx_t_3 = (__pyx_t_3 + 1);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2981
 *             v = pn.value()
 *             for i, b in enumerate(self._branches):
 *                 if b is v:             # <<<<<<<<<<<<<<
 *                     del self._branches[i]
 *                     break
 */
      __pyx_t_1 = (__pyx_v_b == __pyx_v_v);
      if (__pyx_t_1) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2982
 *             for i, b in enumerate(self._branches):
 *                 if b is v:
 *                     del self._branches[i]             # <<<<<<<<<<<<<<
 *                     break
 * 
 */
        if (__Pyx_DelItemInt(((PyObject *)__pyx_v_self->_branches), __pyx_v_i, sizeof(size_t)+1, __Pyx_PyInt_FromSize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2983
 *                 if b is v:
 *                     del self._branches[i]
 *                     break             # <<<<<<<<<<<<<<
 * 
 *         cdef list l
 */
        goto __pyx_L5_break;
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    __pyx_L5_break:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2988
 *         cdef TreeDict t_wr, t_pn
 * 
 *         if pn.isDanglingTree():             # <<<<<<<<<<<<<<
 * 
 *             # Tricky dangling node stuff; if we delete this dangling
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isDanglingTree(__pyx_v_pn);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2995
 *             # the main anchor to the next place in the queue.
 * 
 *             t_pn = pn.tree()             # <<<<<<<<<<<<<<
 * 
 *             if s_dangling_reference_queue in t_pn._aux_dict:
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_t_pn));
    __pyx_v_t_pn = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2997
 *             t_pn = pn.tree()
 * 
 *             if s_dangling_reference_queue in t_pn._aux_dict:             # <<<<<<<<<<<<<<
 *                 l = <list>(t_pn._aux_dict[s_dangling_reference_queue])
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_t_pn->_aux_dict) == Py_None)) {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {
      __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_t_pn->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_dangling_reference_queue)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2998
 * 
 *             if s_dangling_reference_queue in t_pn._aux_dict:
 *                 l = <list>(t_pn._aux_dict[s_dangling_reference_queue])             # <<<<<<<<<<<<<<
 * 
 *                 while True:
 */
      __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_t_pn->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_dangling_reference_queue)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_t_2)));
      __Pyx_DECREF(((PyObject *)__pyx_v_l));
      __pyx_v_l = ((PyObject *)__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3000
 *                 l = <list>(t_pn._aux_dict[s_dangling_reference_queue])
 * 
 *                 while True:             # <<<<<<<<<<<<<<
 * 
 *                     if len(l) == 0:
 */
      while (1) {
        if (!1) break;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3002
 *                 while True:
 * 
 *                     if len(l) == 0:             # <<<<<<<<<<<<<<
 *                         del t_pn._aux_dict[s_dangling_reference_queue]
 *                         break
 */
        if (unlikely(__pyx_v_l == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
        }
        __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_l)); 
        __pyx_t_1 = (__pyx_t_4 == 0);
        if (__pyx_t_1) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3003
 * 
 *                     if len(l) == 0:
 *                         del t_pn._aux_dict[s_dangling_reference_queue]             # <<<<<<<<<<<<<<
 *                         break
 * 
 */
          if (PyDict_DelItem(((PyObject *)__pyx_v_t_pn->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_dangling_reference_queue)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3004
 *                     if len(l) == 0:
 *                         del t_pn._aux_dict[s_dangling_reference_queue]
 *                         break             # <<<<<<<<<<<<<<
 * 
 *                     tree_wr, key_name = l.pop(0)
 */
          goto __pyx_L10_break;
          goto __pyx_L11;
        }
        __pyx_L11:;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3006
 *                         break
 * 
 *                     tree_wr, key_name = l.pop(0)             # <<<<<<<<<<<<<<
 * 
 *                     t_wr = tree_wr()
 */
        __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_l), __pyx_n_s__pop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3006; __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 = 3006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_int_0);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        __pyx_t_6 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (PyTuple_CheckExact(__pyx_t_6) && likely(PyTuple_GET_SIZE(__pyx_t_6) == 2)) {
          PyObject* tuple = __pyx_t_6;
          __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
          __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_v_tree_wr);
          __pyx_v_tree_wr = __pyx_t_5;
          __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_v_key_name);
          __pyx_v_key_name = __pyx_t_2;
          __pyx_t_2 = 0;
        } else {
          __pyx_t_7 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_v_tree_wr);
          __pyx_v_tree_wr = __pyx_t_5;
          __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_v_key_name);
          __pyx_v_key_name = __pyx_t_2;
          __pyx_t_2 = 0;
        }

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3008
 *                     tree_wr, key_name = l.pop(0)
 * 
 *                     t_wr = tree_wr()             # <<<<<<<<<<<<<<
 * 
 *                     if t_wr != None and (<TreeDict>t_wr)._getLocalPTNode(key_name).value() is t_pn:
 */
        __pyx_t_6 = PyObject_Call(__pyx_v_tree_wr, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_8treedict_8treedict_TreeDict))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(((PyObject *)__pyx_v_t_wr));
        __pyx_v_t_wr = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_6);
        __pyx_t_6 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3010
 *                     t_wr = tree_wr()
 * 
 *                     if t_wr != None and (<TreeDict>t_wr)._getLocalPTNode(key_name).value() is t_pn:             # <<<<<<<<<<<<<<
 *                         t_pn._name = key_name
 *                         t_pn._parent = t_wr
 */
        __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_v_t_wr), Py_None, Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (__pyx_t_1) {
          if (!(likely(PyString_CheckExact(__pyx_v_key_name))||((__pyx_v_key_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_key_name)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_t_wr)->__pyx_vtab)->_getLocalPTNode(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_t_wr), ((PyObject *)__pyx_v_key_name))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_6)->__pyx_vtab)->value(((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_8 = (__pyx_t_2 == ((PyObject *)__pyx_v_t_pn));
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_9 = __pyx_t_8;
        } else {
          __pyx_t_9 = __pyx_t_1;
        }
        if (__pyx_t_9) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3011
 * 
 *                     if t_wr != None and (<TreeDict>t_wr)._getLocalPTNode(key_name).value() is t_pn:
 *                         t_pn._name = key_name             # <<<<<<<<<<<<<<
 *                         t_pn._parent = t_wr
 *                         break
 */
          if (!(likely(PyString_CheckExact(__pyx_v_key_name))||((__pyx_v_key_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_key_name)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_INCREF(__pyx_v_key_name);
          __Pyx_GIVEREF(__pyx_v_key_name);
          __Pyx_GOTREF(__pyx_v_t_pn->_name);
          __Pyx_DECREF(((PyObject *)__pyx_v_t_pn->_name));
          __pyx_v_t_pn->_name = ((PyObject *)__pyx_v_key_name);

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3012
 *                     if t_wr != None and (<TreeDict>t_wr)._getLocalPTNode(key_name).value() is t_pn:
 *                         t_pn._name = key_name
 *                         t_pn._parent = t_wr             # <<<<<<<<<<<<<<
 *                         break
 * 
 */
          __Pyx_INCREF(((PyObject *)__pyx_v_t_wr));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_t_wr));
          __Pyx_GOTREF(__pyx_v_t_pn->_parent);
          __Pyx_DECREF(((PyObject *)__pyx_v_t_pn->_parent));
          __pyx_v_t_pn->_parent = __pyx_v_t_wr;

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3013
 *                         t_pn._name = key_name
 *                         t_pn._parent = t_wr
 *                         break             # <<<<<<<<<<<<<<
 * 
 *             self._n_dangling -= 1
 */
          goto __pyx_L10_break;
          goto __pyx_L12;
        }
        __pyx_L12:;
      }
      __pyx_L10_break:;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3015
 *                         break
 * 
 *             self._n_dangling -= 1             # <<<<<<<<<<<<<<
 * 
 *     cdef _keyInserted(self, str key, _PTreeNode pn):
 */
    __pyx_v_self->_n_dangling -= 1;
    goto __pyx_L7;
  }
  __pyx_L7:;

  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_WriteUnraisable("treedict.treedict.TreeDict._keyDeleted");
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_DECREF(__pyx_v_b);
  __Pyx_DECREF(__pyx_v_l);
  __Pyx_DECREF((PyObject *)__pyx_v_t_wr);
  __Pyx_DECREF((PyObject *)__pyx_v_t_pn);
  __Pyx_DECREF(__pyx_v_tree_wr);
  __Pyx_DECREF(__pyx_v_key_name);
  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3017
 *             self._n_dangling -= 1
 * 
 *     cdef _keyInserted(self, str key, _PTreeNode pn):             # <<<<<<<<<<<<<<
 *         cdef TreeDict p
 * 
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__keyInserted(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_keyInserted");
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3020
 *         cdef TreeDict p
 * 
 *         if pn.isMutable():             # <<<<<<<<<<<<<<
 *             self._n_mutable += 1
 *         elif pn.isImmutable():
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isMutable(__pyx_v_pn);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3021
 * 
 *         if pn.isMutable():
 *             self._n_mutable += 1             # <<<<<<<<<<<<<<
 *         elif pn.isImmutable():
 *             self._resetImmutableHashes()
 */
    __pyx_v_self->_n_mutable += 1;
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3022
 *         if pn.isMutable():
 *             self._n_mutable += 1
 *         elif pn.isImmutable():             # <<<<<<<<<<<<<<
 *             self._resetImmutableHashes()
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isImmutable(__pyx_v_pn);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3023
 *             self._n_mutable += 1
 *         elif pn.isImmutable():
 *             self._resetImmutableHashes()             # <<<<<<<<<<<<<<
 * 
 *         # Now if we are a dangling node, inserting a key turns us into
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_resetImmutableHashes(__pyx_v_self);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3027
 *         # Now if we are a dangling node, inserting a key turns us into
 *         # a non-dangling node...
 *         if pn.isDanglingTree():             # <<<<<<<<<<<<<<
 *             self._n_dangling += 1
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isDanglingTree(__pyx_v_pn);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3028
 *         # a non-dangling node...
 *         if pn.isDanglingTree():
 *             self._n_dangling += 1             # <<<<<<<<<<<<<<
 * 
 *             if not pn.isDanglingBranch():
 */
    __pyx_v_self->_n_dangling += 1;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3030
 *             self._n_dangling += 1
 * 
 *             if not pn.isDanglingBranch():             # <<<<<<<<<<<<<<
 *                 p = pn.tree()
 * 
 */
    __pyx_t_1 = (!((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isDanglingBranch(__pyx_v_pn));
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3031
 * 
 *             if not pn.isDanglingBranch():
 *                 p = pn.tree()             # <<<<<<<<<<<<<<
 * 
 *                 if s_dangling_reference_queue in p._aux_dict:
 */
      __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_v_p));
      __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3033
 *                 p = pn.tree()
 * 
 *                 if s_dangling_reference_queue in p._aux_dict:             # <<<<<<<<<<<<<<
 *                     (<list> (p._aux_dict[s_dangling_reference_queue])).append( (new_weakref(self, None), key) )
 *                 else:
 */
      if (unlikely(((PyObject *)__pyx_v_p->_aux_dict) == Py_None)) {
        __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      } else {
        __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_p->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_dangling_reference_queue)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      if (__pyx_t_1) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3034
 * 
 *                 if s_dangling_reference_queue in p._aux_dict:
 *                     (<list> (p._aux_dict[s_dangling_reference_queue])).append( (new_weakref(self, None), key) )             # <<<<<<<<<<<<<<
 *                 else:
 *                     p._aux_dict[s_dangling_reference_queue] = [(new_weakref(self, None), key)]
 */
        __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_p->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_dangling_reference_queue)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        if (unlikely(((PyObject *)__pyx_t_2) == Py_None)) {
          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
        }
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_v_self));
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
        __Pyx_INCREF(Py_None);
        PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None);
        __Pyx_GIVEREF(Py_None);
        __pyx_t_4 = PyObject_Call(__pyx_v_8treedict_8treedict_new_weakref, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __Pyx_INCREF(((PyObject *)__pyx_v_key));
        PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_key));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_key));
        __pyx_t_4 = 0;
        __pyx_t_5 = PyList_Append(((PyObject *)((PyObject *)__pyx_t_2)), __pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L6;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3036
 *                     (<list> (p._aux_dict[s_dangling_reference_queue])).append( (new_weakref(self, None), key) )
 *                 else:
 *                     p._aux_dict[s_dangling_reference_queue] = [(new_weakref(self, None), key)]             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_v_self));
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
        __Pyx_INCREF(Py_None);
        PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None);
        __Pyx_GIVEREF(Py_None);
        __pyx_t_2 = PyObject_Call(__pyx_v_8treedict_8treedict_new_weakref, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3036; __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(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3036; __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_INCREF(((PyObject *)__pyx_v_key));
        PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_key));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_key));
        __pyx_t_2 = 0;
        __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        if (PyDict_SetItem(((PyObject *)__pyx_v_p->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_dangling_reference_queue), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      }
      __pyx_L6:;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3039
 * 
 *         else:
 *             self._attachDanglingSelf()             # <<<<<<<<<<<<<<
 * 
 *     cdef void _resetImmutableHashes(self):
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_attachDanglingSelf(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._keyInserted");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3041
 *             self._attachDanglingSelf()
 * 
 *     cdef void _resetImmutableHashes(self):             # <<<<<<<<<<<<<<
 *         if s_immutable_items_hash in self._aux_dict:
 *             del self._aux_dict[s_immutable_items_hash]
 */

static  void __pyx_f_8treedict_8treedict_8TreeDict__resetImmutableHashes(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_resetImmutableHashes");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3042
 * 
 *     cdef void _resetImmutableHashes(self):
 *         if s_immutable_items_hash in self._aux_dict:             # <<<<<<<<<<<<<<
 *             del self._aux_dict[s_immutable_items_hash]
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self->_aux_dict) == Py_None)) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else {
    __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_immutable_items_hash)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3043
 *     cdef void _resetImmutableHashes(self):
 *         if s_immutable_items_hash in self._aux_dict:
 *             del self._aux_dict[s_immutable_items_hash]             # <<<<<<<<<<<<<<
 * 
 *     ################################################################################
 */
    if (PyDict_DelItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_immutable_items_hash)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict._resetImmutableHashes");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3047
 *     ################################################################################
 *     # Methods for copying the tree
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         try:
 *             return self._copy(False, False)
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__copy__");
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3048
 *     # Methods for copying the tree
 *     def __copy__(self):
 *         try:             # <<<<<<<<<<<<<<
 *             return self._copy(False, False)
 *         except Exception, e:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3049
 *     def __copy__(self):
 *         try:
 *             return self._copy(False, False)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_copy(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3049; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L9_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L9_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3050
 *         try:
 *             return self._copy(False, False)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.__copy__");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3050; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3051
 *             return self._copy(False, False)
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     def __deepcopy__(self, m={}):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3051; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__copy__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3053
 *             raise e
 * 
 *     def __deepcopy__(self, m={}):             # <<<<<<<<<<<<<<
 *         try:
 *             return self._copy(True, False)
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_m = 0;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__m,0};
  __Pyx_RefNannySetupContext("__deepcopy__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = __pyx_k_70;
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__m);
        if (value) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__deepcopy__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_m = values[0];
  } else {
    __pyx_v_m = __pyx_k_70;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_m = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__deepcopy__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__deepcopy__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3054
 * 
 *     def __deepcopy__(self, m={}):
 *         try:             # <<<<<<<<<<<<<<
 *             return self._copy(True, False)
 *         except Exception, e:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3055
 *     def __deepcopy__(self, m={}):
 *         try:
 *             return self._copy(True, False)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_copy(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3055; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L10_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3056
 *         try:
 *             return self._copy(True, False)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.__deepcopy__");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3056; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3057
 *             return self._copy(True, False)
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     def copy(self, bint deep=False, bint freeze=False):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__deepcopy__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3059
 *             raise e
 * 
 *     def copy(self, bint deep=False, bint freeze=False):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a copy of the current tree.  If `deep` is true, then
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_copy[] = "\n        Returns a copy of the current tree.  If `deep` is true, then\n        all the values in the leaves are also copied, otherwise the\n        entire tree structure is copied but not the values.  If\n        `freeze` is true, then the returned tree is frozen.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_deep;
  int __pyx_v_freeze;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__deep,&__pyx_n_s__freeze,0};
  __Pyx_RefNannySetupContext("copy");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__deep);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__freeze);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "copy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_deep = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_deep == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_deep = ((int)0);
    }
    if (values[1]) {
      __pyx_v_freeze = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_freeze == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_freeze = ((int)0);
    }
  } else {
    __pyx_v_deep = ((int)0);
    __pyx_v_freeze = ((int)0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_freeze = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_freeze == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_deep = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_deep == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.copy");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3067
 *         """
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return self._copy(deep, freeze)
 *         except Exception, e:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3068
 * 
 *         try:
 *             return self._copy(deep, freeze)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_copy(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_deep, __pyx_v_freeze)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3068; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L10_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L10_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3069
 *         try:
 *             return self._copy(deep, freeze)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.copy");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3069; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_3;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3070
 *             return self._copy(deep, freeze)
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     def update(self, source, bint overwrite = True,
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.copy");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3072
 *             raise e
 * 
 *     def update(self, source, bint overwrite = True,             # <<<<<<<<<<<<<<
 *                bint protect_structure = False):
 *         """
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_update[] = "\n        Copies all the branches and values from a source\n        branch/tree/dict `source` into the current branch.  Branch\n        structures are recreated in this node, with the new branches\n        reference this node as their parent.\n\n        If `source` is not of type dict or a TreeDict, it must be\n        convertable to a dictionary; if this fails, a TypeError is\n        raised.\n\n        If `deepcopy` is True, then copies are made of all the values\n        held in the source tree, otherwise, only the tree structure\n        and references to the values are copied (default).\n\n        If `overwrite_existing` is True (default), then conflicting\n        values in the local tree are overwritten by the corresponding\n        values in the source tree.  If `overwrite_existing` is False,\n        all local values already present are preserved.\n\n        If `protect_structure` is False (default = True), then values\n        can be implicitly overwritten by branches.  For example, if `b\n        = 1` is in the tree, then setting `b.x = 2` would overwrite b\n        with an implicitly created branch.  Normally, this operation\n        would raise a TypeError (for consistency with attribute style\n        setting).\n\n        Note: Unlike the update method of dict, this method may fail\n        and raise an exception.  This can occur either because one or\n        more of the keys in `d` is not a valid key name (only occurs\n        if `d` is a dict), or if all/part of the tree being updated is\n        frozen.  If this happens, no changes are made to the tree\n        (i.e, this method is atomic).\n\n        Example 1::\n\n            >>> from treedict import TreeDict\n            >>> t = TreeDict()\n            >>> t.a.x = 1\n            >>> t.update({'a.y': 2, 'z' : 3})\n            >>> print t.makeReport()\n            a.x = 1\n            a.y = 2\n            z   = 3\n            >>> \n\n        Example 2::\n\n            >>> from treedict import Tree""Dict\n            >>> t1 = TreeDict(x = 1, y = 2)\n            >>> t2 = TreeDict(y = 3, z = 4)\n            >>> t1.update(t2)\n            >>> print t1.makeReport()\n            y = 3\n            x = 1\n            z = 4\n            >>> \n\n        Example 3 -- No Overwrite::\n\n            >>> from treedict import TreeDict\n            >>> t1 = TreeDict(x = 1, y = 2)\n            >>> t2 = TreeDict(y = 3, z = 4)\n            >>> t1.update(t2, overwrite=False)\n            >>> print t1.makeReport()\n            y = 2\n            x = 1\n            z = 4\n\n        Example 4 -- Protecting Structure::\n\n            >>> t1, t2 = TreeDict('t1'), TreeDict('t2')\n            >>> t1.a.x = 1\n            >>> t2.a = 2\n            >>> t2.x = 3\n            >>> \n            >>> print t1.makeReport()\n            a.x = 1\n            >>> \n            >>> t1.update(t2, protect_structure = True)\n\n            TypeError: Tree/Branch 't1.a' would get implicitly overwritten by value on merge; set protect_structure=False to allow overwriting.\n            \n            >>> \n            >>> print t1.makeReport()\n            a.x = 1\n            >>> \n      \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  int __pyx_v_overwrite;
  int __pyx_v_protect_structure;
  __pyx_t_8treedict_8treedict_flagtype __pyx_v_flags;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  long __pyx_t_1;
  long __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__source,&__pyx_n_s__overwrite,&__pyx_n_s__protect_structure,0};
  __Pyx_RefNannySetupContext("update");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__source);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__overwrite);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__protect_structure);
        if (value) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "update") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3072; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_source = values[0];
    if (values[1]) {
      __pyx_v_overwrite = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_overwrite == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3072; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_overwrite = ((int)1);
    }
    if (values[2]) {
      __pyx_v_protect_structure = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_protect_structure == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3073; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3073
 * 
 *     def update(self, source, bint overwrite = True,
 *                bint protect_structure = False):             # <<<<<<<<<<<<<<
 *         """
 *         Copies all the branches and values from a source
 */
      __pyx_v_protect_structure = ((int)0);
    }
  } else {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3072
 *             raise e
 * 
 *     def update(self, source, bint overwrite = True,             # <<<<<<<<<<<<<<
 *                bint protect_structure = False):
 *         """
 */
    __pyx_v_overwrite = ((int)1);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3073
 * 
 *     def update(self, source, bint overwrite = True,
 *                bint protect_structure = False):             # <<<<<<<<<<<<<<
 *         """
 *         Copies all the branches and values from a source
 */
    __pyx_v_protect_structure = ((int)0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_protect_structure = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_protect_structure == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3073; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  2: __pyx_v_overwrite = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_overwrite == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3072; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_source = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3072; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.update");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3163
 *         """
 * 
 *         cdef flagtype flags = ((0 if overwrite else f_no_overwrite)             # <<<<<<<<<<<<<<
 *                                | (f_protect_structure
 *                                   if protect_structure and overwrite
 */
  if (__pyx_v_overwrite) {
    __pyx_t_1 = 0;
  } else {
    __pyx_t_1 = 512;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3165
 *         cdef flagtype flags = ((0 if overwrite else f_no_overwrite)
 *                                | (f_protect_structure
 *                                   if protect_structure and overwrite             # <<<<<<<<<<<<<<
 *                                   else 0))
 * 
 */
  if (__pyx_v_protect_structure) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3166
 *                                | (f_protect_structure
 *                                   if protect_structure and overwrite
 *                                   else 0))             # <<<<<<<<<<<<<<
 * 
 *         cdef TreeDict p
 */
    __pyx_t_3 = __pyx_v_overwrite;
  } else {
    __pyx_t_3 = __pyx_v_protect_structure;
  }
  if (__pyx_t_3) {
    __pyx_t_2 = 64;
  } else {
    __pyx_t_2 = 0;
  }
  __pyx_v_flags = (__pyx_t_1 | __pyx_t_2);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3170
 *         cdef TreeDict p
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if type(source) is TreeDict:
 *                 self._update(<TreeDict>source, flags | f_check_only)
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3171
 * 
 *         try:
 *             if type(source) is TreeDict:             # <<<<<<<<<<<<<<
 *                 self._update(<TreeDict>source, flags | f_check_only)
 *                 self._update(<TreeDict>source, flags | f_already_checked)
 */
      __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_source)) == ((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict_TreeDict)));
      if (__pyx_t_3) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3172
 *         try:
 *             if type(source) is TreeDict:
 *                 self._update(<TreeDict>source, flags | f_check_only)             # <<<<<<<<<<<<<<
 *                 self._update(<TreeDict>source, flags | f_already_checked)
 * 
 */
        __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_update(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_source), (__pyx_v_flags | 8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3172; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3173
 *             if type(source) is TreeDict:
 *                 self._update(<TreeDict>source, flags | f_check_only)
 *                 self._update(<TreeDict>source, flags | f_already_checked)             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
        __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_update(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_source), (__pyx_v_flags | 32)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L14;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3176
 * 
 *             else:
 *                 p = newTreeDict(None, False)             # <<<<<<<<<<<<<<
 *                 if type(source) is dict:
 *                     p._setAll(None, <dict>source, 0)
 */
        __pyx_t_4 = ((PyObject *)__pyx_f_8treedict_8treedict_newTreeDict(((PyObject *)Py_None), 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3176; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(((PyObject *)__pyx_v_p));
        __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_4);
        __pyx_t_4 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3177
 *             else:
 *                 p = newTreeDict(None, False)
 *                 if type(source) is dict:             # <<<<<<<<<<<<<<
 *                     p._setAll(None, <dict>source, 0)
 *                 else:
 */
        __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_source)) == ((PyObject *)((PyObject*)&PyDict_Type)));
        if (__pyx_t_3) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3178
 *                 p = newTreeDict(None, False)
 *                 if type(source) is dict:
 *                     p._setAll(None, <dict>source, 0)             # <<<<<<<<<<<<<<
 *                 else:
 *                     p._setAll(None, dict(source), 0)
 */
          __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_setAll(__pyx_v_p, ((PyObject *)Py_None), ((PyObject *)__pyx_v_source), 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3178; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L15;
        }
        /*else*/ {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3180
 *                     p._setAll(None, <dict>source, 0)
 *                 else:
 *                     p._setAll(None, dict(source), 0)             # <<<<<<<<<<<<<<
 * 
 *                 self._update(p, flags | f_check_only)
 */
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3180; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_v_source);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_source);
          __Pyx_GIVEREF(__pyx_v_source);
          __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)&PyDict_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3180; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_setAll(__pyx_v_p, ((PyObject *)Py_None), ((PyObject *)__pyx_t_5), 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3180; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_L15:;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3182
 *                     p._setAll(None, dict(source), 0)
 * 
 *                 self._update(p, flags | f_check_only)             # <<<<<<<<<<<<<<
 *                 self._update(p, flags | f_already_checked)
 *         except Exception, e:
 */
        __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_update(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_p, (__pyx_v_flags | 8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3182; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3183
 * 
 *                 self._update(p, flags | f_check_only)
 *                 self._update(p, flags | f_already_checked)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             raise e
 */
        __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_update(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_p, (__pyx_v_flags | 32)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3183; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_L14:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L13_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3184
 *                 self._update(p, flags | f_check_only)
 *                 self._update(p, flags | f_already_checked)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             raise e
 * 
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict.update");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3184; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_5;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3185
 *                 self._update(p, flags | f_already_checked)
 *         except Exception, e:
 *             raise e             # <<<<<<<<<<<<<<
 * 
 *     cdef _update(self, TreeDict t, flagtype flags):
 */
      __Pyx_Raise(__pyx_v_e, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3185; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_exception_handled;
    }
    __pyx_L8_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L7_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L13_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.update");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_p);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3187
 *             raise e
 * 
 *     cdef _update(self, TreeDict t, flagtype flags):             # <<<<<<<<<<<<<<
 * 
 *         # Relevant Flags: f_check_only, f_already_checked,
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__update(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_t, __pyx_t_8treedict_8treedict_flagtype __pyx_v_flags) {
  PyObject *__pyx_v_k;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_lpn;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  void *__pyx_t_3;
  void *__pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __pyx_t_8treedict_8treedict_flagtype __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("_update");
  __pyx_v_k = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_lpn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3193
 *         cdef _PTreeNode pn, lpn
 * 
 *         for k, pn in t._param_dict.iteritems():             # <<<<<<<<<<<<<<
 * 
 *             if pn.isTree():
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_t->_param_dict));
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = ((PyObject *)__pyx_v_t->_param_dict);
  __pyx_t_2 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_1, (&__pyx_t_2), ((PyObject **)(&__pyx_t_3)), ((PyObject **)(&__pyx_t_4)))) break;
    if (!(likely(PyString_CheckExact(((PyObject *)__pyx_t_3)))||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(((PyObject *)__pyx_t_3))->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_t_3)));
    __Pyx_DECREF(((PyObject *)__pyx_v_k));
    __pyx_v_k = ((PyObject *)__pyx_t_3);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_4), __pyx_ptype_8treedict_8treedict__PTreeNode)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_4)));
    __Pyx_DECREF(((PyObject *)__pyx_v_pn));
    __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_4);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3195
 *         for k, pn in t._param_dict.iteritems():
 * 
 *             if pn.isTree():             # <<<<<<<<<<<<<<
 * 
 *                 if pn.isDanglingBranch():
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isTree(__pyx_v_pn);
    if (__pyx_t_5) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3197
 *             if pn.isTree():
 * 
 *                 if pn.isDanglingBranch():             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isDanglingBranch(__pyx_v_pn);
      if (__pyx_t_5) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3198
 * 
 *                 if pn.isDanglingBranch():
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 lpn = self._getLocalPTNode(k)
 */
        goto __pyx_L3_continue;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3200
 *                     continue
 * 
 *                 lpn = self._getLocalPTNode(k)             # <<<<<<<<<<<<<<
 * 
 *                 if lpn is None:
 */
      __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getLocalPTNode(__pyx_v_self, __pyx_v_k)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(((PyObject *)__pyx_v_lpn));
      __pyx_v_lpn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_6);
      __pyx_t_6 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3202
 *                 lpn = self._getLocalPTNode(k)
 * 
 *                 if lpn is None:             # <<<<<<<<<<<<<<
 *                     if pn.isBranch():
 *                         self._attach(k, pn.tree(), f_copy | flags)
 */
      __pyx_t_5 = (((PyObject *)__pyx_v_lpn) == Py_None);
      if (__pyx_t_5) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3203
 * 
 *                 if lpn is None:
 *                     if pn.isBranch():             # <<<<<<<<<<<<<<
 *                         self._attach(k, pn.tree(), f_copy | flags)
 *                     else:
 */
        __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isBranch(__pyx_v_pn);
        if (__pyx_t_5) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3204
 *                 if lpn is None:
 *                     if pn.isBranch():
 *                         self._attach(k, pn.tree(), f_copy | flags)             # <<<<<<<<<<<<<<
 *                     else:
 *                         self._setLocal(k, pn.tree(), flags)
 */
          __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_attach(__pyx_v_self, __pyx_v_k, ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_6), (128 | __pyx_v_flags)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L8;
        }
        /*else*/ {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3206
 *                         self._attach(k, pn.tree(), f_copy | flags)
 *                     else:
 *                         self._setLocal(k, pn.tree(), flags)             # <<<<<<<<<<<<<<
 * 
 *                 elif lpn.isTree():
 */
          __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_6 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setLocal(__pyx_v_self, __pyx_v_k, __pyx_t_7, __pyx_v_flags); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __pyx_L8:;
        goto __pyx_L7;
      }

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3208
 *                         self._setLocal(k, pn.tree(), flags)
 * 
 *                 elif lpn.isTree():             # <<<<<<<<<<<<<<
 *                     lpn.tree()._update(pn.tree(), flags)
 * 
 */
      __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_lpn->__pyx_vtab)->isTree(__pyx_v_lpn);
      if (__pyx_t_5) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3209
 * 
 *                 elif lpn.isTree():
 *                     lpn.tree()._update(pn.tree(), flags)             # <<<<<<<<<<<<<<
 * 
 *                 elif (flags & f_no_overwrite):
 */
        __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_lpn->__pyx_vtab)->tree(__pyx_v_lpn)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_6)->__pyx_vtab)->_update(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_6), ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_7), __pyx_v_flags); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __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_L7;
      }

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3211
 *                     lpn.tree()._update(pn.tree(), flags)
 * 
 *                 elif (flags & f_no_overwrite):             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      __pyx_t_9 = (__pyx_v_flags & 512);
      if (__pyx_t_9) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3212
 * 
 *                 elif (flags & f_no_overwrite):
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 elif not (flags & f_protect_structure):
 */
        goto __pyx_L3_continue;
        goto __pyx_L7;
      }

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3214
 *                     continue
 * 
 *                 elif not (flags & f_protect_structure):             # <<<<<<<<<<<<<<
 *                     self._attach(k, pn.tree(), f_copy | flags)
 * 
 */
      __pyx_t_5 = (!(__pyx_v_flags & 64));
      if (__pyx_t_5) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3215
 * 
 *                 elif not (flags & f_protect_structure):
 *                     self._attach(k, pn.tree(), f_copy | flags)             # <<<<<<<<<<<<<<
 * 
 *                 else:
 */
        __pyx_t_8 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_attach(__pyx_v_self, __pyx_v_k, ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_8), (128 | __pyx_v_flags)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L7;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3220
 *                     raise TypeError(
 *                         ("Value '%s' would get implicitly overwritten by branch on merge; "
 *                          % self._fullNameOf(k))             # <<<<<<<<<<<<<<
 *                         + "set protect_structure=False to allow overwriting.")
 *             else:
 */
        __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_fullNameOf(__pyx_v_self, __pyx_v_k, 0)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_71), __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_8), ((PyObject *)__pyx_kp_s_72)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
        __pyx_t_7 = 0;
        __pyx_t_7 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_Raise(__pyx_t_7, 0, 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L7:;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3224
 *             else:
 * 
 *                 if (flags & f_protect_structure) and not (flags & f_already_checked):             # <<<<<<<<<<<<<<
 * 
 *                     lpn = self._getLocalPTNode(k)
 */
      if ((__pyx_v_flags & 64)) {
        __pyx_t_5 = (!(__pyx_v_flags & 32));
        __pyx_t_10 = __pyx_t_5;
      } else {
        __pyx_t_10 = (__pyx_v_flags & 64);
      }
      if (__pyx_t_10) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3226
 *                 if (flags & f_protect_structure) and not (flags & f_already_checked):
 * 
 *                     lpn = self._getLocalPTNode(k)             # <<<<<<<<<<<<<<
 * 
 *                     if lpn is not None and lpn.isTree():
 */
        __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getLocalPTNode(__pyx_v_self, __pyx_v_k)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(((PyObject *)__pyx_v_lpn));
        __pyx_v_lpn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_7);
        __pyx_t_7 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3228
 *                     lpn = self._getLocalPTNode(k)
 * 
 *                     if lpn is not None and lpn.isTree():             # <<<<<<<<<<<<<<
 *                             raise TypeError(
 *                                 ("Tree/Branch '%s' would get implicitly overwritten by value on merge; "
 */
        __pyx_t_10 = (((PyObject *)__pyx_v_lpn) != Py_None);
        if (__pyx_t_10) {
          __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_lpn->__pyx_vtab)->isTree(__pyx_v_lpn);
          __pyx_t_11 = __pyx_t_5;
        } else {
          __pyx_t_11 = __pyx_t_10;
        }
        if (__pyx_t_11) {

          /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3231
 *                             raise TypeError(
 *                                 ("Tree/Branch '%s' would get implicitly overwritten by value on merge; "
 *                                  % self._fullNameOf(k))             # <<<<<<<<<<<<<<
 *                                 + "set protect_structure=False to allow overwriting.")
 * 
 */
          __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_fullNameOf(__pyx_v_self, __pyx_v_k, 0)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_73), __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_8));
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_8), ((PyObject *)__pyx_kp_s_72)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_7));
          __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
          __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7));
          __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
          __pyx_t_7 = 0;
          __pyx_t_7 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_Raise(__pyx_t_7, 0, 0);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L10;
        }
        __pyx_L10:;
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3234
 *                                 + "set protect_structure=False to allow overwriting.")
 * 
 *                 self._setLocal(k, pn.value(), flags)             # <<<<<<<<<<<<<<
 * 
 *     cdef TreeDict _copy(self, bint deep, bint frozen):
 */
      __pyx_t_7 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->value(__pyx_v_pn); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setLocal(__pyx_v_self, __pyx_v_k, __pyx_t_7, __pyx_v_flags); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __pyx_L5:;
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._update");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_DECREF((PyObject *)__pyx_v_lpn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3236
 *                 self._setLocal(k, pn.value(), flags)
 * 
 *     cdef TreeDict _copy(self, bint deep, bint frozen):             # <<<<<<<<<<<<<<
 *         # Wraps the recursive function _recursiveCopy() that
 * 
 */

static  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_f_8treedict_8treedict_8TreeDict__copy(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_v_deep, int __pyx_v_frozen) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_copy");
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3239
 *         # Wraps the recursive function _recursiveCopy() that
 * 
 *         if self.isDangling():             # <<<<<<<<<<<<<<
 *             self._raiseErrorAtFirstNonDanglingBranch(True)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->isDangling(__pyx_v_self, 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3240
 * 
 *         if self.isDangling():
 *             self._raiseErrorAtFirstNonDanglingBranch(True)             # <<<<<<<<<<<<<<
 * 
 *         cdef TreeDict p
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_raiseErrorAtFirstNonDanglingBranch(__pyx_v_self, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3245
 *         cdef str tn, bn, newbn
 * 
 *         p = self._recursiveCopy(deep)             # <<<<<<<<<<<<<<
 * 
 *         if frozen:
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_recursiveCopy(__pyx_v_self, __pyx_v_deep)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_v_p));
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3247
 *         p = self._recursiveCopy(deep)
 * 
 *         if frozen:             # <<<<<<<<<<<<<<
 *             p.freeze()
 * 
 */
  if (__pyx_v_frozen) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3248
 * 
 *         if frozen:
 *             p.freeze()             # <<<<<<<<<<<<<<
 * 
 *         self._clearHasBeenCopiedFlags()
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->freeze(__pyx_v_p, 0, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3250
 *             p.freeze()
 * 
 *         self._clearHasBeenCopiedFlags()             # <<<<<<<<<<<<<<
 * 
 *         return p
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_clearHasBeenCopiedFlags(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3252
 *         self._clearHasBeenCopiedFlags()
 * 
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef _clearHasBeenCopiedFlags(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_p));
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._copy");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_p);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3254
 *         return p
 * 
 *     cdef _clearHasBeenCopiedFlags(self):             # <<<<<<<<<<<<<<
 * 
 *         cdef _PTreeNode pn
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__clearHasBeenCopiedFlags(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  PyObject *__pyx_v_pnv;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  void *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_clearHasBeenCopiedFlags");
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_pnv = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3258
 *         cdef _PTreeNode pn
 * 
 *         if self.hasBeenCopied():             # <<<<<<<<<<<<<<
 *             del self._aux_dict[s_copied_node]
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->hasBeenCopied(__pyx_v_self);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3259
 * 
 *         if self.hasBeenCopied():
 *             del self._aux_dict[s_copied_node]             # <<<<<<<<<<<<<<
 * 
 *             self._setHasBeenCopiedFlag(False)
 */
    if (PyDict_DelItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_copied_node)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3261
 *             del self._aux_dict[s_copied_node]
 * 
 *             self._setHasBeenCopiedFlag(False)             # <<<<<<<<<<<<<<
 * 
 *             for pnv in self._param_dict.itervalues():
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setHasBeenCopiedFlag(__pyx_v_self, 0);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3263
 *             self._setHasBeenCopiedFlag(False)
 * 
 *             for pnv in self._param_dict.itervalues():             # <<<<<<<<<<<<<<
 *                 pn = <_PTreeNode>pnv
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self->_param_dict));
    __Pyx_XDECREF(__pyx_t_2);
    __pyx_t_2 = ((PyObject *)__pyx_v_self->_param_dict);
    __pyx_t_3 = 0;
    while (1) {
      if (!PyDict_Next(__pyx_t_2, (&__pyx_t_3), NULL, ((PyObject **)(&__pyx_t_4)))) break;
      __Pyx_INCREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(__pyx_v_pnv);
      __pyx_v_pnv = ((PyObject *)__pyx_t_4);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3264
 * 
 *             for pnv in self._param_dict.itervalues():
 *                 pn = <_PTreeNode>pnv             # <<<<<<<<<<<<<<
 * 
 *                 if pn.isTree():
 */
      __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_v_pnv)));
      __Pyx_DECREF(((PyObject *)__pyx_v_pn));
      __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_v_pnv);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3266
 *                 pn = <_PTreeNode>pnv
 * 
 *                 if pn.isTree():             # <<<<<<<<<<<<<<
 *                     pn.tree()._clearHasBeenCopiedFlags()
 * 
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isTree(__pyx_v_pn);
      if (__pyx_t_1) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3267
 * 
 *                 if pn.isTree():
 *                     pn.tree()._clearHasBeenCopiedFlags()             # <<<<<<<<<<<<<<
 * 
 *         if self.isCopyReferenced():
 */
        __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_5)->__pyx_vtab)->_clearHasBeenCopiedFlags(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3269
 *                     pn.tree()._clearHasBeenCopiedFlags()
 * 
 *         if self.isCopyReferenced():             # <<<<<<<<<<<<<<
 *             self._setCopyReferencedFlag(False)
 *             del self._aux_dict[s_copy_referencing_keys]
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->isCopyReferenced(__pyx_v_self);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3270
 * 
 *         if self.isCopyReferenced():
 *             self._setCopyReferencedFlag(False)             # <<<<<<<<<<<<<<
 *             del self._aux_dict[s_copy_referencing_keys]
 * 
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setCopyReferencedFlag(__pyx_v_self, 0);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3271
 *         if self.isCopyReferenced():
 *             self._setCopyReferencedFlag(False)
 *             del self._aux_dict[s_copy_referencing_keys]             # <<<<<<<<<<<<<<
 * 
 *     cdef TreeDict _recursiveCopy(self, bint deep):
 */
    if (PyDict_DelItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_copy_referencing_keys)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._clearHasBeenCopiedFlags");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_DECREF(__pyx_v_pnv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3273
 *             del self._aux_dict[s_copy_referencing_keys]
 * 
 *     cdef TreeDict _recursiveCopy(self, bint deep):             # <<<<<<<<<<<<<<
 *         # The recursive version of the above;
 * 
 */

static  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_f_8treedict_8treedict_8TreeDict__recursiveCopy(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_v_deep) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p = 0;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_new_pn;
  PyObject *__pyx_v_k;
  PyObject *__pyx_v_t;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  void *__pyx_t_4;
  void *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("_recursiveCopy");
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_new_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_t = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3276
 *         # The recursive version of the above;
 * 
 *         if not deep:             # <<<<<<<<<<<<<<
 *             if RUN_ASSERTS:
 *                 assert not self.hasBeenCopied()
 */
  __pyx_t_1 = (!__pyx_v_deep);
  if (__pyx_t_1) {
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3280
 *                 assert not self.hasBeenCopied()
 *         else:
 *             if self.hasBeenCopied():             # <<<<<<<<<<<<<<
 *                 return self._aux_dict[s_copied_node]
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->hasBeenCopied(__pyx_v_self);
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3281
 *         else:
 *             if self.hasBeenCopied():
 *                 return self._aux_dict[s_copied_node]             # <<<<<<<<<<<<<<
 * 
 *         cdef TreeDict p = newTreeDict(self._name, False)
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_copied_node)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8treedict_8treedict_TreeDict))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3283
 *                 return self._aux_dict[s_copied_node]
 * 
 *         cdef TreeDict p = newTreeDict(self._name, False)             # <<<<<<<<<<<<<<
 *         cdef _PTreeNode pn, new_pn
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8treedict_8treedict_newTreeDict(__pyx_v_self->_name, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3286
 *         cdef _PTreeNode pn, new_pn
 * 
 *         assert p._name == self._name             # <<<<<<<<<<<<<<
 * 
 *         # In copying, the tree doesn't preserve parental relation.
 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_p->_name), ((PyObject *)__pyx_v_self->_name), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3290
 *         # In copying, the tree doesn't preserve parental relation.
 * 
 *         p._parent = None             # <<<<<<<<<<<<<<
 *         p._param_dict = {}
 *         p._setFrozen(False)
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_p->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_p->_parent));
  __pyx_v_p->_parent = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3291
 * 
 *         p._parent = None
 *         p._param_dict = {}             # <<<<<<<<<<<<<<
 *         p._setFrozen(False)
 * 
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __Pyx_GOTREF(__pyx_v_p->_param_dict);
  __Pyx_DECREF(((PyObject *)__pyx_v_p->_param_dict));
  __pyx_v_p->_param_dict = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3292
 *         p._parent = None
 *         p._param_dict = {}
 *         p._setFrozen(False)             # <<<<<<<<<<<<<<
 * 
 *         p._flags = self._flags & f_copybranch_propegating_flags
 */
  ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_setFrozen(__pyx_v_p, 0);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3294
 *         p._setFrozen(False)
 * 
 *         p._flags = self._flags & f_copybranch_propegating_flags             # <<<<<<<<<<<<<<
 * 
 *         p._n_dangling = 0
 */
  __pyx_v_p->_flags = (__pyx_v_self->_flags & 2);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3296
 *         p._flags = self._flags & f_copybranch_propegating_flags
 * 
 *         p._n_dangling = 0             # <<<<<<<<<<<<<<
 *         p._n_mutable = 0
 *         p._next_item_order_position = self._next_item_order_position
 */
  __pyx_v_p->_n_dangling = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3297
 * 
 *         p._n_dangling = 0
 *         p._n_mutable = 0             # <<<<<<<<<<<<<<
 *         p._next_item_order_position = self._next_item_order_position
 * 
 */
  __pyx_v_p->_n_mutable = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3298
 *         p._n_dangling = 0
 *         p._n_mutable = 0
 *         p._next_item_order_position = self._next_item_order_position             # <<<<<<<<<<<<<<
 * 
 *         for k, pn in self._param_dict.iteritems():
 */
  __pyx_v_p->_next_item_order_position = __pyx_v_self->_next_item_order_position;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3300
 *         p._next_item_order_position = self._next_item_order_position
 * 
 *         for k, pn in self._param_dict.iteritems():             # <<<<<<<<<<<<<<
 * 
 *             if pn.isDanglingBranch():
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_param_dict));
  __Pyx_XDECREF(__pyx_t_2);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_param_dict);
  __pyx_t_3 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_2, (&__pyx_t_3), ((PyObject **)(&__pyx_t_4)), ((PyObject **)(&__pyx_t_5)))) break;
    __Pyx_INCREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_v_k);
    __pyx_v_k = ((PyObject *)__pyx_t_4);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_5), __pyx_ptype_8treedict_8treedict__PTreeNode)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_5)));
    __Pyx_DECREF(((PyObject *)__pyx_v_pn));
    __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_5);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3302
 *         for k, pn in self._param_dict.iteritems():
 * 
 *             if pn.isDanglingBranch():             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isDanglingBranch(__pyx_v_pn);
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3303
 * 
 *             if pn.isDanglingBranch():
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             new_pn = self._copyValue(p, k, pn, deep)
 */
      goto __pyx_L5_continue;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3305
 *                 continue
 * 
 *             new_pn = self._copyValue(p, k, pn, deep)             # <<<<<<<<<<<<<<
 * 
 *             p._param_dict[k] = new_pn
 */
    if (!(likely(PyString_CheckExact(__pyx_v_k))||((__pyx_v_k) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_k)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_copyValue(__pyx_v_self, __pyx_v_p, ((PyObject *)__pyx_v_k), __pyx_v_pn, __pyx_v_deep); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_8treedict_8treedict__PTreeNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_new_pn));
    __pyx_v_new_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3307
 *             new_pn = self._copyValue(p, k, pn, deep)
 * 
 *             p._param_dict[k] = new_pn             # <<<<<<<<<<<<<<
 *             p._keyInserted(k, new_pn)
 * 
 */
    if (PyDict_SetItem(((PyObject *)__pyx_v_p->_param_dict), __pyx_v_k, ((PyObject *)__pyx_v_new_pn)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3308
 * 
 *             p._param_dict[k] = new_pn
 *             p._keyInserted(k, new_pn)             # <<<<<<<<<<<<<<
 * 
 *         p._reset_branches()
 */
    if (!(likely(PyString_CheckExact(__pyx_v_k))||((__pyx_v_k) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_k)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_keyInserted(__pyx_v_p, ((PyObject *)__pyx_v_k), __pyx_v_new_pn); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_L5_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3310
 *             p._keyInserted(k, new_pn)
 * 
 *         p._reset_branches()             # <<<<<<<<<<<<<<
 * 
 *         self._aux_dict[s_copied_node] = p
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_reset_branches(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3312
 *         p._reset_branches()
 * 
 *         self._aux_dict[s_copied_node] = p             # <<<<<<<<<<<<<<
 *         self._setHasBeenCopiedFlag(True)
 * 
 */
  if (PyDict_SetItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_copied_node), ((PyObject *)__pyx_v_p)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3313
 * 
 *         self._aux_dict[s_copied_node] = p
 *         self._setHasBeenCopiedFlag(True)             # <<<<<<<<<<<<<<
 * 
 *         if self.isCopyReferenced():
 */
  ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setHasBeenCopiedFlag(__pyx_v_self, 1);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3315
 *         self._setHasBeenCopiedFlag(True)
 * 
 *         if self.isCopyReferenced():             # <<<<<<<<<<<<<<
 *             # Now have to go through and update keys in trees that
 *             # previously reference this one
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->isCopyReferenced(__pyx_v_self);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3318
 *             # Now have to go through and update keys in trees that
 *             # previously reference this one
 *             for t, k in (<list>self._aux_dict[s_copy_referencing_keys]):             # <<<<<<<<<<<<<<
 * 
 *                 if RUN_ASSERTS:
 */
    __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_copy_referencing_keys)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(__pyx_t_2 != Py_None)) {
      __pyx_t_3 = 0; __pyx_t_6 = __pyx_t_2; __Pyx_INCREF(__pyx_t_6);
    } else {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_6)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
      if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
        PyObject* tuple = __pyx_t_2;
        __pyx_t_7 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_7);
        __pyx_t_8 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_v_t);
        __pyx_v_t = __pyx_t_7;
        __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_v_k);
        __pyx_v_k = __pyx_t_8;
        __pyx_t_8 = 0;
      } else {
        __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_EndUnpack(__pyx_t_9, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_v_t);
        __pyx_v_t = __pyx_t_7;
        __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_v_k);
        __pyx_v_k = __pyx_t_8;
        __pyx_t_8 = 0;
      }

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3324
 *                     assert type(k) is str
 * 
 *                 (<TreeDict>t)._setLocal(k, p, f_already_checked)             # <<<<<<<<<<<<<<
 * 
 *             del self._aux_dict[s_copy_referencing_keys]
 */
      if (!(likely(PyString_CheckExact(__pyx_v_k))||((__pyx_v_k) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_k)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_t)->__pyx_vtab)->_setLocal(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_t), ((PyObject *)__pyx_v_k), ((PyObject *)__pyx_v_p), 32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3326
 *                 (<TreeDict>t)._setLocal(k, p, f_already_checked)
 * 
 *             del self._aux_dict[s_copy_referencing_keys]             # <<<<<<<<<<<<<<
 *             self._setCopyReferencedFlag(False)
 * 
 */
    if (PyDict_DelItem(((PyObject *)__pyx_v_self->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_copy_referencing_keys)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3327
 * 
 *             del self._aux_dict[s_copy_referencing_keys]
 *             self._setCopyReferencedFlag(False)             # <<<<<<<<<<<<<<
 * 
 *         return p
 */
    ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_setCopyReferencedFlag(__pyx_v_self, 0);
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3329
 *             self._setCopyReferencedFlag(False)
 * 
 *         return p             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_p));
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._recursiveCopy");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_p);
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_DECREF((PyObject *)__pyx_v_new_pn);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_DECREF(__pyx_v_t);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3332
 * 
 * 
 *     cdef _copyValue(self, TreeDict parent, str key, _PTreeNode pn, bint deep):             # <<<<<<<<<<<<<<
 * 
 *         cdef TreeDict p
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__copyValue(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_parent, PyObject *__pyx_v_key, struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn, int __pyx_v_deep) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  size_t __pyx_t_7;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("_copyValue");
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3336
 *         cdef TreeDict p
 * 
 *         if pn.isBranch() and pn.tree()._parent is self and pn.tree()._name == key:             # <<<<<<<<<<<<<<
 * 
 *             # print "Here; key = %s; tree id = %s" % (key, id(pn.tree()))
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isBranch(__pyx_v_pn);
  if (__pyx_t_1) {
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = (((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2)->_parent == __pyx_v_self);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {
      __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyObject_RichCompare(((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2)->_name), ((PyObject *)__pyx_v_key), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __pyx_t_5;
    } else {
      __pyx_t_6 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_6;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3340
 *             # print "Here; key = %s; tree id = %s" % (key, id(pn.tree()))
 * 
 *             p = pn.tree()._recursiveCopy(deep)             # <<<<<<<<<<<<<<
 *             p._parent = parent
 * 
 */
    __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_4)->__pyx_vtab)->_recursiveCopy(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_4), __pyx_v_deep)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_p));
    __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3341
 * 
 *             p = pn.tree()._recursiveCopy(deep)
 *             p._parent = parent             # <<<<<<<<<<<<<<
 * 
 *             return newPTreeNodeExact(p, pn.type(), pn.orderPosition())
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_parent));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
    __Pyx_GOTREF(__pyx_v_p->_parent);
    __Pyx_DECREF(((PyObject *)__pyx_v_p->_parent));
    __pyx_v_p->_parent = __pyx_v_parent;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3343
 *             p._parent = parent
 * 
 *             return newPTreeNodeExact(p, pn.type(), pn.orderPosition())             # <<<<<<<<<<<<<<
 * 
 *         elif deep:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->orderPosition(__pyx_v_pn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyInt_AsSize_t(__pyx_t_2); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __pyx_f_8treedict_8treedict_newPTreeNodeExact(((PyObject *)__pyx_v_p), ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->type(__pyx_v_pn), __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3345
 *             return newPTreeNodeExact(p, pn.type(), pn.orderPosition())
 * 
 *         elif deep:             # <<<<<<<<<<<<<<
 *             return newPTreeNodeExact(
 *                 deepcopy_f(pn.value()),
 */
  if (__pyx_v_deep) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3346
 * 
 *         elif deep:
 *             return newPTreeNodeExact(             # <<<<<<<<<<<<<<
 *                 deepcopy_f(pn.value()),
 *                 pn.type(), pn.orderPosition())
 */
    __Pyx_XDECREF(__pyx_r);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3347
 *         elif deep:
 *             return newPTreeNodeExact(
 *                 deepcopy_f(pn.value()),             # <<<<<<<<<<<<<<
 *                 pn.type(), pn.orderPosition())
 * 
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->value(__pyx_v_pn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_v_8treedict_8treedict_deepcopy_f, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3348
 *             return newPTreeNodeExact(
 *                 deepcopy_f(pn.value()),
 *                 pn.type(), pn.orderPosition())             # <<<<<<<<<<<<<<
 * 
 *         elif pn.isTree():
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->orderPosition(__pyx_v_pn); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyInt_AsSize_t(__pyx_t_4); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __pyx_f_8treedict_8treedict_newPTreeNodeExact(__pyx_t_2, ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->type(__pyx_v_pn), __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3350
 *                 pn.type(), pn.orderPosition())
 * 
 *         elif pn.isTree():             # <<<<<<<<<<<<<<
 * 
 *             p = pn.tree()
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isTree(__pyx_v_pn);
  if (__pyx_t_3) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3352
 *         elif pn.isTree():
 * 
 *             p = pn.tree()             # <<<<<<<<<<<<<<
 * 
 *             if p.hasBeenCopied():
 */
    __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_v_p));
    __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3354
 *             p = pn.tree()
 * 
 *             if p.hasBeenCopied():             # <<<<<<<<<<<<<<
 *                 return newPTreeNodeExact(<TreeDict>(p._aux_dict[s_copied_node]),
 *                                          pn.type(), pn.orderPosition())
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->hasBeenCopied(__pyx_v_p);
    if (__pyx_t_3) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3355
 * 
 *             if p.hasBeenCopied():
 *                 return newPTreeNodeExact(<TreeDict>(p._aux_dict[s_copied_node]),             # <<<<<<<<<<<<<<
 *                                          pn.type(), pn.orderPosition())
 *             else:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_p->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_copied_node)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3356
 *             if p.hasBeenCopied():
 *                 return newPTreeNodeExact(<TreeDict>(p._aux_dict[s_copied_node]),
 *                                          pn.type(), pn.orderPosition())             # <<<<<<<<<<<<<<
 *             else:
 *                 p._setCopyReferencedFlag(True)
 */
      __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->orderPosition(__pyx_v_pn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyInt_AsSize_t(__pyx_t_2); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __pyx_f_8treedict_8treedict_newPTreeNodeExact(__pyx_t_4, ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->type(__pyx_v_pn), __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3358
 *                                          pn.type(), pn.orderPosition())
 *             else:
 *                 p._setCopyReferencedFlag(True)             # <<<<<<<<<<<<<<
 * 
 *                 if s_copy_referencing_keys in p._aux_dict:
 */
      ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_setCopyReferencedFlag(__pyx_v_p, 1);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3360
 *                 p._setCopyReferencedFlag(True)
 * 
 *                 if s_copy_referencing_keys in p._aux_dict:             # <<<<<<<<<<<<<<
 *                     (<list>p._aux_dict[s_copy_referencing_keys]).append( (parent, key) )
 *                 else:
 */
      if (unlikely(((PyObject *)__pyx_v_p->_aux_dict) == Py_None)) {
        __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      } else {
        __pyx_t_3 = ((PyDict_Contains(((PyObject *)__pyx_v_p->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_copy_referencing_keys)))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      if (__pyx_t_3) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3361
 * 
 *                 if s_copy_referencing_keys in p._aux_dict:
 *                     (<list>p._aux_dict[s_copy_referencing_keys]).append( (parent, key) )             # <<<<<<<<<<<<<<
 *                 else:
 *                     p._aux_dict[s_copy_referencing_keys] = [ (parent, key) ]
 */
        __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_p->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_copy_referencing_keys)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        if (unlikely(((PyObject *)__pyx_t_2) == Py_None)) {
          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
        }
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(((PyObject *)__pyx_v_parent));
        PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_parent));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
        __Pyx_INCREF(((PyObject *)__pyx_v_key));
        PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_key));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_key));
        __pyx_t_8 = PyList_Append(((PyObject *)((PyObject *)__pyx_t_2)), __pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L5;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3363
 *                     (<list>p._aux_dict[s_copy_referencing_keys]).append( (parent, key) )
 *                 else:
 *                     p._aux_dict[s_copy_referencing_keys] = [ (parent, key) ]             # <<<<<<<<<<<<<<
 * 
 *                 return newPTreeNodeExact(pn.value(), pn.type(), pn.orderPosition())
 */
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(((PyObject *)__pyx_v_parent));
        PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_parent));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
        __Pyx_INCREF(((PyObject *)__pyx_v_key));
        PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_key));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_key));
        __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_t_4 = 0;
        if (PyDict_SetItem(((PyObject *)__pyx_v_p->_aux_dict), ((PyObject *)__pyx_v_8treedict_8treedict_s_copy_referencing_keys), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      }
      __pyx_L5:;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3365
 *                     p._aux_dict[s_copy_referencing_keys] = [ (parent, key) ]
 * 
 *                 return newPTreeNodeExact(pn.value(), pn.type(), pn.orderPosition())             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->value(__pyx_v_pn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->orderPosition(__pyx_v_pn); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyInt_AsSize_t(__pyx_t_4); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __pyx_f_8treedict_8treedict_newPTreeNodeExact(__pyx_t_2, ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->type(__pyx_v_pn), __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3368
 * 
 *         else:
 *             return newPTreeNodeExact(pn.value(), pn.type(), pn.orderPosition())             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->value(__pyx_v_pn); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->orderPosition(__pyx_v_pn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyInt_AsSize_t(__pyx_t_2); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __pyx_f_8treedict_8treedict_newPTreeNodeExact(__pyx_t_4, ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->type(__pyx_v_pn), __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._copyValue");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3371
 * 
 * 
 *     cdef _reset_branches(self):             # <<<<<<<<<<<<<<
 *         self._branches = [(<_PTreeNode> pn).value() for pn in self._param_dict.itervalues()
 *                           if (<_PTreeNode> pn).isBranch()]
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__reset_branches(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self) {
  PyObject *__pyx_v_pn;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  void *__pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_reset_branches");
  __pyx_v_pn = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3372
 * 
 *     cdef _reset_branches(self):
 *         self._branches = [(<_PTreeNode> pn).value() for pn in self._param_dict.itervalues()             # <<<<<<<<<<<<<<
 *                           if (<_PTreeNode> pn).isBranch()]
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_param_dict));
  __Pyx_XDECREF(__pyx_t_2);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_param_dict);
  __pyx_t_3 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_2, (&__pyx_t_3), NULL, ((PyObject **)(&__pyx_t_4)))) break;
    __Pyx_INCREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_v_pn);
    __pyx_v_pn = ((PyObject *)__pyx_t_4);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3373
 *     cdef _reset_branches(self):
 *         self._branches = [(<_PTreeNode> pn).value() for pn in self._param_dict.itervalues()
 *                           if (<_PTreeNode> pn).isBranch()]             # <<<<<<<<<<<<<<
 * 
 *     ################################################################################
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_v_pn)->__pyx_vtab)->isBranch(((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_v_pn));
    if (__pyx_t_5) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3372
 * 
 *     cdef _reset_branches(self):
 *         self._branches = [(<_PTreeNode> pn).value() for pn in self._param_dict.itervalues()             # <<<<<<<<<<<<<<
 *                           if (<_PTreeNode> pn).isBranch()]
 * 
 */
      __pyx_t_6 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_v_pn)->__pyx_vtab)->value(((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_v_pn)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_v_self->_branches);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_branches));
  __pyx_v_self->_branches = __pyx_t_1;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._reset_branches");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_pn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3378
 *     # Methods relating to pickling / unpickling
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 * 
 *         # Need to check for weak references in
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_d = 0;
  __pyx_t_8treedict_8treedict_flagtype __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__reduce__");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3384
 *         # corner case that shouldn't really be that important.
 * 
 *         cdef dict d = <dict>(self._aux_dict.copy())             # <<<<<<<<<<<<<<
 *         cdef flagtype flags = self._flags
 * 
 */
  __pyx_t_1 = PyDict_Copy(((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_aux_dict)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_t_1)));
  __pyx_v_d = ((PyObject *)__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3385
 * 
 *         cdef dict d = <dict>(self._aux_dict.copy())
 *         cdef flagtype flags = self._flags             # <<<<<<<<<<<<<<
 * 
 *         if s_dangling_reference_queue in d:
 */
  __pyx_v_flags = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_flags;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3387
 *         cdef flagtype flags = self._flags
 * 
 *         if s_dangling_reference_queue in d:             # <<<<<<<<<<<<<<
 *             d[s_dangling_reference_queue] = []
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_d) == Py_None)) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else {
    __pyx_t_2 = ((PyDict_Contains(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_v_8treedict_8treedict_s_dangling_reference_queue)))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3388
 * 
 *         if s_dangling_reference_queue in d:
 *             d[s_dangling_reference_queue] = []             # <<<<<<<<<<<<<<
 * 
 *         ########################################
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_v_8treedict_8treedict_s_dangling_reference_queue), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3392
 *         ########################################
 *         # Clear other irrelevant flags
 *         _setFlagOff(&flags, f_one_iterators_referencing)             # <<<<<<<<<<<<<<
 *         _setFlagOff(&flags, f_many_iterators_referencing)
 *         _setFlagOff(&flags, f_is_registered)
 */
  __pyx_f_8treedict_8treedict__setFlagOff((&__pyx_v_flags), 16);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3393
 *         # Clear other irrelevant flags
 *         _setFlagOff(&flags, f_one_iterators_referencing)
 *         _setFlagOff(&flags, f_many_iterators_referencing)             # <<<<<<<<<<<<<<
 *         _setFlagOff(&flags, f_is_registered)
 * 
 */
  __pyx_f_8treedict_8treedict__setFlagOff((&__pyx_v_flags), 32);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3394
 *         _setFlagOff(&flags, f_one_iterators_referencing)
 *         _setFlagOff(&flags, f_many_iterators_referencing)
 *         _setFlagOff(&flags, f_is_registered)             # <<<<<<<<<<<<<<
 * 
 *         # Clear iterator referencing
 */
  __pyx_f_8treedict_8treedict__setFlagOff((&__pyx_v_flags), 8);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3397
 * 
 *         # Clear iterator referencing
 *         if s_IterReferenceCount in d:             # <<<<<<<<<<<<<<
 *             del d[s_IterReferenceCount]
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_d) == Py_None)) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else {
    __pyx_t_2 = ((PyDict_Contains(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_v_8treedict_8treedict_s_IterReferenceCount)))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3398
 *         # Clear iterator referencing
 *         if s_IterReferenceCount in d:
 *             del d[s_IterReferenceCount]             # <<<<<<<<<<<<<<
 * 
 *         if s_registration_tree_name in d:
 */
    if (PyDict_DelItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_v_8treedict_8treedict_s_IterReferenceCount)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3400
 *             del d[s_IterReferenceCount]
 * 
 *         if s_registration_tree_name in d:             # <<<<<<<<<<<<<<
 *             del d[s_registration_tree_name]
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_d) == Py_None)) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else {
    __pyx_t_2 = ((PyDict_Contains(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_v_8treedict_8treedict_s_registration_tree_name)))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3401
 * 
 *         if s_registration_tree_name in d:
 *             del d[s_registration_tree_name]             # <<<<<<<<<<<<<<
 * 
 *         if s_registration_branch_name in d:
 */
    if (PyDict_DelItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_v_8treedict_8treedict_s_registration_tree_name)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3403
 *             del d[s_registration_tree_name]
 * 
 *         if s_registration_branch_name in d:             # <<<<<<<<<<<<<<
 *             del d[s_registration_branch_name]
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_d) == Py_None)) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else {
    __pyx_t_2 = ((PyDict_Contains(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_v_8treedict_8treedict_s_registration_branch_name)))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3404
 * 
 *         if s_registration_branch_name in d:
 *             del d[s_registration_branch_name]             # <<<<<<<<<<<<<<
 * 
 *         return (_TreeDict_unpickler,
 */
    if (PyDict_DelItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_v_8treedict_8treedict_s_registration_branch_name)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3406
 *             del d[s_registration_branch_name]
 * 
 *         return (_TreeDict_unpickler,             # <<<<<<<<<<<<<<
 *                 (self._name, self._param_dict, flags, d,
 *                  self._n_mutable, self._next_item_order_position, self._n_dangling) )
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___TreeDict_unpickler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3407
 * 
 *         return (_TreeDict_unpickler,
 *                 (self._name, self._param_dict, flags, d,             # <<<<<<<<<<<<<<
 *                  self._n_mutable, self._next_item_order_position, self._n_dangling) )
 * 
 */
  __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_flags); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3408
 *         return (_TreeDict_unpickler,
 *                 (self._name, self._param_dict, flags, d,
 *                  self._n_mutable, self._next_item_order_position, self._n_dangling) )             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = __Pyx_PyInt_FromSize_t(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_n_mutable); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_FromSize_t(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_next_item_order_position); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_FromSize_t(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_n_dangling); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_name));
  PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_name));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_name));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_param_dict));
  PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_param_dict));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->_param_dict));
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_d));
  PyTuple_SET_ITEM(__pyx_t_7, 3, ((PyObject *)__pyx_v_d));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_d));
  PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_7, 6, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_1 = 0;
  __pyx_t_7 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__reduce__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3414
 *     # Methods relating to size and the like
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self._size(True, i_BranchMode_None)
 * 
 */

static Py_ssize_t __pyx_pf_8treedict_8treedict_8TreeDict___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pf_8treedict_8treedict_8TreeDict___len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannySetupContext("__len__");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3415
 * 
 *     def __len__(self):
 *         return self._size(True, i_BranchMode_None)             # <<<<<<<<<<<<<<
 * 
 *     def size(self, bint recursive = True, str branch_mode = 'none'):
 */
  __pyx_r = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_size(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1, 2);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3417
 *         return self._size(True, i_BranchMode_None)
 * 
 *     def size(self, bint recursive = True, str branch_mode = 'none'):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a count of values in the tree.  If recursive is True,
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_size(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_size[] = "\n        Returns a count of values in the tree.  If recursive is True,\n        then it counts all nodes in this branch and in all subtrees,\n        according to the branch_mode policy.\n\n        If branch_mode is 'none' (default), only the values are counted.\n\n        If branch_mode is 'all', all nodes and all values in the current\n        tree are counted.\n\n        If branch_mode is 'only', only the branches are counted.\n\n        Example::\n\n            >>> from treedict import TreeDict\n            >>> t = TreeDict() ; t.set('b.x', 1, 'b.c.y', 2, x = 1)\n            >>> print t.makeReport()\n            b.x   = 1\n            b.c.y = 2\n            x     = 1\n            >>> t.size()\n            3\n            >>> t.size(recursive=False)\n            1\n            >>> t.size(recursive=False, branch_mode='none')\n            1\n            >>> t.size(recursive=False, branch_mode='only')\n            1\n            >>> t.size(recursive=False, branch_mode='all')\n            2\n            >>> t.size(recursive=True, branch_mode='only')\n            2\n            >>> t.size(recursive=True, branch_mode='all')\n            5\n            \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_size(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_recursive;
  PyObject *__pyx_v_branch_mode = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__recursive,&__pyx_n_s__branch_mode,0};
  __Pyx_RefNannySetupContext("size");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_n_s__none);
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recursive);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__branch_mode);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "size") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3417; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_recursive = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3417; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_recursive = ((int)1);
    }
    __pyx_v_branch_mode = ((PyObject *)values[1]);
  } else {
    __pyx_v_recursive = ((int)1);
    __pyx_v_branch_mode = ((PyObject *)__pyx_n_s__none);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_branch_mode = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 1));
      case  1: __pyx_v_recursive = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3417; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("size", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3417; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.size");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_branch_mode), &PyString_Type, 1, "branch_mode", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3455
 *         """
 * 
 *         return self._size(recursive, self._getBranchMode(branch_mode))             # <<<<<<<<<<<<<<
 * 
 *     cdef size_t _local_size(self, int branch_mode):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_getBranchMode(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((PyObject *)__pyx_v_branch_mode)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_size(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_recursive, __pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.size");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3457
 *         return self._size(recursive, self._getBranchMode(branch_mode))
 * 
 *     cdef size_t _local_size(self, int branch_mode):             # <<<<<<<<<<<<<<
 *         if branch_mode == i_BranchMode_Only:
 *             return len(self._branches) - self._n_dangling
 */

static  size_t __pyx_f_8treedict_8treedict_8TreeDict__local_size(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_v_branch_mode) {
  size_t __pyx_r;
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  __Pyx_RefNannySetupContext("_local_size");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3458
 * 
 *     cdef size_t _local_size(self, int branch_mode):
 *         if branch_mode == i_BranchMode_Only:             # <<<<<<<<<<<<<<
 *             return len(self._branches) - self._n_dangling
 *         elif branch_mode == i_BranchMode_All:
 */
  switch (__pyx_v_branch_mode) {
    case 3:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3459
 *     cdef size_t _local_size(self, int branch_mode):
 *         if branch_mode == i_BranchMode_Only:
 *             return len(self._branches) - self._n_dangling             # <<<<<<<<<<<<<<
 *         elif branch_mode == i_BranchMode_All:
 *             return len(self._param_dict) - self._n_dangling
 */
    if (unlikely(__pyx_v_self->_branches == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_self->_branches)); 
    __pyx_r = (__pyx_t_1 - __pyx_v_self->_n_dangling);
    goto __pyx_L0;
    break;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3460
 *         if branch_mode == i_BranchMode_Only:
 *             return len(self._branches) - self._n_dangling
 *         elif branch_mode == i_BranchMode_All:             # <<<<<<<<<<<<<<
 *             return len(self._param_dict) - self._n_dangling
 *         elif branch_mode == i_BranchMode_None:
 */
    case 1:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3461
 *             return len(self._branches) - self._n_dangling
 *         elif branch_mode == i_BranchMode_All:
 *             return len(self._param_dict) - self._n_dangling             # <<<<<<<<<<<<<<
 *         elif branch_mode == i_BranchMode_None:
 *             return len(self._param_dict) - len(self._branches)
 */
    if (unlikely(__pyx_v_self->_param_dict == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_1 = PyDict_Size(((PyObject *)__pyx_v_self->_param_dict)); 
    __pyx_r = (__pyx_t_1 - __pyx_v_self->_n_dangling);
    goto __pyx_L0;
    break;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3462
 *         elif branch_mode == i_BranchMode_All:
 *             return len(self._param_dict) - self._n_dangling
 *         elif branch_mode == i_BranchMode_None:             # <<<<<<<<<<<<<<
 *             return len(self._param_dict) - len(self._branches)
 * 
 */
    case 2:

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3463
 *             return len(self._param_dict) - self._n_dangling
 *         elif branch_mode == i_BranchMode_None:
 *             return len(self._param_dict) - len(self._branches)             # <<<<<<<<<<<<<<
 * 
 *     cdef size_t _size(self, bint recursive, int branch_mode):
 */
    if (unlikely(__pyx_v_self->_param_dict == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_1 = PyDict_Size(((PyObject *)__pyx_v_self->_param_dict)); 
    if (unlikely(__pyx_v_self->_branches == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_v_self->_branches)); 
    __pyx_r = (__pyx_t_1 - __pyx_t_2);
    goto __pyx_L0;
    break;
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict._local_size");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3465
 *             return len(self._param_dict) - len(self._branches)
 * 
 *     cdef size_t _size(self, bint recursive, int branch_mode):             # <<<<<<<<<<<<<<
 * 
 *         cdef size_t n
 */

static  size_t __pyx_f_8treedict_8treedict_8TreeDict__size(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_v_recursive, int __pyx_v_branch_mode) {
  size_t __pyx_v_n;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_b;
  size_t __pyx_r;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_size");
  __pyx_v_b = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3470
 *         cdef TreeDict b
 * 
 *         if recursive:             # <<<<<<<<<<<<<<
 *             n = self._local_size(branch_mode)
 * 
 */
  if (__pyx_v_recursive) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3471
 * 
 *         if recursive:
 *             n = self._local_size(branch_mode)             # <<<<<<<<<<<<<<
 * 
 *             for b in self._branches:
 */
    __pyx_v_n = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_local_size(__pyx_v_self, __pyx_v_branch_mode);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3473
 *             n = self._local_size(branch_mode)
 * 
 *             for b in self._branches:             # <<<<<<<<<<<<<<
 *                 if not b.isDangling():
 *                     n += b._size(recursive, branch_mode)
 */
    if (likely(((PyObject *)__pyx_v_self->_branches) != Py_None)) {
      __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_self->_branches); __Pyx_INCREF(__pyx_t_2);
    } else {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    for (;;) {
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8treedict_8treedict_TreeDict))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_b));
      __pyx_v_b = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3474
 * 
 *             for b in self._branches:
 *                 if not b.isDangling():             # <<<<<<<<<<<<<<
 *                     n += b._size(recursive, branch_mode)
 * 
 */
      __pyx_t_4 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->isDangling(__pyx_v_b, 0));
      if (__pyx_t_4) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3475
 *             for b in self._branches:
 *                 if not b.isDangling():
 *                     n += b._size(recursive, branch_mode)             # <<<<<<<<<<<<<<
 * 
 *             return n
 */
        __pyx_v_n += ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_b->__pyx_vtab)->_size(__pyx_v_b, __pyx_v_recursive, __pyx_v_branch_mode);
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3477
 *                     n += b._size(recursive, branch_mode)
 * 
 *             return n             # <<<<<<<<<<<<<<
 *         else:
 *             return self._local_size(branch_mode)
 */
    __pyx_r = __pyx_v_n;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3479
 *             return n
 *         else:
 *             return self._local_size(branch_mode)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_r = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_local_size(__pyx_v_self, __pyx_v_branch_mode);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("treedict.treedict.TreeDict._size");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_b);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3485
 *     # Methods relating to iterating over values
 * 
 *     cdef _getBranchMode(self, branch_mode):             # <<<<<<<<<<<<<<
 *         # This function returns an object so it can raise exceptions;
 *         # it gets converted later anyway.
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__getBranchMode(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_branch_mode) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("_getBranchMode");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3489
 *         # it gets converted later anyway.
 * 
 *         if branch_mode is None:             # <<<<<<<<<<<<<<
 *             return i_BranchMode_None
 * 
 */
  __pyx_t_1 = (__pyx_v_branch_mode == Py_None);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3490
 * 
 *         if branch_mode is None:
 *             return i_BranchMode_None             # <<<<<<<<<<<<<<
 * 
 *         if type(branch_mode) is not str:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_2);
    __pyx_r = __pyx_int_2;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3492
 *             return i_BranchMode_None
 * 
 *         if type(branch_mode) is not str:             # <<<<<<<<<<<<<<
 *             raise TypeError(_branch_mode_error_msg)
 * 
 */
  __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_branch_mode)) != ((PyObject *)((PyObject*)&PyString_Type)));
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3493
 * 
 *         if type(branch_mode) is not str:
 *             raise TypeError(_branch_mode_error_msg)             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_8treedict_8treedict__branch_mode_error_msg);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_8treedict_8treedict__branch_mode_error_msg);
    __Pyx_GIVEREF(__pyx_v_8treedict_8treedict__branch_mode_error_msg);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3493; __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);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3495
 *             raise TypeError(_branch_mode_error_msg)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             return _branch_mode_lookup[strlower(branch_mode)]
 *         except KeyError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3496
 * 
 *         try:
 *             return _branch_mode_lookup[strlower(branch_mode)]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             raise TypeError(_branch_mode_error_msg)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3496; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_branch_mode);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_branch_mode);
      __Pyx_GIVEREF(__pyx_v_branch_mode);
      __pyx_t_2 = PyObject_Call(__pyx_v_8treedict_8treedict_strlower, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3496; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_8treedict_8treedict__branch_mode_lookup), __pyx_t_2); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3496; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L9_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L12_try_end;
    __pyx_L9_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3497
 *         try:
 *             return _branch_mode_lookup[strlower(branch_mode)]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             raise TypeError(_branch_mode_error_msg)
 * 
 */
    __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_4) {
      __Pyx_AddTraceback("treedict.treedict.TreeDict._getBranchMode");
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3497; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_5);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3498
 *             return _branch_mode_lookup[strlower(branch_mode)]
 *         except KeyError:
 *             raise TypeError(_branch_mode_error_msg)             # <<<<<<<<<<<<<<
 * 
 *     cdef TreeDictIterator _getIter(self, bint recursive, int branch_mode, int valuetype):
 */
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3498; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_8treedict_8treedict__branch_mode_error_msg);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_8treedict_8treedict__branch_mode_error_msg);
      __Pyx_GIVEREF(__pyx_v_8treedict_8treedict__branch_mode_error_msg);
      __pyx_t_7 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3498; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_7, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3498; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L12_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._getBranchMode");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3500
 *             raise TypeError(_branch_mode_error_msg)
 * 
 *     cdef TreeDictIterator _getIter(self, bint recursive, int branch_mode, int valuetype):             # <<<<<<<<<<<<<<
 *         return newTreeDictIterator(self, recursive, branch_mode, valuetype)
 * 
 */

static  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_f_8treedict_8treedict_8TreeDict__getIter(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_v_recursive, int __pyx_v_branch_mode, int __pyx_v_valuetype) {
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_getIter");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3501
 * 
 *     cdef TreeDictIterator _getIter(self, bint recursive, int branch_mode, int valuetype):
 *         return newTreeDictIterator(self, recursive, branch_mode, valuetype)             # <<<<<<<<<<<<<<
 * 
 *     cpdef TreeDictIterator iteritems(self, bint recursive = True, branch_mode = 'none'):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8treedict_8treedict_newTreeDictIterator(__pyx_v_self, __pyx_v_recursive, __pyx_v_branch_mode, __pyx_v_valuetype)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._getIter");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3503
 *         return newTreeDictIterator(self, recursive, branch_mode, valuetype)
 * 
 *     cpdef TreeDictIterator iteritems(self, bint recursive = True, branch_mode = 'none'):             # <<<<<<<<<<<<<<
 *         """
 *         Returns an iterator that returns (key, value) pairs.  If
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_iteritems(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_f_8treedict_8treedict_8TreeDict_iteritems(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_iteritems *__pyx_optional_args) {
  int __pyx_v_recursive = ((int)1);
  PyObject *__pyx_v_branch_mode = ((PyObject *)__pyx_n_s__none);
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("iteritems");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_recursive = __pyx_optional_args->recursive;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_branch_mode = __pyx_optional_args->branch_mode;
      }
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__iteritems); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_iteritems)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recursive); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __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_INCREF(__pyx_v_branch_mode);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_branch_mode);
      __Pyx_GIVEREF(__pyx_v_branch_mode);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8treedict_8treedict_TreeDictIterator))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3543
 *         """
 * 
 *         return self._getIter(recursive, self._getBranchMode(branch_mode), i_Items)             # <<<<<<<<<<<<<<
 * 
 *     cpdef TreeDictIterator itervalues(self, bint recursive = True, branch_mode = 'none'):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getBranchMode(__pyx_v_self, __pyx_v_branch_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getIter(__pyx_v_self, __pyx_v_recursive, __pyx_t_4, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.iteritems");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3503
 *         return newTreeDictIterator(self, recursive, branch_mode, valuetype)
 * 
 *     cpdef TreeDictIterator iteritems(self, bint recursive = True, branch_mode = 'none'):             # <<<<<<<<<<<<<<
 *         """
 *         Returns an iterator that returns (key, value) pairs.  If
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_iteritems(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_iteritems[] = "\n        Returns an iterator that returns (key, value) pairs.  If\n        recursive is True, then it iterates through all nodes in this\n        branch and in all subtrees.  Keys are returned with their full\n        path names, e.g. 'foo.bar'.\n\n        If branch_mode is 'none' (default), the branches are ignored\n        and all the items associated with values are returned.\n\n        If branch_mode is 'all', all items in the current tree\n        are returned.\n\n        If branch_mode is 'only', then only the branches are returned.\n\n        Example::\n        \n            >>> from treedict import TreeDict\n            >>> t = TreeDict() ; t.set('b.x', 1, 'b.c.y', 2, x = 1)\n            >>> print t.makeReport()\n            b.x   = 1\n            b.c.y = 2\n            x     = 1\n            >>> list(t.iteritems())\n            [('x', 1), ('b.x', 1), ('b.c.y', 2)]\n            >>> list(t.iteritems(recursive=False))\n            [('x', 1)]\n            >>> list(t.iteritems(recursive=False, branch_mode='none'))\n            [('x', 1)]\n            >>> list(t.iteritems(recursive=False, branch_mode='only'))\n            [('b', TreeDict <root.b>)]\n            >>> list(t.iteritems(recursive=False, branch_mode='all'))\n            [('x', 1), ('b', TreeDict <root.b>)]\n            >>> list(t.iteritems(recursive=True, branch_mode='only'))\n            [('b', TreeDict <root.b>), ('b.c', TreeDict <root.b.c>)]\n            >>> list(t.iteritems(recursive=True, branch_mode='all'))\n            [('x', 1), ('b', TreeDict <root.b>), ('b.x', 1), ('b.c', TreeDict <root.b.c>), ('b.c.y', 2)]\n\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_iteritems(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_recursive;
  PyObject *__pyx_v_branch_mode = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8treedict_8treedict_8TreeDict_iteritems __pyx_t_2;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__recursive,&__pyx_n_s__branch_mode,0};
  __Pyx_RefNannySetupContext("iteritems");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_n_s__none);
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recursive);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__branch_mode);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "iteritems") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_recursive = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_recursive = ((int)1);
    }
    __pyx_v_branch_mode = values[1];
  } else {
    __pyx_v_recursive = ((int)1);
    __pyx_v_branch_mode = ((PyObject *)__pyx_n_s__none);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_branch_mode = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_recursive = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iteritems", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.iteritems");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.recursive = __pyx_v_recursive;
  __pyx_t_2.branch_mode = __pyx_v_branch_mode;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->iteritems(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.iteritems");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3545
 *         return self._getIter(recursive, self._getBranchMode(branch_mode), i_Items)
 * 
 *     cpdef TreeDictIterator itervalues(self, bint recursive = True, branch_mode = 'none'):             # <<<<<<<<<<<<<<
 *         """
 *         Returns an iterator that returns values in the tree.  If
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_itervalues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_f_8treedict_8treedict_8TreeDict_itervalues(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_itervalues *__pyx_optional_args) {
  int __pyx_v_recursive = ((int)1);
  PyObject *__pyx_v_branch_mode = ((PyObject *)__pyx_n_s__none);
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("itervalues");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_recursive = __pyx_optional_args->recursive;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_branch_mode = __pyx_optional_args->branch_mode;
      }
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__itervalues); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_itervalues)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recursive); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3545; __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_INCREF(__pyx_v_branch_mode);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_branch_mode);
      __Pyx_GIVEREF(__pyx_v_branch_mode);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8treedict_8treedict_TreeDictIterator))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3584
 *         """
 * 
 *         return self._getIter(recursive, self._getBranchMode(branch_mode), i_Values)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getBranchMode(__pyx_v_self, __pyx_v_branch_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getIter(__pyx_v_self, __pyx_v_recursive, __pyx_t_4, 3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.itervalues");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3545
 *         return self._getIter(recursive, self._getBranchMode(branch_mode), i_Items)
 * 
 *     cpdef TreeDictIterator itervalues(self, bint recursive = True, branch_mode = 'none'):             # <<<<<<<<<<<<<<
 *         """
 *         Returns an iterator that returns values in the tree.  If
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_itervalues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_itervalues[] = "\n        Returns an iterator that returns values in the tree.  If\n        recursive is True, then it iterates through all nodes in this\n        branch and in all subtrees.\n\n        If branch_mode is 'none' (default), the branches are ignored\n        and all the items associated with values are returned.\n\n        If branch_mode is 'all', all items in the current tree\n        are returned.\n\n        If branch_mode is 'only', then only the branches are returned.\n\n        Example::\n        \n            >>> from treedict import TreeDict\n            >>> t = TreeDict() ; t.set('b.x', 1, 'b.c.y', 2, x = 1)\n            >>> print t.makeReport()\n            b.x   = 1\n            b.c.y = 2\n            x     = 1\n            >>> list(t.itervalues())\n            [1, 1, 2]\n            >>> list(t.itervalues(recursive=False))\n            [1]\n            >>> list(t.itervalues(recursive=False, branch_mode='none'))\n            [1]\n            >>> list(t.itervalues(recursive=False, branch_mode='only'))\n            [TreeDict <root.b>]\n            >>> list(t.itervalues(recursive=False, branch_mode='all'))\n            [1, TreeDict <root.b>]\n            >>> list(t.itervalues(recursive=True, branch_mode='only'))\n            [TreeDict <root.b>, TreeDict <root.b.c>]\n            >>> list(t.itervalues(recursive=True, branch_mode='all'))\n            [1, TreeDict <root.b>, 1, TreeDict <root.b.c>, 2]\n            \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_itervalues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_recursive;
  PyObject *__pyx_v_branch_mode = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8treedict_8treedict_8TreeDict_itervalues __pyx_t_2;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__recursive,&__pyx_n_s__branch_mode,0};
  __Pyx_RefNannySetupContext("itervalues");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_n_s__none);
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recursive);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__branch_mode);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "itervalues") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3545; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_recursive = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3545; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_recursive = ((int)1);
    }
    __pyx_v_branch_mode = values[1];
  } else {
    __pyx_v_recursive = ((int)1);
    __pyx_v_branch_mode = ((PyObject *)__pyx_n_s__none);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_branch_mode = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_recursive = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3545; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("itervalues", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3545; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.itervalues");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.recursive = __pyx_v_recursive;
  __pyx_t_2.branch_mode = __pyx_v_branch_mode;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->itervalues(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.itervalues");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3586
 *         return self._getIter(recursive, self._getBranchMode(branch_mode), i_Values)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self.iterkeys()
 * 
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict___iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3587
 * 
 *     def __iter__(self):
 *         return self.iterkeys()             # <<<<<<<<<<<<<<
 * 
 *     cpdef TreeDictIterator iterkeys(self, bint recursive = True, branch_mode = 'none'):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->iterkeys(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.__iter__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3589
 *         return self.iterkeys()
 * 
 *     cpdef TreeDictIterator iterkeys(self, bint recursive = True, branch_mode = 'none'):             # <<<<<<<<<<<<<<
 *         """
 *         Returns an iterator that returns keys for nodes in the tree.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_iterkeys(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_f_8treedict_8treedict_8TreeDict_iterkeys(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_iterkeys *__pyx_optional_args) {
  int __pyx_v_recursive = ((int)1);
  PyObject *__pyx_v_branch_mode = ((PyObject *)__pyx_n_s__none);
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("iterkeys");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_recursive = __pyx_optional_args->recursive;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_branch_mode = __pyx_optional_args->branch_mode;
      }
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__iterkeys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_iterkeys)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recursive); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3589; __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_INCREF(__pyx_v_branch_mode);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_branch_mode);
      __Pyx_GIVEREF(__pyx_v_branch_mode);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8treedict_8treedict_TreeDictIterator))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3629
 *         """
 * 
 *         return self._getIter(recursive, self._getBranchMode(branch_mode), i_Keys)             # <<<<<<<<<<<<<<
 * 
 *     cpdef TreeDictIterator iterbranches(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getBranchMode(__pyx_v_self, __pyx_v_branch_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getIter(__pyx_v_self, __pyx_v_recursive, __pyx_t_4, 2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.iterkeys");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3589
 *         return self.iterkeys()
 * 
 *     cpdef TreeDictIterator iterkeys(self, bint recursive = True, branch_mode = 'none'):             # <<<<<<<<<<<<<<
 *         """
 *         Returns an iterator that returns keys for nodes in the tree.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_iterkeys(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_iterkeys[] = "\n        Returns an iterator that returns keys for nodes in the tree.\n        If recursive is True, then it iterates through all nodes in\n        this branch and in all subtrees.  Keys are returned with their\n        full path names, e.g. 'foo.bar'.\n\n        If branch_mode is 'none' (default), the branches are ignored\n        and all the items associated with values are returned.\n\n        If branch_mode is 'all', all items in the current tree\n        are returned.\n\n        If branch_mode is 'only', then only the branches are returned.\n\n        Example::\n\n            >>> from treedict import TreeDict\n            >>> t = TreeDict() ; t.set('b.x', 1, 'b.c.y', 2, x = 1)\n            >>> print t.makeReport()\n            b.x   = 1\n            b.c.y = 2\n            x     = 1\n            >>> list(t.iterkeys())\n            ['x', 'b.x', 'b.c.y']\n            >>> list(t.iterkeys(recursive=False))\n            ['x']\n            >>> list(t.iterkeys(recursive=False, branch_mode='none'))\n            ['x']\n            >>> list(t.iterkeys(recursive=False, branch_mode='only'))\n            ['b']\n            >>> list(t.iterkeys(recursive=False, branch_mode='all'))\n            ['x', 'b']\n            >>> list(t.iterkeys(recursive=True, branch_mode='only'))\n            ['b', 'b.c']\n            >>> list(t.iterkeys(recursive=True, branch_mode='all'))\n            ['x', 'b', 'b.x', 'b.c', 'b.c.y']\n            \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_iterkeys(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_recursive;
  PyObject *__pyx_v_branch_mode = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8treedict_8treedict_8TreeDict_iterkeys __pyx_t_2;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__recursive,&__pyx_n_s__branch_mode,0};
  __Pyx_RefNannySetupContext("iterkeys");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_n_s__none);
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recursive);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__branch_mode);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "iterkeys") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3589; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_recursive = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3589; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_recursive = ((int)1);
    }
    __pyx_v_branch_mode = values[1];
  } else {
    __pyx_v_recursive = ((int)1);
    __pyx_v_branch_mode = ((PyObject *)__pyx_n_s__none);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_branch_mode = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_recursive = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3589; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("iterkeys", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3589; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.iterkeys");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.recursive = __pyx_v_recursive;
  __pyx_t_2.branch_mode = __pyx_v_branch_mode;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->iterkeys(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.iterkeys");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3631
 *         return self._getIter(recursive, self._getBranchMode(branch_mode), i_Keys)
 * 
 *     cpdef TreeDictIterator iterbranches(self):             # <<<<<<<<<<<<<<
 *         """
 *         A convenience function; iterates through all of the local
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_iterbranches(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_f_8treedict_8treedict_8TreeDict_iterbranches(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("iterbranches");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__iterbranches); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8treedict_8treedict_8TreeDict_iterbranches)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8treedict_8treedict_TreeDictIterator))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3652
 *         """
 * 
 *         return self._getIter(False, self._getBranchMode('only'), i_Values)             # <<<<<<<<<<<<<<
 * 
 *     cdef list _getListFromIter(self, TreeDictIterator pti):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getBranchMode(__pyx_v_self, ((PyObject *)__pyx_n_s__only)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_getIter(__pyx_v_self, 0, __pyx_t_3, 3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.iterbranches");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3631
 *         return self._getIter(recursive, self._getBranchMode(branch_mode), i_Keys)
 * 
 *     cpdef TreeDictIterator iterbranches(self):             # <<<<<<<<<<<<<<
 *         """
 *         A convenience function; iterates through all of the local
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_iterbranches(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_iterbranches[] = "\n        A convenience function; iterates through all of the local\n        branches.  Equivalent to itervalues(recursive=False,\n        branch_mode='only').\n\n        Example::\n        \n            >>> from treedict import TreeDict\n            >>> t = TreeDict()\n            >>> t.set('a.b', 1, 'b.c', 2, x = 1, y = 2)\n            >>> print t.makeReport()\n            a.b = 1\n            b.c = 2\n            y   = 2\n            x   = 1\n            >>> list(t.iterbranches())\n            [TreeDict <root.a>, TreeDict <root.b>]\n       \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_iterbranches(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("iterbranches");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->iterbranches(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.iterbranches");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3654
 *         return self._getIter(False, self._getBranchMode('only'), i_Values)
 * 
 *     cdef list _getListFromIter(self, TreeDictIterator pti):             # <<<<<<<<<<<<<<
 *         # Fast as possible
 *         cdef bint recursive = pti._recursive
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__getListFromIter(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_pti) {
  int __pyx_v_recursive;
  int __pyx_v_branch_mode;
  size_t __pyx_v_n;
  PyObject *__pyx_v_l = 0;
  size_t __pyx_v_i;
  int __pyx_v_r;
  PyObject *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1;
  size_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_getListFromIter");
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3656
 *     cdef list _getListFromIter(self, TreeDictIterator pti):
 *         # Fast as possible
 *         cdef bint recursive = pti._recursive             # <<<<<<<<<<<<<<
 *         cdef int branch_mode = pti._branch_mode
 * 
 */
  __pyx_v_recursive = __pyx_v_pti->_recursive;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3657
 *         # Fast as possible
 *         cdef bint recursive = pti._recursive
 *         cdef int branch_mode = pti._branch_mode             # <<<<<<<<<<<<<<
 * 
 *         cdef size_t n = self._size(recursive, branch_mode)
 */
  __pyx_v_branch_mode = __pyx_v_pti->_branch_mode;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3659
 *         cdef int branch_mode = pti._branch_mode
 * 
 *         cdef size_t n = self._size(recursive, branch_mode)             # <<<<<<<<<<<<<<
 * 
 *         cdef list l = <list>PyList_New(n)
 */
  __pyx_v_n = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_self->__pyx_vtab)->_size(__pyx_v_self, __pyx_v_recursive, __pyx_v_branch_mode);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3661
 *         cdef size_t n = self._size(recursive, branch_mode)
 * 
 *         cdef list l = <list>PyList_New(n)             # <<<<<<<<<<<<<<
 *         cdef size_t i
 *         cdef bint r
 */
  __pyx_t_1 = PyList_New(__pyx_v_n);
  __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_t_1)));
  __pyx_v_l = ((PyObject *)__pyx_t_1);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3665
 *         cdef bint r
 * 
 *         for 0 <= i < n:             # <<<<<<<<<<<<<<
 * 
 *             r = pti._loadNext()
 */
  __pyx_t_2 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3667
 *         for 0 <= i < n:
 * 
 *             r = pti._loadNext()             # <<<<<<<<<<<<<<
 * 
 *             if RUN_ASSERTS:
 */
    __pyx_v_r = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_pti->__pyx_vtab)->_loadNext(__pyx_v_pti);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3672
 *                 assert r
 * 
 *             v = pti._currentRetValue()             # <<<<<<<<<<<<<<
 * 
 *             # Because we're using a temporary, and PyList_SetItem
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_pti->__pyx_vtab)->_currentRetValue(__pyx_v_pti); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_v);
    __pyx_v_v = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3678
 *             # we have to incref
 * 
 *             Py_INCREF(<PyObject*>v)             # <<<<<<<<<<<<<<
 *             PyList_SET_ITEM(l, i, <PyObject*>v)
 * 
 */
    Py_INCREF(((PyObject *)__pyx_v_v));

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3679
 * 
 *             Py_INCREF(<PyObject*>v)
 *             PyList_SET_ITEM(l, i, <PyObject*>v)             # <<<<<<<<<<<<<<
 * 
 *         if RUN_ASSERTS:
 */
    PyList_SET_ITEM(__pyx_v_l, __pyx_v_i, ((PyObject *)__pyx_v_v));
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3684
 *             assert not pti._loadNext()
 * 
 *         return l             # <<<<<<<<<<<<<<
 * 
 *     def items(self, bint recursive = True, branch_mode = 'none'):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_l));
  __pyx_r = __pyx_v_l;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._getListFromIter");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3686
 *         return l
 * 
 *     def items(self, bint recursive = True, branch_mode = 'none'):             # <<<<<<<<<<<<<<
 *         """
 *         Identical to :meth:`iteritems()`, but returns a list instead
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_items(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_items[] = "\n        Identical to :meth:`iteritems()`, but returns a list instead\n        of an iterator.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_items(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_recursive;
  PyObject *__pyx_v_branch_mode = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8treedict_8treedict_8TreeDict_iteritems __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__recursive,&__pyx_n_s__branch_mode,0};
  __Pyx_RefNannySetupContext("items");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_n_s__none);
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recursive);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__branch_mode);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "items") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3686; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_recursive = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3686; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_recursive = ((int)1);
    }
    __pyx_v_branch_mode = values[1];
  } else {
    __pyx_v_recursive = ((int)1);
    __pyx_v_branch_mode = ((PyObject *)__pyx_n_s__none);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_branch_mode = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_recursive = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3686; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("items", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3686; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.items");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3692
 *         """
 * 
 *         return self._getListFromIter(self.iteritems(recursive, branch_mode))             # <<<<<<<<<<<<<<
 * 
 *     def values(self, bint recursive = True, branch_mode = 'none'):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.recursive = __pyx_v_recursive;
  __pyx_t_2.branch_mode = __pyx_v_branch_mode;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->iteritems(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_getListFromIter(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_1))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.items");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3694
 *         return self._getListFromIter(self.iteritems(recursive, branch_mode))
 * 
 *     def values(self, bint recursive = True, branch_mode = 'none'):             # <<<<<<<<<<<<<<
 *         """
 *         Identical to :meth:`itervalues()`, but returns a list instead
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_values[] = "\n        Identical to :meth:`itervalues()`, but returns a list instead\n        of an iterator.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_recursive;
  PyObject *__pyx_v_branch_mode = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8treedict_8treedict_8TreeDict_itervalues __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__recursive,&__pyx_n_s__branch_mode,0};
  __Pyx_RefNannySetupContext("values");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_n_s__none);
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recursive);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__branch_mode);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "values") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3694; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_recursive = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3694; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_recursive = ((int)1);
    }
    __pyx_v_branch_mode = values[1];
  } else {
    __pyx_v_recursive = ((int)1);
    __pyx_v_branch_mode = ((PyObject *)__pyx_n_s__none);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_branch_mode = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_recursive = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3694; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("values", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3694; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.values");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3700
 *         """
 * 
 *         return self._getListFromIter(self.itervalues(recursive, branch_mode))             # <<<<<<<<<<<<<<
 * 
 *     def keys(self, bint recursive = True, branch_mode = 'none'):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.recursive = __pyx_v_recursive;
  __pyx_t_2.branch_mode = __pyx_v_branch_mode;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->itervalues(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_getListFromIter(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_1))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.values");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3702
 *         return self._getListFromIter(self.itervalues(recursive, branch_mode))
 * 
 *     def keys(self, bint recursive = True, branch_mode = 'none'):             # <<<<<<<<<<<<<<
 *         """
 *         Identical to :meth:`iterkeys()`, but returns a list instead of
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_keys(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_keys[] = "\n        Identical to :meth:`iterkeys()`, but returns a list instead of\n        an iterator.\n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_keys(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_recursive;
  PyObject *__pyx_v_branch_mode = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8treedict_8treedict_8TreeDict_iterkeys __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__recursive,&__pyx_n_s__branch_mode,0};
  __Pyx_RefNannySetupContext("keys");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_n_s__none);
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recursive);
        if (value) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__branch_mode);
        if (value) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "keys") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3702; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_recursive = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3702; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_recursive = ((int)1);
    }
    __pyx_v_branch_mode = values[1];
  } else {
    __pyx_v_recursive = ((int)1);
    __pyx_v_branch_mode = ((PyObject *)__pyx_n_s__none);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_branch_mode = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_recursive = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3702; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("keys", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3702; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.keys");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3708
 *         """
 * 
 *         return self._getListFromIter(self.iterkeys(recursive, branch_mode))             # <<<<<<<<<<<<<<
 * 
 *     def branches(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.recursive = __pyx_v_recursive;
  __pyx_t_2.branch_mode = __pyx_v_branch_mode;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->iterkeys(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_getListFromIter(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_1))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.keys");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3710
 *         return self._getListFromIter(self.iterkeys(recursive, branch_mode))
 * 
 *     def branches(self):             # <<<<<<<<<<<<<<
 *         """
 *         Identical to :meth:`iterbranches()`, but returns a list
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_branches(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_branches[] = "\n        Identical to :meth:`iterbranches()`, but returns a list\n        instead of an iterator.\n\n        Example::\n        \n            >>> from treedict import TreeDict\n            >>> t = TreeDict()\n            >>> t.set('a.b', 1, 'b.c', 2, x = 1, y = 2)\n            >>> print t.makeReport()\n            a.b = 1\n            b.c = 2\n            y   = 2\n            x   = 1\n            >>> t.branches()\n            [TreeDict <root.a>, TreeDict <root.b>]\n       \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_branches(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("branches");

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3729
 * 
 *         """
 *         return self._getListFromIter(self.iterbranches())             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->iterbranches(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_getListFromIter(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_1))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3729; __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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.branches");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3735
 *     # Methods relating to testing on this class
 * 
 *     def getClosestKey(self, str key, int n = 0, bint recursive = True, branch_mode = 'none'):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the closest match(s) in the tree to the key `key`.
 */

static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_getClosestKey(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8treedict_8treedict_8TreeDict_getClosestKey[] = "\n        Returns the closest match(s) in the tree to the key `key`.\n\n        If ``n >= 1``, then a list of the `n` closest strings is\n        returned.  If ``n <= 0``, then a single string, the closest\n        match, is returned.  The search algorithm is faster for\n        ``n=0`` or ``n=1``.\n\n        The optional behavior is just like with the iterators, with\n        the default being to examine, recursively, the keys of all\n        leaves for close matches.\n\n        The algorithm used is based on the closest edit distance to\n        the query key `key`, with extra weighting given to branch\n        boundaries.\n\n        Example::\n\n            >>> t = TreeDict()\n            >>> t.alpha.x1 = 1\n            >>> t.alpha.y1 = 1\n            >>> t.alpha.zzz = 1\n            >>> t.beta.x = 1\n            >>> t.gamma.beta = 1\n            >>> \"alpah.x\" in t\n            False\n            >>> t.getClosestKey(\"alpah.x\")\n            'alpha.x1'\n            >>> t.getClosestKey(\"alpah.x\", 1)\n            ['alpha.x1']\n            >>> t.getClosestKey(\"alpah.x\", 3)\n            ['alpha.x1', 'beta.x', 'alpha.y1']\n           \n        ";
static PyObject *__pyx_pf_8treedict_8treedict_8TreeDict_getClosestKey(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  int __pyx_v_n;
  int __pyx_v_recursive;
  PyObject *__pyx_v_branch_mode = 0;
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_pti = 0;
  struct __pyx_t_8treedict_10membuffers_size_t_v __pyx_v_buf;
  PyObject *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8treedict_8treedict_8TreeDict_iterkeys __pyx_t_2;
  int __pyx_t_3;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__n,&__pyx_n_s__recursive,&__pyx_n_s__branch_mode,0};
  __Pyx_RefNannySetupContext("getClosestKey");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)__pyx_n_s__none);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n);
        if (value) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recursive);
        if (value) { values[2] = value; kw_args--; }
      }
      case  3:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__branch_mode);
        if (value) { values[3] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "getClosestKey") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3735; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_key = ((PyObject *)values[0]);
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3735; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_n = ((int)0);
    }
    if (values[2]) {
      __pyx_v_recursive = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3735; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_recursive = ((int)1);
    }
    __pyx_v_branch_mode = values[3];
  } else {
    __pyx_v_n = ((int)0);
    __pyx_v_recursive = ((int)1);
    __pyx_v_branch_mode = ((PyObject *)__pyx_n_s__none);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: __pyx_v_branch_mode = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: __pyx_v_recursive = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_recursive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3735; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  2: __pyx_v_n = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3735; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_key = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getClosestKey", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3735; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.TreeDict.getClosestKey");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), &PyString_Type, 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3771
 *         """
 * 
 *         checkKeyNotNone(key)             # <<<<<<<<<<<<<<
 * 
 *         cdef TreeDictIterator pti = self.iterkeys(recursive, branch_mode)
 */
  __pyx_t_1 = __pyx_f_8treedict_8treedict_checkKeyNotNone(__pyx_v_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3773
 *         checkKeyNotNone(key)
 * 
 *         cdef TreeDictIterator pti = self.iterkeys(recursive, branch_mode)             # <<<<<<<<<<<<<<
 * 
 *         cdef size_t_v buf = new_size_t_v(100)
 */
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.recursive = __pyx_v_recursive;
  __pyx_t_2.branch_mode = __pyx_v_branch_mode;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->iterkeys(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pti = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3775
 *         cdef TreeDictIterator pti = self.iterkeys(recursive, branch_mode)
 * 
 *         cdef size_t_v buf = new_size_t_v(100)             # <<<<<<<<<<<<<<
 * 
 *         if buf.d == NULL:
 */
  __pyx_v_buf = __pyx_f_8treedict_10membuffers_new_size_t_v(100);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3777
 *         cdef size_t_v buf = new_size_t_v(100)
 * 
 *         if buf.d == NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError
 * 
 */
  __pyx_t_3 = (__pyx_v_buf.d == NULL);
  if (__pyx_t_3) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3778
 * 
 *         if buf.d == NULL:
 *             raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __Pyx_Raise(__pyx_builtin_MemoryError, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3780
 *             raise MemoryError
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if n <= 0:
 *                 return self._getSingleClosest(key, pti, &buf)
 */
  /*try:*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3781
 * 
 *         try:
 *             if n <= 0:             # <<<<<<<<<<<<<<
 *                 return self._getSingleClosest(key, pti, &buf)
 *             elif n == 1:
 */
    __pyx_t_3 = (__pyx_v_n <= 0);
    if (__pyx_t_3) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3782
 *         try:
 *             if n <= 0:
 *                 return self._getSingleClosest(key, pti, &buf)             # <<<<<<<<<<<<<<
 *             elif n == 1:
 *                 v = self._getSingleClosest(key, pti, &buf)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_getSingleClosest(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key, __pyx_v_pti, (&__pyx_v_buf))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3782; __pyx_clineno = __LINE__; goto __pyx_L8;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L7;
      goto __pyx_L10;
    }

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3783
 *             if n <= 0:
 *                 return self._getSingleClosest(key, pti, &buf)
 *             elif n == 1:             # <<<<<<<<<<<<<<
 *                 v = self._getSingleClosest(key, pti, &buf)
 *                 if v is None:
 */
    __pyx_t_3 = (__pyx_v_n == 1);
    if (__pyx_t_3) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3784
 *                 return self._getSingleClosest(key, pti, &buf)
 *             elif n == 1:
 *                 v = self._getSingleClosest(key, pti, &buf)             # <<<<<<<<<<<<<<
 *                 if v is None:
 *                     return []
 */
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_getSingleClosest(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key, __pyx_v_pti, (&__pyx_v_buf))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3784; __pyx_clineno = __LINE__; goto __pyx_L8;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3785
 *             elif n == 1:
 *                 v = self._getSingleClosest(key, pti, &buf)
 *                 if v is None:             # <<<<<<<<<<<<<<
 *                     return []
 *                 else:
 */
      __pyx_t_3 = (__pyx_v_v == Py_None);
      if (__pyx_t_3) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3786
 *                 v = self._getSingleClosest(key, pti, &buf)
 *                 if v is None:
 *                     return []             # <<<<<<<<<<<<<<
 *                 else:
 *                     return [v]
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3786; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __pyx_r = ((PyObject *)__pyx_t_1);
        __pyx_t_1 = 0;
        goto __pyx_L7;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3788
 *                     return []
 *                 else:
 *                     return [v]             # <<<<<<<<<<<<<<
 *             else:
 *                 return self._getListOfClosest(key, <size_t>n, pti, &buf)
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3788; __pyx_clineno = __LINE__; goto __pyx_L8;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __Pyx_INCREF(__pyx_v_v);
        PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_v);
        __Pyx_GIVEREF(__pyx_v_v);
        __pyx_r = ((PyObject *)__pyx_t_1);
        __pyx_t_1 = 0;
        goto __pyx_L7;
      }
      __pyx_L11:;
      goto __pyx_L10;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3790
 *                     return [v]
 *             else:
 *                 return self._getListOfClosest(key, <size_t>n, pti, &buf)             # <<<<<<<<<<<<<<
 *         finally:
 *             free_size_t_v(&buf)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self)->__pyx_vtab)->_getListOfClosest(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_v_self), __pyx_v_key, ((size_t)__pyx_v_n), __pyx_v_pti, (&__pyx_v_buf))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3790; __pyx_clineno = __LINE__; goto __pyx_L8;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L7;
    }
    __pyx_L10:;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3792
 *                 return self._getListOfClosest(key, <size_t>n, pti, &buf)
 *         finally:
 *             free_size_t_v(&buf)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L9;
    __pyx_L7: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 3; goto __pyx_L9;
    __pyx_L8: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L9;
    }
    __pyx_L9:;
    __pyx_f_8treedict_10membuffers_free_size_t_v((&__pyx_v_buf));
    switch (__pyx_why) {
      case 3: goto __pyx_L0;
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.TreeDict.getClosestKey");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pti);
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3795
 * 
 * 
 *     cdef list _getListOfClosest(self, str key, size_t n, TreeDictIterator pti, size_t_v *bufp):             # <<<<<<<<<<<<<<
 * 
 *         cdef str k
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__getListOfClosest(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_key, size_t __pyx_v_n, struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_pti, struct __pyx_t_8treedict_10membuffers_size_t_v *__pyx_v_bufp) {
  PyObject *__pyx_v_k;
  long __pyx_v_cost;
  long __pyx_v_highest_cost_cutoff;
  size_t __pyx_v_n_els;
  PyObject *__pyx_v_t;
  PyObject *__pyx_v_kl = 0;
  size_t __pyx_v_i;
  PyObject *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  long __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  size_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("_getListOfClosest");
  __pyx_v_k = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_t = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3798
 * 
 *         cdef str k
 *         cdef long cost, highest_cost_cutoff = -(2**(sizeof(long) - 2) )             # <<<<<<<<<<<<<<
 *         cdef size_t n_els = 0
 *         cdef tuple t
 */
  __pyx_v_highest_cost_cutoff = (-__Pyx_pow_size_t(((size_t)2), ((sizeof(long)) - 2)));

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3799
 *         cdef str k
 *         cdef long cost, highest_cost_cutoff = -(2**(sizeof(long) - 2) )
 *         cdef size_t n_els = 0             # <<<<<<<<<<<<<<
 *         cdef tuple t
 *         cdef list kl = []
 */
  __pyx_v_n_els = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3801
 *         cdef size_t n_els = 0
 *         cdef tuple t
 *         cdef list kl = []             # <<<<<<<<<<<<<<
 * 
 *         while True:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_kl = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3803
 *         cdef list kl = []
 * 
 *         while True:             # <<<<<<<<<<<<<<
 *             if not pti._loadNext():
 *                 break
 */
  while (1) {
    if (!1) break;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3804
 * 
 *         while True:
 *             if not pti._loadNext():             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
    __pyx_t_2 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_pti->__pyx_vtab)->_loadNext(__pyx_v_pti));
    if (__pyx_t_2) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3805
 *         while True:
 *             if not pti._loadNext():
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             k = pti.currentKey()
 */
      goto __pyx_L4_break;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3807
 *                 break
 * 
 *             k = pti.currentKey()             # <<<<<<<<<<<<<<
 *             cost = name_match_distance(bufp, key, k)
 * 
 */
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_pti->__pyx_vtab)->currentKey(__pyx_v_pti)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_v_k));
    __pyx_v_k = ((PyObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3808
 * 
 *             k = pti.currentKey()
 *             cost = name_match_distance(bufp, key, k)             # <<<<<<<<<<<<<<
 * 
 *             # put it on the heap; use -cost so pop gets rid of the
 */
    __pyx_v_cost = __pyx_f_8treedict_13name_matching_name_match_distance(__pyx_v_bufp, __pyx_v_key, __pyx_v_k);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3812
 *             # put it on the heap; use -cost so pop gets rid of the
 *             # highest cost one.
 *             if n_els < n:             # <<<<<<<<<<<<<<
 *                 heappush(kl, (-cost, k) )
 * 
 */
    __pyx_t_2 = (__pyx_v_n_els < __pyx_v_n);
    if (__pyx_t_2) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3813
 *             # highest cost one.
 *             if n_els < n:
 *                 heappush(kl, (-cost, k) )             # <<<<<<<<<<<<<<
 * 
 *                 if cost > highest_cost_cutoff:
 */
      __pyx_t_1 = PyInt_FromLong((-__pyx_v_cost)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)__pyx_v_k));
      PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_k));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_k));
      __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)__pyx_v_kl));
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_kl));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_kl));
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_v_8treedict_8treedict_heappush, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3815
 *                 heappush(kl, (-cost, k) )
 * 
 *                 if cost > highest_cost_cutoff:             # <<<<<<<<<<<<<<
 *                     highest_cost_cutoff = cost
 * 
 */
      __pyx_t_2 = (__pyx_v_cost > __pyx_v_highest_cost_cutoff);
      if (__pyx_t_2) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3816
 * 
 *                 if cost > highest_cost_cutoff:
 *                     highest_cost_cutoff = cost             # <<<<<<<<<<<<<<
 * 
 *                 n_els += 1
 */
        __pyx_v_highest_cost_cutoff = __pyx_v_cost;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3818
 *                     highest_cost_cutoff = cost
 * 
 *                 n_els += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 if cost < highest_cost_cutoff:
 */
      __pyx_v_n_els += 1;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3820
 *                 n_els += 1
 *             else:
 *                 if cost < highest_cost_cutoff:             # <<<<<<<<<<<<<<
 *                     t = <tuple>heapreplace(kl, (-cost, k) )
 * 
 */
      __pyx_t_2 = (__pyx_v_cost < __pyx_v_highest_cost_cutoff);
      if (__pyx_t_2) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3821
 *             else:
 *                 if cost < highest_cost_cutoff:
 *                     t = <tuple>heapreplace(kl, (-cost, k) )             # <<<<<<<<<<<<<<
 * 
 *                     highest_cost_cutoff = min2_long(highest_cost_cutoff,
 */
        __pyx_t_3 = PyInt_FromLong((-__pyx_v_cost)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_v_k));
        PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_k));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_k));
        __pyx_t_3 = 0;
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_v_kl));
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_kl));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_kl));
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_v_8treedict_8treedict_heapreplace, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_t_1)));
        __Pyx_DECREF(((PyObject *)__pyx_v_t));
        __pyx_v_t = ((PyObject *)__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3824
 * 
 *                     highest_cost_cutoff = min2_long(highest_cost_cutoff,
 *                                                     max2_long(-(<long>(t[0])), cost))             # <<<<<<<<<<<<<<
 * 
 *         cdef size_t i
 */
        __pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_t), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_highest_cost_cutoff = __pyx_f_8treedict_9minsmaxes_min2_long(__pyx_v_highest_cost_cutoff, __pyx_f_8treedict_9minsmaxes_max2_long((-__pyx_t_4), __pyx_v_cost));
        goto __pyx_L8;
      }
      __pyx_L8:;
    }
    __pyx_L6:;
  }
  __pyx_L4_break:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3828
 *         cdef size_t i
 * 
 *         return [k for v, k in             # <<<<<<<<<<<<<<
 *                 reversed([heappop(kl) for i in range(len(kl))])]
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3829
 * 
 *         return [k for v, k in
 *                 reversed([heappop(kl) for i in range(len(kl))])]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (unlikely(__pyx_v_kl == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_kl)); 
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)__pyx_v_kl));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_kl));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_kl));
    __pyx_t_9 = PyObject_Call(__pyx_v_8treedict_8treedict_heappop, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_9))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_builtin_reversed, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_5 = 0; __pyx_t_9 = __pyx_t_3; __Pyx_INCREF(__pyx_t_9);
  } else {
    __pyx_t_5 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_9))) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_9)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_9))) {
      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
    } else {
      __pyx_t_3 = PyIter_Next(__pyx_t_9);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
      PyObject* tuple = __pyx_t_3;
      __pyx_t_8 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_8);
      __pyx_t_10 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_10);

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3828
 *         cdef size_t i
 * 
 *         return [k for v, k in             # <<<<<<<<<<<<<<
 *                 reversed([heappop(kl) for i in range(len(kl))])]
 * 
 */
      if (!(likely(PyString_CheckExact(__pyx_t_10))||((__pyx_t_10) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_10)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_8;
      __pyx_t_8 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_k));
      __pyx_v_k = ((PyObject *)__pyx_t_10);
      __pyx_t_10 = 0;
    } else {
      __pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_11, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = __Pyx_UnpackItem(__pyx_t_11, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      if (!(likely(PyString_CheckExact(__pyx_t_10))||((__pyx_t_10) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_10)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__Pyx_EndUnpack(__pyx_t_11, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_8;
      __pyx_t_8 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_k));
      __pyx_v_k = ((PyObject *)__pyx_t_10);
      __pyx_t_10 = 0;
    }
    if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_v_k))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_t_1));
  __pyx_r = __pyx_t_1;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._getListOfClosest");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_DECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_kl);
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3832
 * 
 * 
 *     cdef str _getSingleClosest(self, str key, TreeDictIterator pti, size_t_v *bufp):             # <<<<<<<<<<<<<<
 * 
 *         cdef str k, best_match = None
 */

static  PyObject *__pyx_f_8treedict_8treedict_8TreeDict__getSingleClosest(struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_self, PyObject *__pyx_v_key, struct __pyx_obj_8treedict_8treedict_TreeDictIterator *__pyx_v_pti, struct __pyx_t_8treedict_10membuffers_size_t_v *__pyx_v_bufp) {
  PyObject *__pyx_v_k;
  PyObject *__pyx_v_best_match = 0;
  long __pyx_v_cost;
  long __pyx_v_best_cost;
  int __pyx_v_first;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_getSingleClosest");
  __pyx_v_k = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3834
 *     cdef str _getSingleClosest(self, str key, TreeDictIterator pti, size_t_v *bufp):
 * 
 *         cdef str k, best_match = None             # <<<<<<<<<<<<<<
 *         cdef long cost = 0, best_cost = -(2**(sizeof(long) - 2) )
 *         cdef bint first = True
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_best_match = ((PyObject *)Py_None);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3835
 * 
 *         cdef str k, best_match = None
 *         cdef long cost = 0, best_cost = -(2**(sizeof(long) - 2) )             # <<<<<<<<<<<<<<
 *         cdef bint first = True
 * 
 */
  __pyx_v_cost = 0;
  __pyx_v_best_cost = (-__Pyx_pow_size_t(((size_t)2), ((sizeof(long)) - 2)));

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3836
 *         cdef str k, best_match = None
 *         cdef long cost = 0, best_cost = -(2**(sizeof(long) - 2) )
 *         cdef bint first = True             # <<<<<<<<<<<<<<
 * 
 *         while True:
 */
  __pyx_v_first = 1;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3838
 *         cdef bint first = True
 * 
 *         while True:             # <<<<<<<<<<<<<<
 *             if not pti._loadNext():
 *                 break
 */
  while (1) {
    if (!1) break;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3839
 * 
 *         while True:
 *             if not pti._loadNext():             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
    __pyx_t_1 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_pti->__pyx_vtab)->_loadNext(__pyx_v_pti));
    if (__pyx_t_1) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3840
 *         while True:
 *             if not pti._loadNext():
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             k = pti.currentKey()
 */
      goto __pyx_L4_break;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3842
 *                 break
 * 
 *             k = pti.currentKey()             # <<<<<<<<<<<<<<
 *             cost = name_match_distance(bufp, key, k)
 * 
 */
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator *)__pyx_v_pti->__pyx_vtab)->currentKey(__pyx_v_pti)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_k));
    __pyx_v_k = ((PyObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3843
 * 
 *             k = pti.currentKey()
 *             cost = name_match_distance(bufp, key, k)             # <<<<<<<<<<<<<<
 * 
 *             if first or cost < best_cost:
 */
    __pyx_v_cost = __pyx_f_8treedict_13name_matching_name_match_distance(__pyx_v_bufp, __pyx_v_key, __pyx_v_k);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3845
 *             cost = name_match_distance(bufp, key, k)
 * 
 *             if first or cost < best_cost:             # <<<<<<<<<<<<<<
 *                 first      = False
 *                 best_cost  = cost
 */
    if (!__pyx_v_first) {
      __pyx_t_1 = (__pyx_v_cost < __pyx_v_best_cost);
      __pyx_t_3 = __pyx_t_1;
    } else {
      __pyx_t_3 = __pyx_v_first;
    }
    if (__pyx_t_3) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3846
 * 
 *             if first or cost < best_cost:
 *                 first      = False             # <<<<<<<<<<<<<<
 *                 best_cost  = cost
 *                 best_match = k
 */
      __pyx_v_first = 0;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3847
 *             if first or cost < best_cost:
 *                 first      = False
 *                 best_cost  = cost             # <<<<<<<<<<<<<<
 *                 best_match = k
 * 
 */
      __pyx_v_best_cost = __pyx_v_cost;

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3848
 *                 first      = False
 *                 best_cost  = cost
 *                 best_match = k             # <<<<<<<<<<<<<<
 * 
 *         return best_match
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_k));
      __Pyx_DECREF(((PyObject *)__pyx_v_best_match));
      __pyx_v_best_match = __pyx_v_k;
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __pyx_L4_break:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3850
 *                 best_match = k
 * 
 *         return best_match             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_best_match));
  __pyx_r = __pyx_v_best_match;
  goto __pyx_L0;

  __pyx_r = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("treedict.treedict.TreeDict._getSingleClosest");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_best_match);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3857
 * 
 * 
 * def _TreeDict_unpickler(             # <<<<<<<<<<<<<<
 *     name, dict param_dict, flagtype _flags, dict aux_dict,
 *     size_t _n_mutable, size_t _next_item_order_position, size_t _n_dangling):
 */

static PyObject *__pyx_pf_8treedict_8treedict__TreeDict_unpickler(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict__TreeDict_unpickler(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_param_dict = 0;
  __pyx_t_8treedict_8treedict_flagtype __pyx_v__flags;
  PyObject *__pyx_v_aux_dict = 0;
  size_t __pyx_v__n_mutable;
  size_t __pyx_v__next_item_order_position;
  size_t __pyx_v__n_dangling;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_b;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_p = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__param_dict,&__pyx_n_s___flags,&__pyx_n_s__aux_dict,&__pyx_n_s___n_mutable,&__pyx_n_s_12,&__pyx_n_s___n_dangling,0};
  __Pyx_RefNannySetupContext("_TreeDict_unpickler");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[7] = {0,0,0,0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__param_dict);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_TreeDict_unpickler", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3857; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___flags);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_TreeDict_unpickler", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3857; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__aux_dict);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_TreeDict_unpickler", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3857; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  4:
      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___n_mutable);
      if (likely(values[4])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_TreeDict_unpickler", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3857; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  5:
      values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_12);
      if (likely(values[5])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_TreeDict_unpickler", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3857; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  6:
      values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___n_dangling);
      if (likely(values[6])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_TreeDict_unpickler", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3857; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_TreeDict_unpickler") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3857; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_name = values[0];
    __pyx_v_param_dict = ((PyObject *)values[1]);
    __pyx_v__flags = __Pyx_PyInt_AsUnsignedLong(values[2]); if (unlikely((__pyx_v__flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3858; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_aux_dict = ((PyObject *)values[3]);
    __pyx_v__n_mutable = __Pyx_PyInt_AsSize_t(values[4]); if (unlikely((__pyx_v__n_mutable == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v__next_item_order_position = __Pyx_PyInt_AsSize_t(values[5]); if (unlikely((__pyx_v__next_item_order_position == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v__n_dangling = __Pyx_PyInt_AsSize_t(values[6]); if (unlikely((__pyx_v__n_dangling == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_name = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_param_dict = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 1));
    __pyx_v__flags = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v__flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3858; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_aux_dict = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 3));
    __pyx_v__n_mutable = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v__n_mutable == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v__next_item_order_position = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v__next_item_order_position == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v__n_dangling = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v__n_dangling == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3859; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_TreeDict_unpickler", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3857; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict._TreeDict_unpickler");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_b = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_param_dict), &PyDict_Type, 1, "param_dict", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_aux_dict), &PyDict_Type, 1, "aux_dict", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3861
 *     size_t _n_mutable, size_t _next_item_order_position, size_t _n_dangling):
 * 
 *     cdef TreeDict b, p = newTreeDict(name, False)             # <<<<<<<<<<<<<<
 * 
 *     p._param_dict = param_dict
 */
  if (!(likely(PyString_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_name)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((PyObject *)__pyx_f_8treedict_8treedict_newTreeDict(((PyObject *)__pyx_v_name), 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3863
 *     cdef TreeDict b, p = newTreeDict(name, False)
 * 
 *     p._param_dict = param_dict             # <<<<<<<<<<<<<<
 *     p._flags = _flags
 *     p._aux_dict = aux_dict
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_param_dict));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_param_dict));
  __Pyx_GOTREF(__pyx_v_p->_param_dict);
  __Pyx_DECREF(((PyObject *)__pyx_v_p->_param_dict));
  __pyx_v_p->_param_dict = __pyx_v_param_dict;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3864
 * 
 *     p._param_dict = param_dict
 *     p._flags = _flags             # <<<<<<<<<<<<<<
 *     p._aux_dict = aux_dict
 *     p._n_mutable = _n_mutable
 */
  __pyx_v_p->_flags = __pyx_v__flags;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3865
 *     p._param_dict = param_dict
 *     p._flags = _flags
 *     p._aux_dict = aux_dict             # <<<<<<<<<<<<<<
 *     p._n_mutable = _n_mutable
 *     p._next_item_order_position = _next_item_order_position
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_aux_dict));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_aux_dict));
  __Pyx_GOTREF(__pyx_v_p->_aux_dict);
  __Pyx_DECREF(((PyObject *)__pyx_v_p->_aux_dict));
  __pyx_v_p->_aux_dict = __pyx_v_aux_dict;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3866
 *     p._flags = _flags
 *     p._aux_dict = aux_dict
 *     p._n_mutable = _n_mutable             # <<<<<<<<<<<<<<
 *     p._next_item_order_position = _next_item_order_position
 *     p._n_dangling = _n_dangling
 */
  __pyx_v_p->_n_mutable = __pyx_v__n_mutable;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3867
 *     p._aux_dict = aux_dict
 *     p._n_mutable = _n_mutable
 *     p._next_item_order_position = _next_item_order_position             # <<<<<<<<<<<<<<
 *     p._n_dangling = _n_dangling
 * 
 */
  __pyx_v_p->_next_item_order_position = __pyx_v__next_item_order_position;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3868
 *     p._n_mutable = _n_mutable
 *     p._next_item_order_position = _next_item_order_position
 *     p._n_dangling = _n_dangling             # <<<<<<<<<<<<<<
 * 
 *     p._reset_branches()
 */
  __pyx_v_p->_n_dangling = __pyx_v__n_dangling;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3870
 *     p._n_dangling = _n_dangling
 * 
 *     p._reset_branches()             # <<<<<<<<<<<<<<
 * 
 *     # Set up familial relations
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)__pyx_v_p->__pyx_vtab)->_reset_branches(__pyx_v_p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3873
 * 
 *     # Set up familial relations
 *     for b in p._branches:             # <<<<<<<<<<<<<<
 *         b._parent = p
 * 
 */
  if (likely(((PyObject *)__pyx_v_p->_branches) != Py_None)) {
    __pyx_t_2 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_p->_branches); __Pyx_INCREF(__pyx_t_1);
  } else {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_8treedict_8treedict_TreeDict))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_b));
    __pyx_v_b = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3874
 *     # Set up familial relations
 *     for b in p._branches:
 *         b._parent = p             # <<<<<<<<<<<<<<
 * 
 *     return p
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_p));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
    __Pyx_GOTREF(__pyx_v_b->_parent);
    __Pyx_DECREF(((PyObject *)__pyx_v_b->_parent));
    __pyx_v_b->_parent = __pyx_v_p;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3876
 *         b._parent = p
 * 
 *     return p             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_p));
  __pyx_r = ((PyObject *)__pyx_v_p);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict._TreeDict_unpickler");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_b);
  __Pyx_XDECREF((PyObject *)__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3948
 *     """
 * 
 *     def __init__(self, TreeDict ptree):             # <<<<<<<<<<<<<<
 * 
 *         # May be overridden
 */

static PyObject *__pyx_pf_8treedict_8treedict_19InteractiveTreeDict___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_8treedict_8treedict_19InteractiveTreeDict___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_8treedict_8treedict_19InteractiveTreeDict___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_8treedict_8treedict_19InteractiveTreeDict___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  struct __pyx_obj_8treedict_8treedict_TreeDict *__pyx_v_ptree = 0;
  PyObject *__pyx_v_k;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *__pyx_v_pn;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  void *__pyx_t_5;
  void *__pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__ptree,0};
  __Pyx_RefNannySetupContext("__init__");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ptree);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3948; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3948; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_ptree = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)values[1]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_ptree = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)PyTuple_GET_ITEM(__pyx_args, 1));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3948; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.InteractiveTreeDict.__init__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_k = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ptree), __pyx_ptype_8treedict_8treedict_TreeDict, 1, "ptree", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3951
 * 
 *         # May be overridden
 *         self._setAttrDirect("_original_param_tree", ptree)             # <<<<<<<<<<<<<<
 * 
 *         cdef str k
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___setAttrDirect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_s_77));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s_77));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_77));
  __Pyx_INCREF(((PyObject *)__pyx_v_ptree));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_ptree));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_ptree));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3956
 *         cdef _PTreeNode pn
 * 
 *         for k, pn in ptree._param_dict.iteritems():             # <<<<<<<<<<<<<<
 * 
 *             if pn.isBranch():
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_ptree->_param_dict));
  __Pyx_XDECREF(__pyx_t_3);
  __pyx_t_3 = ((PyObject *)__pyx_v_ptree->_param_dict);
  __pyx_t_4 = 0;
  while (1) {
    if (!PyDict_Next(__pyx_t_3, (&__pyx_t_4), ((PyObject **)(&__pyx_t_5)), ((PyObject **)(&__pyx_t_6)))) break;
    if (!(likely(PyString_CheckExact(((PyObject *)__pyx_t_5)))||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(((PyObject *)__pyx_t_5))->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_t_5)));
    __Pyx_DECREF(((PyObject *)__pyx_v_k));
    __pyx_v_k = ((PyObject *)__pyx_t_5);
    if (!(likely(__Pyx_TypeTest(((PyObject *)__pyx_t_6), __pyx_ptype_8treedict_8treedict__PTreeNode)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_6)));
    __Pyx_DECREF(((PyObject *)__pyx_v_pn));
    __pyx_v_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)__pyx_t_6);

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3958
 *         for k, pn in ptree._param_dict.iteritems():
 * 
 *             if pn.isBranch():             # <<<<<<<<<<<<<<
 *                 if not pn.tree().isDangling():
 *                     self._setAttrDirect(k, pn.tree().interactiveTree())
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->isBranch(__pyx_v_pn);
    if (__pyx_t_7) {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3959
 * 
 *             if pn.isBranch():
 *                 if not pn.tree().isDangling():             # <<<<<<<<<<<<<<
 *                     self._setAttrDirect(k, pn.tree().interactiveTree())
 *             else:
 */
      __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = (!((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2)->__pyx_vtab)->isDangling(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_2), 0));
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_7) {

        /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3960
 *             if pn.isBranch():
 *                 if not pn.tree().isDangling():
 *                     self._setAttrDirect(k, pn.tree().interactiveTree())             # <<<<<<<<<<<<<<
 *             else:
 *                 self._setAttrDirect(k, pn.value())
 */
        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___setAttrDirect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->tree(__pyx_v_pn)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1)->__pyx_vtab)->interactiveTree(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1), 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(((PyObject *)__pyx_v_k));
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_k));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_k));
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_8 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L9;
      }
      __pyx_L9:;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3962
 *                     self._setAttrDirect(k, pn.tree().interactiveTree())
 *             else:
 *                 self._setAttrDirect(k, pn.value())             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(ipt1, ipt2):
 */
      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___setAttrDirect); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = ((struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode *)__pyx_v_pn->__pyx_vtab)->value(__pyx_v_pn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_k));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_k));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_k));
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("treedict.treedict.InteractiveTreeDict.__init__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_DECREF((PyObject *)__pyx_v_pn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3964
 *                 self._setAttrDirect(k, pn.value())
 * 
 *     def __eq__(ipt1, ipt2):             # <<<<<<<<<<<<<<
 * 
 *         if not (isinstance(ipt1, InteractiveTreeDict) and isinstance(ipt2, InteractiveTreeDict)):
 */

static PyObject *__pyx_pf_8treedict_8treedict_19InteractiveTreeDict___eq__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_8treedict_8treedict_19InteractiveTreeDict___eq__ = {__Pyx_NAMESTR("__eq__"), (PyCFunction)__pyx_pf_8treedict_8treedict_19InteractiveTreeDict___eq__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_8treedict_8treedict_19InteractiveTreeDict___eq__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ipt1 = 0;
  PyObject *__pyx_v_ipt2 = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ipt1,&__pyx_n_s__ipt2,0};
  __Pyx_RefNannySetupContext("__eq__");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ipt1);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ipt2);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__eq__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3964; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__eq__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3964; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_ipt1 = values[0];
    __pyx_v_ipt2 = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_ipt1 = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_ipt2 = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__eq__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3964; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.InteractiveTreeDict.__eq__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3966
 *     def __eq__(ipt1, ipt2):
 * 
 *         if not (isinstance(ipt1, InteractiveTreeDict) and isinstance(ipt2, InteractiveTreeDict)):             # <<<<<<<<<<<<<<
 *             return False
 *         elif ipt1 is None or ipt2 is None:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__InteractiveTreeDict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_ipt1, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__InteractiveTreeDict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_ipt2, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  __pyx_t_2 = (!__pyx_t_4);
  if (__pyx_t_2) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3967
 * 
 *         if not (isinstance(ipt1, InteractiveTreeDict) and isinstance(ipt2, InteractiveTreeDict)):
 *             return False             # <<<<<<<<<<<<<<
 *         elif ipt1 is None or ipt2 is None:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3968
 *         if not (isinstance(ipt1, InteractiveTreeDict) and isinstance(ipt2, InteractiveTreeDict)):
 *             return False
 *         elif ipt1 is None or ipt2 is None:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
  __pyx_t_2 = (__pyx_v_ipt1 == Py_None);
  if (!__pyx_t_2) {
    __pyx_t_4 = (__pyx_v_ipt2 == Py_None);
    __pyx_t_3 = __pyx_t_4;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3969
 *             return False
 *         elif ipt1 is None or ipt2 is None:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return (<TreeDict>ipt1._original_param_tree)._isEqual(<TreeDict>ipt2._original_param_tree)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3971
 *             return False
 *         else:
 *             return (<TreeDict>ipt1._original_param_tree)._isEqual(<TreeDict>ipt2._original_param_tree)             # <<<<<<<<<<<<<<
 * 
 *     def treeDict(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_ipt1, __pyx_n_s_77); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_ipt2, __pyx_n_s_77); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1)->__pyx_vtab)->_isEqual(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1), ((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_5))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("treedict.treedict.InteractiveTreeDict.__eq__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3973
 *             return (<TreeDict>ipt1._original_param_tree)._isEqual(<TreeDict>ipt2._original_param_tree)
 * 
 *     def treeDict(self):             # <<<<<<<<<<<<<<
 *         return self._original_param_tree
 * 
 */

static PyObject *__pyx_pf_8treedict_8treedict_19InteractiveTreeDict_treeDict(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_8treedict_8treedict_19InteractiveTreeDict_treeDict = {__Pyx_NAMESTR("treeDict"), (PyCFunction)__pyx_pf_8treedict_8treedict_19InteractiveTreeDict_treeDict, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_8treedict_8treedict_19InteractiveTreeDict_treeDict(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("treeDict");
  __pyx_self = __pyx_self;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3974
 * 
 *     def treeDict(self):
 *         return self._original_param_tree             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_77); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict.InteractiveTreeDict.treeDict");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3976
 *         return self._original_param_tree
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (InteractiveTreeDict, (self._original_param_tree,))
 * 
 */

static PyObject *__pyx_pf_8treedict_8treedict_19InteractiveTreeDict___reduce__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_8treedict_8treedict_19InteractiveTreeDict___reduce__ = {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_8treedict_8treedict_19InteractiveTreeDict___reduce__, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_8treedict_8treedict_19InteractiveTreeDict___reduce__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__reduce__");
  __pyx_self = __pyx_self;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3977
 * 
 *     def __reduce__(self):
 *         return (InteractiveTreeDict, (self._original_param_tree,))             # <<<<<<<<<<<<<<
 * 
 *     def __setattr__(self, str key, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__InteractiveTreeDict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_77); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3977; __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 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.InteractiveTreeDict.__reduce__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3979
 *         return (InteractiveTreeDict, (self._original_param_tree,))
 * 
 *     def __setattr__(self, str key, v):             # <<<<<<<<<<<<<<
 *         (<TreeDict> self._original_param_tree)._setLocal(key, v, 0)
 *         self._setAttrDirect(key, v)
 */

static PyObject *__pyx_pf_8treedict_8treedict_19InteractiveTreeDict___setattr__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_8treedict_8treedict_19InteractiveTreeDict___setattr__ = {__Pyx_NAMESTR("__setattr__"), (PyCFunction)__pyx_pf_8treedict_8treedict_19InteractiveTreeDict___setattr__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_8treedict_8treedict_19InteractiveTreeDict___setattr__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__key,&__pyx_n_s__v,0};
  __Pyx_RefNannySetupContext("__setattr__");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__setattr__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3979; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__v);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__setattr__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3979; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__setattr__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3979; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_key = ((PyObject *)values[1]);
    __pyx_v_v = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_key = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 1));
    __pyx_v_v = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setattr__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3979; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.InteractiveTreeDict.__setattr__");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), &PyString_Type, 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3980
 * 
 *     def __setattr__(self, str key, v):
 *         (<TreeDict> self._original_param_tree)._setLocal(key, v, 0)             # <<<<<<<<<<<<<<
 *         self._setAttrDirect(key, v)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_77); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((struct __pyx_vtabstruct_8treedict_8treedict_TreeDict *)((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1)->__pyx_vtab)->_setLocal(((struct __pyx_obj_8treedict_8treedict_TreeDict *)__pyx_t_1), __pyx_v_key, __pyx_v_v, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3981
 *     def __setattr__(self, str key, v):
 *         (<TreeDict> self._original_param_tree)._setLocal(key, v, 0)
 *         self._setAttrDirect(key, v)             # <<<<<<<<<<<<<<
 * 
 *     def _setAttrDirect(self, str key, v):
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___setAttrDirect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_key));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_key));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_key));
  __Pyx_INCREF(__pyx_v_v);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_v);
  __Pyx_GIVEREF(__pyx_v_v);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.InteractiveTreeDict.__setattr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3983
 *         self._setAttrDirect(key, v)
 * 
 *     def _setAttrDirect(self, str key, v):             # <<<<<<<<<<<<<<
 *         object.__setattr__(self, key, v)
 * 
 */

static PyObject *__pyx_pf_8treedict_8treedict_19InteractiveTreeDict__setAttrDirect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_8treedict_8treedict_19InteractiveTreeDict__setAttrDirect = {__Pyx_NAMESTR("_setAttrDirect"), (PyCFunction)__pyx_pf_8treedict_8treedict_19InteractiveTreeDict__setAttrDirect, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_8treedict_8treedict_19InteractiveTreeDict__setAttrDirect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__key,&__pyx_n_s__v,0};
  __Pyx_RefNannySetupContext("_setAttrDirect");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_setAttrDirect", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__v);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_setAttrDirect", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_setAttrDirect") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_key = ((PyObject *)values[1]);
    __pyx_v_v = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_key = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 1));
    __pyx_v_v = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_setAttrDirect", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict.InteractiveTreeDict._setAttrDirect");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), &PyString_Type, 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3984
 * 
 *     def _setAttrDirect(self, str key, v):
 *         object.__setattr__(self, key, v)             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_builtin_object, __pyx_n_s____setattr__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(((PyObject *)__pyx_v_key));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_key));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_key));
  __Pyx_INCREF(__pyx_v_v);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_v);
  __Pyx_GIVEREF(__pyx_v_v);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("treedict.treedict.InteractiveTreeDict._setAttrDirect");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3989
 * # A few small side functions mainly for testing
 * 
 * def _ldist(str s1, str s2):             # <<<<<<<<<<<<<<
 *     cdef size_t_v buf = new_size_t_v(0)
 * 
 */

static PyObject *__pyx_pf_8treedict_8treedict__ldist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_8treedict_8treedict__ldist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s1 = 0;
  PyObject *__pyx_v_s2 = 0;
  struct __pyx_t_8treedict_10membuffers_size_t_v __pyx_v_buf;
  long __pyx_v_cost;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s1,&__pyx_n_s__s2,0};
  __Pyx_RefNannySetupContext("_ldist");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s1);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s2);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_ldist", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3989; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_ldist") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3989; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_s1 = ((PyObject *)values[0]);
    __pyx_v_s2 = ((PyObject *)values[1]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_s1 = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_s2 = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 1));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_ldist", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3989; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("treedict.treedict._ldist");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_s1), &PyString_Type, 1, "s1", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_s2), &PyString_Type, 1, "s2", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3990
 * 
 * def _ldist(str s1, str s2):
 *     cdef size_t_v buf = new_size_t_v(0)             # <<<<<<<<<<<<<<
 * 
 *     cost = editDistance(&buf, s1, s2)
 */
  __pyx_v_buf = __pyx_f_8treedict_10membuffers_new_size_t_v(0);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3992
 *     cdef size_t_v buf = new_size_t_v(0)
 * 
 *     cost = editDistance(&buf, s1, s2)             # <<<<<<<<<<<<<<
 * 
 *     free_size_t_v(&buf)
 */
  __pyx_v_cost = __pyx_f_8treedict_13name_matching_editDistance((&__pyx_v_buf), __pyx_v_s1, __pyx_v_s2);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3994
 *     cost = editDistance(&buf, s1, s2)
 * 
 *     free_size_t_v(&buf)             # <<<<<<<<<<<<<<
 * 
 *     return cost
 */
  __pyx_f_8treedict_10membuffers_free_size_t_v((&__pyx_v_buf));

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3996
 *     free_size_t_v(&buf)
 * 
 *     return cost             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_cost); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("treedict.treedict._ldist");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":43
 * 
 * 
 * cdef inline long _combine_scores(long n_beginning, long n_groups, long n_end_groups, long n1, long n2, long ldist):             # <<<<<<<<<<<<<<
 *     # make sure that beginning matching is most important
 *     return (ldist - 50*n_groups - min2_long(n_beginning, 5)*n_beginning - 10*n_end_groups
 */

static CYTHON_INLINE long __pyx_f_8treedict_13name_matching__combine_scores(long __pyx_v_n_beginning, long __pyx_v_n_groups, long __pyx_v_n_end_groups, long __pyx_v_n1, long __pyx_v_n2, long __pyx_v_ldist) {
  long __pyx_r;
  long __pyx_t_1;
  __Pyx_RefNannySetupContext("_combine_scores");

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":46
 *     # make sure that beginning matching is most important
 *     return (ldist - 50*n_groups - min2_long(n_beginning, 5)*n_beginning - 10*n_end_groups
 *             + (n1 - n2  if n1 > n2 else 0) )             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if ((__pyx_v_n1 > __pyx_v_n2)) {
    __pyx_t_1 = (__pyx_v_n1 - __pyx_v_n2);
  } else {
    __pyx_t_1 = 0;
  }
  __pyx_r = ((((__pyx_v_ldist - (50 * __pyx_v_n_groups)) - (__pyx_f_8treedict_9minsmaxes_min2_long(__pyx_v_n_beginning, 5) * __pyx_v_n_beginning)) - (10 * __pyx_v_n_end_groups)) + __pyx_t_1);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":49
 * 
 * 
 * cdef inline long name_match_distance(size_t_v *calc_buffer,             # <<<<<<<<<<<<<<
 *                                      str s1, str s2):
 * 
 */

static CYTHON_INLINE long __pyx_f_8treedict_13name_matching_name_match_distance(struct __pyx_t_8treedict_10membuffers_size_t_v *__pyx_v_calc_buffer, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2) {
  long __pyx_v_n1;
  long __pyx_v_n2;
  char *__pyx_v_s;
  char *__pyx_v_t;
  size_t __pyx_v_n_beginning;
  size_t __pyx_v_n_groups;
  size_t __pyx_v_n_end_groups;
  long __pyx_v_ldist;
  long __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  char *__pyx_t_3;
  __Pyx_RefNannySetupContext("name_match_distance");

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":54
 *     # s1 is the query string, s2 is the one being compared against
 * 
 *     cdef long n1 = len(s1)             # <<<<<<<<<<<<<<
 *     cdef long n2 = len(s2)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_s1)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n1 = __pyx_t_1;

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":55
 * 
 *     cdef long n1 = len(s1)
 *     cdef long n2 = len(s2)             # <<<<<<<<<<<<<<
 * 
 *     if n1 == 0: return n2
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_s2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n2 = __pyx_t_1;

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":57
 *     cdef long n2 = len(s2)
 * 
 *     if n1 == 0: return n2             # <<<<<<<<<<<<<<
 *     if n2 == 0: return n1
 * 
 */
  __pyx_t_2 = (__pyx_v_n1 == 0);
  if (__pyx_t_2) {
    __pyx_r = __pyx_v_n2;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":58
 * 
 *     if n1 == 0: return n2
 *     if n2 == 0: return n1             # <<<<<<<<<<<<<<
 * 
 *     cdef char* s = <bytes>s1
 */
  __pyx_t_2 = (__pyx_v_n2 == 0);
  if (__pyx_t_2) {
    __pyx_r = __pyx_v_n1;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":60
 *     if n2 == 0: return n1
 * 
 *     cdef char* s = <bytes>s1             # <<<<<<<<<<<<<<
 *     cdef char* t = <bytes>s2
 * 
 */
  __pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_s1)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_s = __pyx_t_3;

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":61
 * 
 *     cdef char* s = <bytes>s1
 *     cdef char* t = <bytes>s2             # <<<<<<<<<<<<<<
 * 
 *     cdef size_t n_beginning = 0, n_groups = 0, n_end_groups = 0
 */
  __pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_s2)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_t = __pyx_t_3;

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":63
 *     cdef char* t = <bytes>s2
 * 
 *     cdef size_t n_beginning = 0, n_groups = 0, n_end_groups = 0             # <<<<<<<<<<<<<<
 * 
 *     # Get the overlap at the beginning; this is important
 */
  __pyx_v_n_beginning = 0;
  __pyx_v_n_groups = 0;
  __pyx_v_n_end_groups = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":66
 * 
 *     # Get the overlap at the beginning; this is important
 *     while s[0] == t[0]:             # <<<<<<<<<<<<<<
 * 
 *         n_beginning += 1
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_s[0]) == (__pyx_v_t[0]));
    if (!__pyx_t_2) break;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":68
 *     while s[0] == t[0]:
 * 
 *         n_beginning += 1             # <<<<<<<<<<<<<<
 *         if s[0] == 46:
 *             n_groups += 1
 */
    __pyx_v_n_beginning += 1;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":69
 * 
 *         n_beginning += 1
 *         if s[0] == 46:             # <<<<<<<<<<<<<<
 *             n_groups += 1
 *             n_beginning = 0
 */
    __pyx_t_2 = ((__pyx_v_s[0]) == 46);
    if (__pyx_t_2) {

      /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":70
 *         n_beginning += 1
 *         if s[0] == 46:
 *             n_groups += 1             # <<<<<<<<<<<<<<
 *             n_beginning = 0
 * 
 */
      __pyx_v_n_groups += 1;

      /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":71
 *         if s[0] == 46:
 *             n_groups += 1
 *             n_beginning = 0             # <<<<<<<<<<<<<<
 * 
 *         s += 1
 */
      __pyx_v_n_beginning = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":73
 *             n_beginning = 0
 * 
 *         s += 1             # <<<<<<<<<<<<<<
 *         t += 1
 *         n1 -= 1
 */
    __pyx_v_s += 1;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":74
 * 
 *         s += 1
 *         t += 1             # <<<<<<<<<<<<<<
 *         n1 -= 1
 *         n2 -= 1
 */
    __pyx_v_t += 1;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":75
 *         s += 1
 *         t += 1
 *         n1 -= 1             # <<<<<<<<<<<<<<
 *         n2 -= 1
 * 
 */
    __pyx_v_n1 -= 1;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":76
 *         t += 1
 *         n1 -= 1
 *         n2 -= 1             # <<<<<<<<<<<<<<
 * 
 *         if n1 == 0: return _combine_scores(n_beginning, n_groups, n_end_groups, n1, n2, n2)
 */
    __pyx_v_n2 -= 1;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":78
 *         n2 -= 1
 * 
 *         if n1 == 0: return _combine_scores(n_beginning, n_groups, n_end_groups, n1, n2, n2)             # <<<<<<<<<<<<<<
 *         if n2 == 0: return _combine_scores(n_beginning, n_groups, n_end_groups, n1, n2,  n1)
 * 
 */
    __pyx_t_2 = (__pyx_v_n1 == 0);
    if (__pyx_t_2) {
      __pyx_r = __pyx_f_8treedict_13name_matching__combine_scores(__pyx_v_n_beginning, __pyx_v_n_groups, __pyx_v_n_end_groups, __pyx_v_n1, __pyx_v_n2, __pyx_v_n2);
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":79
 * 
 *         if n1 == 0: return _combine_scores(n_beginning, n_groups, n_end_groups, n1, n2, n2)
 *         if n2 == 0: return _combine_scores(n_beginning, n_groups, n_end_groups, n1, n2,  n1)             # <<<<<<<<<<<<<<
 * 
 *     while s[n1-1] == t[n2-1]:
 */
    __pyx_t_2 = (__pyx_v_n2 == 0);
    if (__pyx_t_2) {
      __pyx_r = __pyx_f_8treedict_13name_matching__combine_scores(__pyx_v_n_beginning, __pyx_v_n_groups, __pyx_v_n_end_groups, __pyx_v_n1, __pyx_v_n2, __pyx_v_n1);
      goto __pyx_L0;
      goto __pyx_L9;
    }
    __pyx_L9:;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":81
 *         if n2 == 0: return _combine_scores(n_beginning, n_groups, n_end_groups, n1, n2,  n1)
 * 
 *     while s[n1-1] == t[n2-1]:             # <<<<<<<<<<<<<<
 *         if s[n1-1] == 46:
 *             n_end_groups += 1
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_s[(__pyx_v_n1 - 1)]) == (__pyx_v_t[(__pyx_v_n2 - 1)]));
    if (!__pyx_t_2) break;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":82
 * 
 *     while s[n1-1] == t[n2-1]:
 *         if s[n1-1] == 46:             # <<<<<<<<<<<<<<
 *             n_end_groups += 1
 * 
 */
    __pyx_t_2 = ((__pyx_v_s[(__pyx_v_n1 - 1)]) == 46);
    if (__pyx_t_2) {

      /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":83
 *     while s[n1-1] == t[n2-1]:
 *         if s[n1-1] == 46:
 *             n_end_groups += 1             # <<<<<<<<<<<<<<
 * 
 *         n1 -= 1
 */
      __pyx_v_n_end_groups += 1;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":85
 *             n_end_groups += 1
 * 
 *         n1 -= 1             # <<<<<<<<<<<<<<
 *         n2 -= 1
 * 
 */
    __pyx_v_n1 -= 1;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":86
 * 
 *         n1 -= 1
 *         n2 -= 1             # <<<<<<<<<<<<<<
 * 
 *         if n1 == 0: return _combine_scores(n_beginning, n_groups, n_end_groups, n1, n2,  n2)
 */
    __pyx_v_n2 -= 1;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":88
 *         n2 -= 1
 * 
 *         if n1 == 0: return _combine_scores(n_beginning, n_groups, n_end_groups, n1, n2,  n2)             # <<<<<<<<<<<<<<
 *         if n2 == 0: return _combine_scores(n_beginning, n_groups, n_end_groups, n1, n2,  n1)
 * 
 */
    __pyx_t_2 = (__pyx_v_n1 == 0);
    if (__pyx_t_2) {
      __pyx_r = __pyx_f_8treedict_13name_matching__combine_scores(__pyx_v_n_beginning, __pyx_v_n_groups, __pyx_v_n_end_groups, __pyx_v_n1, __pyx_v_n2, __pyx_v_n2);
      goto __pyx_L0;
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":89
 * 
 *         if n1 == 0: return _combine_scores(n_beginning, n_groups, n_end_groups, n1, n2,  n2)
 *         if n2 == 0: return _combine_scores(n_beginning, n_groups, n_end_groups, n1, n2,  n1)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = (__pyx_v_n2 == 0);
    if (__pyx_t_2) {
      __pyx_r = __pyx_f_8treedict_13name_matching__combine_scores(__pyx_v_n_beginning, __pyx_v_n_groups, __pyx_v_n_end_groups, __pyx_v_n1, __pyx_v_n2, __pyx_v_n1);
      goto __pyx_L0;
      goto __pyx_L14;
    }
    __pyx_L14:;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":92
 * 
 * 
 *     cdef long ldist = _editDistanceDirect(calc_buffer, s, n1, t, n2)             # <<<<<<<<<<<<<<
 *     return _combine_scores(n_beginning, n_groups, n_end_groups, n1, n2, ldist)
 * 
 */
  __pyx_v_ldist = __pyx_f_8treedict_13name_matching__editDistanceDirect(__pyx_v_calc_buffer, __pyx_v_s, __pyx_v_n1, __pyx_v_t, __pyx_v_n2);

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":93
 * 
 *     cdef long ldist = _editDistanceDirect(calc_buffer, s, n1, t, n2)
 *     return _combine_scores(n_beginning, n_groups, n_end_groups, n1, n2, ldist)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_f_8treedict_13name_matching__combine_scores(__pyx_v_n_beginning, __pyx_v_n_groups, __pyx_v_n_end_groups, __pyx_v_n1, __pyx_v_n2, __pyx_v_ldist);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("treedict.name_matching.name_match_distance");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":97
 * 
 * 
 * cdef inline long editDistance(size_t_v *calc_buffer, str s1, str s2):             # <<<<<<<<<<<<<<
 * 
 *     # This is for debugging purposes
 */

static CYTHON_INLINE long __pyx_f_8treedict_13name_matching_editDistance(struct __pyx_t_8treedict_10membuffers_size_t_v *__pyx_v_calc_buffer, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2) {
  long __pyx_v_n1;
  long __pyx_v_n2;
  char *__pyx_v_s;
  char *__pyx_v_t;
  long __pyx_r;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  char *__pyx_t_4;
  __Pyx_RefNannySetupContext("editDistance");

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":100
 * 
 *     # This is for debugging purposes
 *     cdef long n1 = len(s1)             # <<<<<<<<<<<<<<
 *     cdef long n2 = len(s2)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_s1)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n1 = __pyx_t_1;

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":101
 *     # This is for debugging purposes
 *     cdef long n1 = len(s1)
 *     cdef long n2 = len(s2)             # <<<<<<<<<<<<<<
 * 
 *     if s1 == s2:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_s2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n2 = __pyx_t_1;

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":103
 *     cdef long n2 = len(s2)
 * 
 *     if s1 == s2:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_s1), ((PyObject *)__pyx_v_s2), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":104
 * 
 *     if s1 == s2:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef char* s = <bytes>s1
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":106
 *         return 0
 * 
 *     cdef char* s = <bytes>s1             # <<<<<<<<<<<<<<
 *     cdef char* t = <bytes>s2
 * 
 */
  __pyx_t_4 = PyBytes_AsString(((PyObject *)__pyx_v_s1)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_s = __pyx_t_4;

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":107
 * 
 *     cdef char* s = <bytes>s1
 *     cdef char* t = <bytes>s2             # <<<<<<<<<<<<<<
 * 
 *     # Get the overlap at the beginning; this is important
 */
  __pyx_t_4 = PyBytes_AsString(((PyObject *)__pyx_v_s2)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_t = __pyx_t_4;

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":110
 * 
 *     # Get the overlap at the beginning; this is important
 *     while s[0] == t[0]:             # <<<<<<<<<<<<<<
 *         s += 1
 *         t += 1
 */
  while (1) {
    __pyx_t_3 = ((__pyx_v_s[0]) == (__pyx_v_t[0]));
    if (!__pyx_t_3) break;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":111
 *     # Get the overlap at the beginning; this is important
 *     while s[0] == t[0]:
 *         s += 1             # <<<<<<<<<<<<<<
 *         t += 1
 *         n1 -= 1
 */
    __pyx_v_s += 1;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":112
 *     while s[0] == t[0]:
 *         s += 1
 *         t += 1             # <<<<<<<<<<<<<<
 *         n1 -= 1
 *         n2 -= 1
 */
    __pyx_v_t += 1;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":113
 *         s += 1
 *         t += 1
 *         n1 -= 1             # <<<<<<<<<<<<<<
 *         n2 -= 1
 * 
 */
    __pyx_v_n1 -= 1;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":114
 *         t += 1
 *         n1 -= 1
 *         n2 -= 1             # <<<<<<<<<<<<<<
 * 
 *         if n1 == 0: return n2
 */
    __pyx_v_n2 -= 1;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":116
 *         n2 -= 1
 * 
 *         if n1 == 0: return n2             # <<<<<<<<<<<<<<
 *         if n2 == 0: return n1
 * 
 */
    __pyx_t_3 = (__pyx_v_n1 == 0);
    if (__pyx_t_3) {
      __pyx_r = __pyx_v_n2;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":117
 * 
 *         if n1 == 0: return n2
 *         if n2 == 0: return n1             # <<<<<<<<<<<<<<
 * 
 *     while s[n1-1] == t[n2-1]:
 */
    __pyx_t_3 = (__pyx_v_n2 == 0);
    if (__pyx_t_3) {
      __pyx_r = __pyx_v_n1;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":119
 *         if n2 == 0: return n1
 * 
 *     while s[n1-1] == t[n2-1]:             # <<<<<<<<<<<<<<
 *         n1 -= 1
 *         n2 -= 1
 */
  while (1) {
    __pyx_t_3 = ((__pyx_v_s[(__pyx_v_n1 - 1)]) == (__pyx_v_t[(__pyx_v_n2 - 1)]));
    if (!__pyx_t_3) break;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":120
 * 
 *     while s[n1-1] == t[n2-1]:
 *         n1 -= 1             # <<<<<<<<<<<<<<
 *         n2 -= 1
 * 
 */
    __pyx_v_n1 -= 1;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":121
 *     while s[n1-1] == t[n2-1]:
 *         n1 -= 1
 *         n2 -= 1             # <<<<<<<<<<<<<<
 * 
 *         if n1 == 0: return n2
 */
    __pyx_v_n2 -= 1;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":123
 *         n2 -= 1
 * 
 *         if n1 == 0: return n2             # <<<<<<<<<<<<<<
 *         if n2 == 0: return n1
 * 
 */
    __pyx_t_3 = (__pyx_v_n1 == 0);
    if (__pyx_t_3) {
      __pyx_r = __pyx_v_n2;
      goto __pyx_L0;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":124
 * 
 *         if n1 == 0: return n2
 *         if n2 == 0: return n1             # <<<<<<<<<<<<<<
 * 
 *     return _editDistanceDirect(calc_buffer, s, n1, t, n2)
 */
    __pyx_t_3 = (__pyx_v_n2 == 0);
    if (__pyx_t_3) {
      __pyx_r = __pyx_v_n1;
      goto __pyx_L0;
      goto __pyx_L11;
    }
    __pyx_L11:;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":126
 *         if n2 == 0: return n1
 * 
 *     return _editDistanceDirect(calc_buffer, s, n1, t, n2)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_f_8treedict_13name_matching__editDistanceDirect(__pyx_v_calc_buffer, __pyx_v_s, __pyx_v_n1, __pyx_v_t, __pyx_v_n2);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("treedict.name_matching.editDistance");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":129
 * 
 * 
 * cdef inline long _editDistanceDirect(size_t_v *calc_buffer, char *s, long n1, char *t, long n2):             # <<<<<<<<<<<<<<
 * 
 *     resize_size_t_v(calc_buffer, ((n1+2)*(n2+2) + 1))
 */

static CYTHON_INLINE long __pyx_f_8treedict_13name_matching__editDistanceDirect(struct __pyx_t_8treedict_10membuffers_size_t_v *__pyx_v_calc_buffer, char *__pyx_v_s, long __pyx_v_n1, char *__pyx_v_t, long __pyx_v_n2) {
  size_t *__pyx_v_d;
  size_t __pyx_v_i;
  size_t __pyx_v_j;
  size_t __pyx_v_m;
  long __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  long __pyx_t_5;
  long __pyx_t_6;
  long __pyx_t_7;
  __Pyx_RefNannySetupContext("_editDistanceDirect");

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":131
 * cdef inline long _editDistanceDirect(size_t_v *calc_buffer, char *s, long n1, char *t, long n2):
 * 
 *     resize_size_t_v(calc_buffer, ((n1+2)*(n2+2) + 1))             # <<<<<<<<<<<<<<
 * 
 *     cdef size_t* d = calc_buffer.d
 */
  __pyx_f_8treedict_10membuffers_resize_size_t_v(__pyx_v_calc_buffer, (((__pyx_v_n1 + 2) * (__pyx_v_n2 + 2)) + 1));

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":133
 *     resize_size_t_v(calc_buffer, ((n1+2)*(n2+2) + 1))
 * 
 *     cdef size_t* d = calc_buffer.d             # <<<<<<<<<<<<<<
 * 
 *     if d == NULL:
 */
  __pyx_v_d = __pyx_v_calc_buffer->d;

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":135
 *     cdef size_t* d = calc_buffer.d
 * 
 *     if d == NULL:             # <<<<<<<<<<<<<<
 *         warnings.warn("Out-of-memory error allocating buffer array.")
 *         return 0
 */
  __pyx_t_1 = (__pyx_v_d == NULL);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":136
 * 
 *     if d == NULL:
 *         warnings.warn("Out-of-memory error allocating buffer array.")             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__warn); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_78));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_78));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_78));
    __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":137
 *     if d == NULL:
 *         warnings.warn("Out-of-memory error allocating buffer array.")
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef size_t i, j
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":140
 * 
 *     cdef size_t i, j
 *     cdef size_t m = n2+1             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i <= n1: d[i*m] = i
 */
  __pyx_v_m = (__pyx_v_n2 + 1);

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":142
 *     cdef size_t m = n2+1
 * 
 *     for i from 0 <= i <= n1: d[i*m] = i             # <<<<<<<<<<<<<<
 *     for j from 0 < j <= n2:  d[j] = j
 * 
 */
  __pyx_t_5 = __pyx_v_n1;
  for (__pyx_v_i = 0; __pyx_v_i <= __pyx_t_5; __pyx_v_i++) {
    (__pyx_v_d[(__pyx_v_i * __pyx_v_m)]) = __pyx_v_i;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":143
 * 
 *     for i from 0 <= i <= n1: d[i*m] = i
 *     for j from 0 < j <= n2:  d[j] = j             # <<<<<<<<<<<<<<
 * 
 *     for i from 1 <= i <= n1:
 */
  __pyx_t_5 = __pyx_v_n2;
  for (__pyx_v_j = 0+1; __pyx_v_j <= __pyx_t_5; __pyx_v_j++) {
    (__pyx_v_d[__pyx_v_j]) = __pyx_v_j;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":145
 *     for j from 0 < j <= n2:  d[j] = j
 * 
 *     for i from 1 <= i <= n1:             # <<<<<<<<<<<<<<
 *         for j from 1 <= j <= n2:
 *             d[i*m + j] = min3( d[(i-1)*m + j] + 1, # Insertion
 */
  __pyx_t_5 = __pyx_v_n1;
  for (__pyx_v_i = 1; __pyx_v_i <= __pyx_t_5; __pyx_v_i++) {

    /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":146
 * 
 *     for i from 1 <= i <= n1:
 *         for j from 1 <= j <= n2:             # <<<<<<<<<<<<<<
 *             d[i*m + j] = min3( d[(i-1)*m + j] + 1, # Insertion
 *                                d[i*m + j-1] + 1,   # Deletion
 */
    __pyx_t_6 = __pyx_v_n2;
    for (__pyx_v_j = 1; __pyx_v_j <= __pyx_t_6; __pyx_v_j++) {

      /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":149
 *             d[i*m + j] = min3( d[(i-1)*m + j] + 1, # Insertion
 *                                d[i*m + j-1] + 1,   # Deletion
 *                                d[(i-1)*m + j-1] + (0 if s[i-1] == t[j-1] else 1) ) # Change             # <<<<<<<<<<<<<<
 * 
 *     return d[n1*m + n2]
 */
      if (((__pyx_v_s[(__pyx_v_i - 1)]) == (__pyx_v_t[(__pyx_v_j - 1)]))) {
        __pyx_t_7 = 0;
      } else {
        __pyx_t_7 = 1;
      }

      /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":147
 *     for i from 1 <= i <= n1:
 *         for j from 1 <= j <= n2:
 *             d[i*m + j] = min3( d[(i-1)*m + j] + 1, # Insertion             # <<<<<<<<<<<<<<
 *                                d[i*m + j-1] + 1,   # Deletion
 *                                d[(i-1)*m + j-1] + (0 if s[i-1] == t[j-1] else 1) ) # Change
 */
      (__pyx_v_d[((__pyx_v_i * __pyx_v_m) + __pyx_v_j)]) = __pyx_f_8treedict_9minsmaxes_min3(((__pyx_v_d[(((__pyx_v_i - 1) * __pyx_v_m) + __pyx_v_j)]) + 1), ((__pyx_v_d[(((__pyx_v_i * __pyx_v_m) + __pyx_v_j) - 1)]) + 1), ((__pyx_v_d[((((__pyx_v_i - 1) * __pyx_v_m) + __pyx_v_j) - 1)]) + __pyx_t_7));
    }
  }

  /* "/homes/hoytak/workspace/treedict/treedict/name_matching.pxd":151
 *                                d[(i-1)*m + j-1] + (0 if s[i-1] == t[j-1] else 1) ) # Change
 * 
 *     return d[n1*m + n2]             # <<<<<<<<<<<<<<
 * 
 */
  __pyx_r = (__pyx_v_d[((__pyx_v_n1 * __pyx_v_m) + __pyx_v_n2)]);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("treedict.name_matching._editDistanceDirect");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":38
 *     size_t size
 * 
 * cdef inline size_t_v new_size_t_v(size_t size):             # <<<<<<<<<<<<<<
 *     cdef size_t_v v
 * 
 */

static CYTHON_INLINE struct __pyx_t_8treedict_10membuffers_size_t_v __pyx_f_8treedict_10membuffers_new_size_t_v(size_t __pyx_v_size) {
  struct __pyx_t_8treedict_10membuffers_size_t_v __pyx_v_v;
  struct __pyx_t_8treedict_10membuffers_size_t_v __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("new_size_t_v");

  /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":41
 *     cdef size_t_v v
 * 
 *     if size > 0:             # <<<<<<<<<<<<<<
 *         v.d = <size_t*>malloc(size*sizeof(size_t))
 *     else:
 */
  __pyx_t_1 = (__pyx_v_size > 0);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":42
 * 
 *     if size > 0:
 *         v.d = <size_t*>malloc(size*sizeof(size_t))             # <<<<<<<<<<<<<<
 *     else:
 *         v.d = NULL
 */
    __pyx_v_v.d = ((size_t *)PyMem_Malloc((__pyx_v_size * (sizeof(size_t)))));
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":44
 *         v.d = <size_t*>malloc(size*sizeof(size_t))
 *     else:
 *         v.d = NULL             # <<<<<<<<<<<<<<
 * 
 *     v.size = size
 */
    __pyx_v_v.d = NULL;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":46
 *         v.d = NULL
 * 
 *     v.size = size             # <<<<<<<<<<<<<<
 * 
 *     return v
 */
  __pyx_v_v.size = __pyx_v_size;

  /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":48
 *     v.size = size
 * 
 *     return v             # <<<<<<<<<<<<<<
 * 
 * cdef inline void resize_size_t_v(size_t_v* v_ptr, size_t newsize):
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":50
 *     return v
 * 
 * cdef inline void resize_size_t_v(size_t_v* v_ptr, size_t newsize):             # <<<<<<<<<<<<<<
 * 
 *     if newsize <= v_ptr.size:
 */

static CYTHON_INLINE void __pyx_f_8treedict_10membuffers_resize_size_t_v(struct __pyx_t_8treedict_10membuffers_size_t_v *__pyx_v_v_ptr, size_t __pyx_v_newsize) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("resize_size_t_v");

  /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":52
 * cdef inline void resize_size_t_v(size_t_v* v_ptr, size_t newsize):
 * 
 *     if newsize <= v_ptr.size:             # <<<<<<<<<<<<<<
 *         return
 *     elif v_ptr.d == NULL:
 */
  __pyx_t_1 = (__pyx_v_newsize <= __pyx_v_v_ptr->size);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":53
 * 
 *     if newsize <= v_ptr.size:
 *         return             # <<<<<<<<<<<<<<
 *     elif v_ptr.d == NULL:
 *         v_ptr.d = <size_t*>malloc(newsize*sizeof(size_t))
 */
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":54
 *     if newsize <= v_ptr.size:
 *         return
 *     elif v_ptr.d == NULL:             # <<<<<<<<<<<<<<
 *         v_ptr.d = <size_t*>malloc(newsize*sizeof(size_t))
 *     else:
 */
  __pyx_t_1 = (__pyx_v_v_ptr->d == NULL);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":55
 *         return
 *     elif v_ptr.d == NULL:
 *         v_ptr.d = <size_t*>malloc(newsize*sizeof(size_t))             # <<<<<<<<<<<<<<
 *     else:
 *         v_ptr.d = <size_t*>realloc(v_ptr.d, newsize*sizeof(size_t))
 */
    __pyx_v_v_ptr->d = ((size_t *)PyMem_Malloc((__pyx_v_newsize * (sizeof(size_t)))));
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":57
 *         v_ptr.d = <size_t*>malloc(newsize*sizeof(size_t))
 *     else:
 *         v_ptr.d = <size_t*>realloc(v_ptr.d, newsize*sizeof(size_t))             # <<<<<<<<<<<<<<
 * 
 *     v_ptr.size = newsize
 */
    __pyx_v_v_ptr->d = ((size_t *)PyMem_Realloc(__pyx_v_v_ptr->d, (__pyx_v_newsize * (sizeof(size_t)))));
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":59
 *         v_ptr.d = <size_t*>realloc(v_ptr.d, newsize*sizeof(size_t))
 * 
 *     v_ptr.size = newsize             # <<<<<<<<<<<<<<
 * 
 * cdef inline void free_size_t_v(size_t_v* v_ptr):
 */
  __pyx_v_v_ptr->size = __pyx_v_newsize;

  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":61
 *     v_ptr.size = newsize
 * 
 * cdef inline void free_size_t_v(size_t_v* v_ptr):             # <<<<<<<<<<<<<<
 *     if v_ptr.d != NULL:
 *         free(v_ptr.d)
 */

static CYTHON_INLINE void __pyx_f_8treedict_10membuffers_free_size_t_v(struct __pyx_t_8treedict_10membuffers_size_t_v *__pyx_v_v_ptr) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("free_size_t_v");

  /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":62
 * 
 * cdef inline void free_size_t_v(size_t_v* v_ptr):
 *     if v_ptr.d != NULL:             # <<<<<<<<<<<<<<
 *         free(v_ptr.d)
 * 
 */
  __pyx_t_1 = (__pyx_v_v_ptr->d != NULL);
  if (__pyx_t_1) {

    /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":63
 * cdef inline void free_size_t_v(size_t_v* v_ptr):
 *     if v_ptr.d != NULL:
 *         free(v_ptr.d)             # <<<<<<<<<<<<<<
 * 
 *     v_ptr.size = 0
 */
    PyMem_Free(__pyx_v_v_ptr->d);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":65
 *         free(v_ptr.d)
 * 
 *     v_ptr.size = 0             # <<<<<<<<<<<<<<
 *     v_ptr.d = NULL
 */
  __pyx_v_v_ptr->size = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/membuffers.pxd":66
 * 
 *     v_ptr.size = 0
 *     v_ptr.d = NULL             # <<<<<<<<<<<<<<
 */
  __pyx_v_v_ptr->d = NULL;

  __Pyx_RefNannyFinishContext();
}

/* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":2
 * 
 * cdef inline size_t min3(size_t a, size_t b, size_t c):             # <<<<<<<<<<<<<<
 *     cdef size_t m = a
 *     if b < m: m = b
 */

static CYTHON_INLINE size_t __pyx_f_8treedict_9minsmaxes_min3(size_t __pyx_v_a, size_t __pyx_v_b, size_t __pyx_v_c) {
  size_t __pyx_v_m;
  size_t __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("min3");

  /* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":3
 * 
 * cdef inline size_t min3(size_t a, size_t b, size_t c):
 *     cdef size_t m = a             # <<<<<<<<<<<<<<
 *     if b < m: m = b
 *     if c < m: m = c
 */
  __pyx_v_m = __pyx_v_a;

  /* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":4
 * cdef inline size_t min3(size_t a, size_t b, size_t c):
 *     cdef size_t m = a
 *     if b < m: m = b             # <<<<<<<<<<<<<<
 *     if c < m: m = c
 *     return m
 */
  __pyx_t_1 = (__pyx_v_b < __pyx_v_m);
  if (__pyx_t_1) {
    __pyx_v_m = __pyx_v_b;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":5
 *     cdef size_t m = a
 *     if b < m: m = b
 *     if c < m: m = c             # <<<<<<<<<<<<<<
 *     return m
 * 
 */
  __pyx_t_1 = (__pyx_v_c < __pyx_v_m);
  if (__pyx_t_1) {
    __pyx_v_m = __pyx_v_c;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":6
 *     if b < m: m = b
 *     if c < m: m = c
 *     return m             # <<<<<<<<<<<<<<
 * 
 * cdef inline size_t min2(size_t a, size_t b):
 */
  __pyx_r = __pyx_v_m;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":8
 *     return m
 * 
 * cdef inline size_t min2(size_t a, size_t b):             # <<<<<<<<<<<<<<
 *     return a if a < b else b
 * 
 */

static CYTHON_INLINE size_t __pyx_f_8treedict_9minsmaxes_min2(size_t __pyx_v_a, size_t __pyx_v_b) {
  size_t __pyx_r;
  size_t __pyx_t_1;
  __Pyx_RefNannySetupContext("min2");

  /* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":9
 * 
 * cdef inline size_t min2(size_t a, size_t b):
 *     return a if a < b else b             # <<<<<<<<<<<<<<
 * 
 * cdef inline size_t max2(size_t a, size_t b):
 */
  if ((__pyx_v_a < __pyx_v_b)) {
    __pyx_t_1 = __pyx_v_a;
  } else {
    __pyx_t_1 = __pyx_v_b;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":11
 *     return a if a < b else b
 * 
 * cdef inline size_t max2(size_t a, size_t b):             # <<<<<<<<<<<<<<
 *     return b if a < b else a
 * 
 */

static CYTHON_INLINE size_t __pyx_f_8treedict_9minsmaxes_max2(size_t __pyx_v_a, size_t __pyx_v_b) {
  size_t __pyx_r;
  size_t __pyx_t_1;
  __Pyx_RefNannySetupContext("max2");

  /* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":12
 * 
 * cdef inline size_t max2(size_t a, size_t b):
 *     return b if a < b else a             # <<<<<<<<<<<<<<
 * 
 * cdef inline int min2_int(int a, int b):
 */
  if ((__pyx_v_a < __pyx_v_b)) {
    __pyx_t_1 = __pyx_v_b;
  } else {
    __pyx_t_1 = __pyx_v_a;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":14
 *     return b if a < b else a
 * 
 * cdef inline int min2_int(int a, int b):             # <<<<<<<<<<<<<<
 *     return a if a < b else b
 * 
 */

static CYTHON_INLINE int __pyx_f_8treedict_9minsmaxes_min2_int(int __pyx_v_a, int __pyx_v_b) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("min2_int");

  /* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":15
 * 
 * cdef inline int min2_int(int a, int b):
 *     return a if a < b else b             # <<<<<<<<<<<<<<
 * 
 * cdef inline int max2_int(int a, int b):
 */
  if ((__pyx_v_a < __pyx_v_b)) {
    __pyx_t_1 = __pyx_v_a;
  } else {
    __pyx_t_1 = __pyx_v_b;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":17
 *     return a if a < b else b
 * 
 * cdef inline int max2_int(int a, int b):             # <<<<<<<<<<<<<<
 *     return b if a < b else a
 * 
 */

static CYTHON_INLINE int __pyx_f_8treedict_9minsmaxes_max2_int(int __pyx_v_a, int __pyx_v_b) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("max2_int");

  /* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":18
 * 
 * cdef inline int max2_int(int a, int b):
 *     return b if a < b else a             # <<<<<<<<<<<<<<
 * 
 * cdef inline long min2_long(long a, long b):
 */
  if ((__pyx_v_a < __pyx_v_b)) {
    __pyx_t_1 = __pyx_v_b;
  } else {
    __pyx_t_1 = __pyx_v_a;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":20
 *     return b if a < b else a
 * 
 * cdef inline long min2_long(long a, long b):             # <<<<<<<<<<<<<<
 *     return a if a < b else b
 * 
 */

static CYTHON_INLINE long __pyx_f_8treedict_9minsmaxes_min2_long(long __pyx_v_a, long __pyx_v_b) {
  long __pyx_r;
  long __pyx_t_1;
  __Pyx_RefNannySetupContext("min2_long");

  /* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":21
 * 
 * cdef inline long min2_long(long a, long b):
 *     return a if a < b else b             # <<<<<<<<<<<<<<
 * 
 * cdef inline long max2_long(long a, long b):
 */
  if ((__pyx_v_a < __pyx_v_b)) {
    __pyx_t_1 = __pyx_v_a;
  } else {
    __pyx_t_1 = __pyx_v_b;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":23
 *     return a if a < b else b
 * 
 * cdef inline long max2_long(long a, long b):             # <<<<<<<<<<<<<<
 *     return b if a < b else a
 */

static CYTHON_INLINE long __pyx_f_8treedict_9minsmaxes_max2_long(long __pyx_v_a, long __pyx_v_b) {
  long __pyx_r;
  long __pyx_t_1;
  __Pyx_RefNannySetupContext("max2_long");

  /* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":24
 * 
 * cdef inline long max2_long(long a, long b):
 *     return b if a < b else a             # <<<<<<<<<<<<<<
 */
  if ((__pyx_v_a < __pyx_v_b)) {
    __pyx_t_1 = __pyx_v_b;
  } else {
    __pyx_t_1 = __pyx_v_a;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_8treedict_8treedict_TreeDict __pyx_vtable_8treedict_8treedict_TreeDict;

static PyObject *__pyx_tp_new_8treedict_8treedict_TreeDict(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)o);
  p->__pyx_vtab = __pyx_vtabptr_8treedict_8treedict_TreeDict;
  p->_param_dict = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->_branches = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->_parent = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); Py_INCREF(Py_None);
  p->_name = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->_aux_dict = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->__weakref__ = 0;
  if (__pyx_pf_8treedict_8treedict_8TreeDict___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8treedict_8treedict_TreeDict(PyObject *o) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *p = (struct __pyx_obj_8treedict_8treedict_TreeDict *)o;
  if (p->__weakref__) PyObject_ClearWeakRefs(o);
  Py_XDECREF(((PyObject *)p->_param_dict));
  Py_XDECREF(((PyObject *)p->_branches));
  Py_XDECREF(((PyObject *)p->_parent));
  Py_XDECREF(((PyObject *)p->_name));
  Py_XDECREF(((PyObject *)p->_aux_dict));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8treedict_8treedict_TreeDict(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8treedict_8treedict_TreeDict *p = (struct __pyx_obj_8treedict_8treedict_TreeDict *)o;
  if (p->_param_dict) {
    e = (*v)(p->_param_dict, a); if (e) return e;
  }
  if (p->_branches) {
    e = (*v)(p->_branches, a); if (e) return e;
  }
  if (p->_parent) {
    e = (*v)(((PyObject*)p->_parent), a); if (e) return e;
  }
  if (p->_name) {
    e = (*v)(p->_name, a); if (e) return e;
  }
  if (p->_aux_dict) {
    e = (*v)(p->_aux_dict, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8treedict_8treedict_TreeDict(PyObject *o) {
  struct __pyx_obj_8treedict_8treedict_TreeDict *p = (struct __pyx_obj_8treedict_8treedict_TreeDict *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_param_dict);
  p->_param_dict = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_branches);
  p->_branches = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_parent);
  p->_parent = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_name);
  p->_name = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_aux_dict);
  p->_aux_dict = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_8treedict_8treedict_TreeDict(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_8treedict_8treedict_TreeDict(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pf_8treedict_8treedict_8TreeDict___setitem__(o, i, v);
  }
  else {
    return __pyx_pf_8treedict_8treedict_8TreeDict___delitem__(o, i);
  }
}

static PyObject *__pyx_tp_getattro_8treedict_8treedict_TreeDict(PyObject *o, PyObject *n) {
  PyObject *v = PyObject_GenericGetAttr(o, n);
  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
    PyErr_Clear();
    v = __pyx_pf_8treedict_8treedict_8TreeDict___getattr__(o, n);
  }
  return v;
}

static int __pyx_tp_setattro_8treedict_8treedict_TreeDict(PyObject *o, PyObject *n, PyObject *v) {
  if (v) {
    return __pyx_pf_8treedict_8treedict_8TreeDict___setattr__(o, n, v);
  }
  else {
    return __pyx_pf_8treedict_8treedict_8TreeDict___delattr__(o, n);
  }
}

static PyMethodDef __pyx_methods_8treedict_8treedict_TreeDict[] = {
  {__Pyx_NAMESTR("setFromString"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_setFromString, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_setFromString)},
  {__Pyx_NAMESTR("fromkeys"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_fromkeys, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_fromkeys)},
  {__Pyx_NAMESTR("fromdict"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_fromdict, METH_O, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_fromdict)},
  {__Pyx_NAMESTR("setdefault"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_setdefault, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_setdefault)},
  {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_set)},
  {__Pyx_NAMESTR("checkset"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_checkset, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_checkset)},
  {__Pyx_NAMESTR("freeze"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_freeze, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_freeze)},
  {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_clear, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_clear)},
  {__Pyx_NAMESTR("pop"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_pop, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_pop)},
  {__Pyx_NAMESTR("popitem"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_popitem, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_popitem)},
  {__Pyx_NAMESTR("attach"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_attach, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_attach)},
  {__Pyx_NAMESTR("isFrozen"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_isFrozen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_isFrozen)},
  {__Pyx_NAMESTR("isDangling"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_isDangling, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_isDangling)},
  {__Pyx_NAMESTR("_isDetachedDangling"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict__isDetachedDangling, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("isRegistered"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_isRegistered, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_isRegistered)},
  {__Pyx_NAMESTR("_numDangling"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict__numDangling, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_iteratorRefCount"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict__iteratorRefCount, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("parentNode"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_parentNode, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_parentNode)},
  {__Pyx_NAMESTR("rootNode"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_rootNode, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_rootNode)},
  {__Pyx_NAMESTR("isRoot"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_isRoot, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_isRoot)},
  {__Pyx_NAMESTR("isEmpty"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_isEmpty, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_isEmpty)},
  {__Pyx_NAMESTR("nodeInSameTree"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_nodeInSameTree, METH_O, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_nodeInSameTree)},
  {__Pyx_NAMESTR("interactiveTree"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_interactiveTree, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_interactiveTree)},
  {__Pyx_NAMESTR("_fullNameOf"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict__fullNameOf, METH_O, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict__fullNameOf)},
  {__Pyx_NAMESTR("_branchNameOf"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict__branchNameOf, METH_O, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict__branchNameOf)},
  {__Pyx_NAMESTR("treeName"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_treeName, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_treeName)},
  {__Pyx_NAMESTR("branchName"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_branchName, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_branchName)},
  {__Pyx_NAMESTR("makeReport"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_makeReport, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_makeReport)},
  {__Pyx_NAMESTR("_getSettingOrderPosition"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict__getSettingOrderPosition, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_get)},
  {__Pyx_NAMESTR("has_key"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_has_key, METH_O, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_has_key)},
  {__Pyx_NAMESTR("makeBranch"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_makeBranch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_makeBranch)},
  {__Pyx_NAMESTR("isMutable"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_isMutable, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_isMutable)},
  {__Pyx_NAMESTR("_numMutable"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict__numMutable, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("hash"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_hash, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_hash)},
  {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict___copy__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict___deepcopy__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_copy, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_copy)},
  {__Pyx_NAMESTR("update"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_update, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_update)},
  {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict___reduce__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("size"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_size, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_size)},
  {__Pyx_NAMESTR("iteritems"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_iteritems, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_iteritems)},
  {__Pyx_NAMESTR("itervalues"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_itervalues, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_itervalues)},
  {__Pyx_NAMESTR("iterkeys"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_iterkeys, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_iterkeys)},
  {__Pyx_NAMESTR("iterbranches"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_iterbranches, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_iterbranches)},
  {__Pyx_NAMESTR("items"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_items, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_items)},
  {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_values, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_values)},
  {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_keys, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_keys)},
  {__Pyx_NAMESTR("branches"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_branches, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_branches)},
  {__Pyx_NAMESTR("getClosestKey"), (PyCFunction)__pyx_pf_8treedict_8treedict_8TreeDict_getClosestKey, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_8TreeDict_getClosestKey)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_TreeDict = {
  0, /*nb_add*/
  0, /*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*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*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*/
  0, /*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*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_TreeDict = {
  __pyx_pf_8treedict_8treedict_8TreeDict___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_8treedict_8treedict_TreeDict, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pf_8treedict_8treedict_8TreeDict___contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_TreeDict = {
  __pyx_pf_8treedict_8treedict_8TreeDict___len__, /*mp_length*/
  __pyx_pf_8treedict_8treedict_8TreeDict___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_8treedict_8treedict_TreeDict, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_TreeDict = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_8treedict_8treedict_TreeDict = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("treedict.treedict.TreeDict"), /*tp_name*/
  sizeof(struct __pyx_obj_8treedict_8treedict_TreeDict), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8treedict_8treedict_TreeDict, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_8treedict_8treedict_8TreeDict___repr__, /*tp_repr*/
  &__pyx_tp_as_number_TreeDict, /*tp_as_number*/
  &__pyx_tp_as_sequence_TreeDict, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_TreeDict, /*tp_as_mapping*/
  __pyx_pf_8treedict_8treedict_8TreeDict___hash__, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  __pyx_tp_getattro_8treedict_8treedict_TreeDict, /*tp_getattro*/
  __pyx_tp_setattro_8treedict_8treedict_TreeDict, /*tp_setattro*/
  &__pyx_tp_as_buffer_TreeDict, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8treedict_8treedict_TreeDict, /*tp_traverse*/
  __pyx_tp_clear_8treedict_8treedict_TreeDict, /*tp_clear*/
  __pyx_pf_8treedict_8treedict_8TreeDict___richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_8treedict_8treedict_8TreeDict___iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8treedict_8treedict_TreeDict, /*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_pf_8treedict_8treedict_8TreeDict___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8treedict_8treedict_TreeDict, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_8treedict_8treedict_TreeDictIterator __pyx_vtable_8treedict_8treedict_TreeDictIterator;

static PyObject *__pyx_tp_new_8treedict_8treedict_TreeDictIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)o);
  p->__pyx_vtab = __pyx_vtabptr_8treedict_8treedict_TreeDictIterator;
  p->_key_stack = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->_cur_pt = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); Py_INCREF(Py_None);
  p->_last_key = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->_current_key = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->_last_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); Py_INCREF(Py_None);
  p->_next_return_value = Py_None; Py_INCREF(Py_None);
  if (__pyx_pf_8treedict_8treedict_16TreeDictIterator___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8treedict_8treedict_TreeDictIterator(PyObject *o) {
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *p = (struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_8treedict_8treedict_16TreeDictIterator___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->_key_stack));
  Py_XDECREF(((PyObject *)p->_cur_pt));
  Py_XDECREF(((PyObject *)p->_last_key));
  Py_XDECREF(((PyObject *)p->_current_key));
  Py_XDECREF(((PyObject *)p->_last_pn));
  Py_XDECREF(p->_next_return_value);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8treedict_8treedict_TreeDictIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *p = (struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)o;
  if (p->_key_stack) {
    e = (*v)(p->_key_stack, a); if (e) return e;
  }
  if (p->_cur_pt) {
    e = (*v)(((PyObject*)p->_cur_pt), a); if (e) return e;
  }
  if (p->_last_key) {
    e = (*v)(p->_last_key, a); if (e) return e;
  }
  if (p->_current_key) {
    e = (*v)(p->_current_key, a); if (e) return e;
  }
  if (p->_last_pn) {
    e = (*v)(((PyObject*)p->_last_pn), a); if (e) return e;
  }
  if (p->_next_return_value) {
    e = (*v)(p->_next_return_value, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8treedict_8treedict_TreeDictIterator(PyObject *o) {
  struct __pyx_obj_8treedict_8treedict_TreeDictIterator *p = (struct __pyx_obj_8treedict_8treedict_TreeDictIterator *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_key_stack);
  p->_key_stack = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_cur_pt);
  p->_cur_pt = ((struct __pyx_obj_8treedict_8treedict_TreeDict *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_last_key);
  p->_last_key = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_current_key);
  p->_current_key = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_last_pn);
  p->_last_pn = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_next_return_value);
  p->_next_return_value = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_8treedict_8treedict_TreeDictIterator[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_8treedict_8treedict_16TreeDictIterator___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_TreeDictIterator = {
  0, /*nb_add*/
  0, /*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*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*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*/
  0, /*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*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

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

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

static PyBufferProcs __pyx_tp_as_buffer_TreeDictIterator = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_8treedict_8treedict_TreeDictIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("treedict.treedict.TreeDictIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_8treedict_8treedict_TreeDictIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8treedict_8treedict_TreeDictIterator, /*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_TreeDictIterator, /*tp_as_number*/
  &__pyx_tp_as_sequence_TreeDictIterator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_TreeDictIterator, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_TreeDictIterator, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8treedict_8treedict_TreeDictIterator, /*tp_traverse*/
  __pyx_tp_clear_8treedict_8treedict_TreeDictIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_8treedict_8treedict_16TreeDictIterator___iter__, /*tp_iter*/
  __pyx_pf_8treedict_8treedict_16TreeDictIterator___next__, /*tp_iternext*/
  __pyx_methods_8treedict_8treedict_TreeDictIterator, /*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_8treedict_8treedict_TreeDictIterator, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_8treedict_8treedict__PTreeNode __pyx_vtable_8treedict_8treedict__PTreeNode;

static PyObject *__pyx_tp_new_8treedict_8treedict__PTreeNode(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_8treedict_8treedict__PTreeNode *)o);
  p->__pyx_vtab = __pyx_vtabptr_8treedict_8treedict__PTreeNode;
  p->_v = Py_None; Py_INCREF(Py_None);
  p->_aux_dict = ((PyObject *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_8treedict_8treedict__PTreeNode(PyObject *o) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *p = (struct __pyx_obj_8treedict_8treedict__PTreeNode *)o;
  Py_XDECREF(p->_v);
  Py_XDECREF(((PyObject *)p->_aux_dict));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8treedict_8treedict__PTreeNode(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8treedict_8treedict__PTreeNode *p = (struct __pyx_obj_8treedict_8treedict__PTreeNode *)o;
  if (p->_v) {
    e = (*v)(p->_v, a); if (e) return e;
  }
  if (p->_aux_dict) {
    e = (*v)(p->_aux_dict, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8treedict_8treedict__PTreeNode(PyObject *o) {
  struct __pyx_obj_8treedict_8treedict__PTreeNode *p = (struct __pyx_obj_8treedict_8treedict__PTreeNode *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_v);
  p->_v = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_aux_dict);
  p->_aux_dict = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_8treedict_8treedict__PTreeNode[] = {
  {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_8treedict_8treedict_10_PTreeNode___reduce__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__PTreeNode = {
  0, /*nb_add*/
  0, /*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*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*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*/
  0, /*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*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

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

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

static PyBufferProcs __pyx_tp_as_buffer__PTreeNode = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_8treedict_8treedict__PTreeNode = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("treedict.treedict._PTreeNode"), /*tp_name*/
  sizeof(struct __pyx_obj_8treedict_8treedict__PTreeNode), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8treedict_8treedict__PTreeNode, /*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__PTreeNode, /*tp_as_number*/
  &__pyx_tp_as_sequence__PTreeNode, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__PTreeNode, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__PTreeNode, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8treedict_8treedict__PTreeNode, /*tp_traverse*/
  __pyx_tp_clear_8treedict_8treedict__PTreeNode, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8treedict_8treedict__PTreeNode, /*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_8treedict_8treedict__PTreeNode, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_8treedict_8treedict__NoDefault(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  return o;
}

static void __pyx_tp_dealloc_8treedict_8treedict__NoDefault(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_8treedict_8treedict__NoDefault[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__NoDefault = {
  0, /*nb_add*/
  0, /*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*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*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*/
  0, /*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*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

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

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

static PyBufferProcs __pyx_tp_as_buffer__NoDefault = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_8treedict_8treedict__NoDefault = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("treedict.treedict._NoDefault"), /*tp_name*/
  sizeof(struct __pyx_obj_8treedict_8treedict__NoDefault), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8treedict_8treedict__NoDefault, /*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__NoDefault, /*tp_as_number*/
  &__pyx_tp_as_sequence__NoDefault, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__NoDefault, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__NoDefault, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8treedict_8treedict__NoDefault, /*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_8treedict_8treedict__NoDefault, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {__Pyx_NAMESTR("getTree"), (PyCFunction)__pyx_pf_8treedict_8treedict_getTree, METH_O, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_getTree)},
  {__Pyx_NAMESTR("treeExists"), (PyCFunction)__pyx_pf_8treedict_8treedict_treeExists, METH_O, __Pyx_DOCSTR(__pyx_doc_8treedict_8treedict_treeExists)},
  {__Pyx_NAMESTR("_PTreeNode_unpickler"), (PyCFunction)__pyx_pf_8treedict_8treedict__PTreeNode_unpickler, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_TreeDict_unpickler"), (PyCFunction)__pyx_pf_8treedict_8treedict__TreeDict_unpickler, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_ldist"), (PyCFunction)__pyx_pf_8treedict_8treedict__ldist, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("treedict"),
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_n_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 1},
  {&__pyx_kp_u_100, __pyx_k_100, sizeof(__pyx_k_100), 0, 1, 0, 0},
  {&__pyx_kp_u_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 1, 0, 0},
  {&__pyx_kp_u_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 1, 0, 0},
  {&__pyx_kp_u_103, __pyx_k_103, sizeof(__pyx_k_103), 0, 1, 0, 0},
  {&__pyx_kp_u_104, __pyx_k_104, sizeof(__pyx_k_104), 0, 1, 0, 0},
  {&__pyx_kp_u_105, __pyx_k_105, sizeof(__pyx_k_105), 0, 1, 0, 0},
  {&__pyx_kp_u_106, __pyx_k_106, sizeof(__pyx_k_106), 0, 1, 0, 0},
  {&__pyx_kp_u_107, __pyx_k_107, sizeof(__pyx_k_107), 0, 1, 0, 0},
  {&__pyx_kp_u_108, __pyx_k_108, sizeof(__pyx_k_108), 0, 1, 0, 0},
  {&__pyx_kp_u_109, __pyx_k_109, sizeof(__pyx_k_109), 0, 1, 0, 0},
  {&__pyx_n_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 1},
  {&__pyx_kp_u_110, __pyx_k_110, sizeof(__pyx_k_110), 0, 1, 0, 0},
  {&__pyx_kp_u_111, __pyx_k_111, sizeof(__pyx_k_111), 0, 1, 0, 0},
  {&__pyx_kp_u_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 1, 0, 0},
  {&__pyx_kp_u_113, __pyx_k_113, sizeof(__pyx_k_113), 0, 1, 0, 0},
  {&__pyx_kp_u_114, __pyx_k_114, sizeof(__pyx_k_114), 0, 1, 0, 0},
  {&__pyx_kp_u_115, __pyx_k_115, sizeof(__pyx_k_115), 0, 1, 0, 0},
  {&__pyx_kp_u_116, __pyx_k_116, sizeof(__pyx_k_116), 0, 1, 0, 0},
  {&__pyx_kp_u_117, __pyx_k_117, sizeof(__pyx_k_117), 0, 1, 0, 0},
  {&__pyx_kp_u_118, __pyx_k_118, sizeof(__pyx_k_118), 0, 1, 0, 0},
  {&__pyx_kp_u_119, __pyx_k_119, sizeof(__pyx_k_119), 0, 1, 0, 0},
  {&__pyx_n_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 1},
  {&__pyx_kp_u_120, __pyx_k_120, sizeof(__pyx_k_120), 0, 1, 0, 0},
  {&__pyx_kp_u_121, __pyx_k_121, sizeof(__pyx_k_121), 0, 1, 0, 0},
  {&__pyx_kp_u_122, __pyx_k_122, sizeof(__pyx_k_122), 0, 1, 0, 0},
  {&__pyx_kp_u_123, __pyx_k_123, sizeof(__pyx_k_123), 0, 1, 0, 0},
  {&__pyx_kp_u_124, __pyx_k_124, sizeof(__pyx_k_124), 0, 1, 0, 0},
  {&__pyx_kp_u_125, __pyx_k_125, sizeof(__pyx_k_125), 0, 1, 0, 0},
  {&__pyx_kp_u_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 1, 0, 0},
  {&__pyx_kp_u_127, __pyx_k_127, sizeof(__pyx_k_127), 0, 1, 0, 0},
  {&__pyx_kp_u_128, __pyx_k_128, sizeof(__pyx_k_128), 0, 1, 0, 0},
  {&__pyx_kp_u_129, __pyx_k_129, sizeof(__pyx_k_129), 0, 1, 0, 0},
  {&__pyx_kp_u_130, __pyx_k_130, sizeof(__pyx_k_130), 0, 1, 0, 0},
  {&__pyx_kp_u_131, __pyx_k_131, sizeof(__pyx_k_131), 0, 1, 0, 0},
  {&__pyx_kp_u_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 1, 0, 0},
  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
  {&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1},
  {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
  {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
  {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
  {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
  {&__pyx_n_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 1},
  {&__pyx_n_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 1},
  {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
  {&__pyx_n_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 1},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
  {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
  {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
  {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
  {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
  {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
  {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
  {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
  {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
  {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
  {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0},
  {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
  {&__pyx_n_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 1},
  {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
  {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
  {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0},
  {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0},
  {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
  {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
  {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0},
  {&__pyx_n_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 1},
  {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
  {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0},
  {&__pyx_n_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 1},
  {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0},
  {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0},
  {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0},
  {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
  {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0},
  {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0},
  {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0},
  {&__pyx_kp_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 0},
  {&__pyx_n_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 1},
  {&__pyx_n_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 1},
  {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0},
  {&__pyx_kp_s_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 0, 1, 0},
  {&__pyx_kp_s_68, __pyx_k_68, sizeof(__pyx_k_68), 0, 0, 1, 0},
  {&__pyx_n_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 1},
  {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
  {&__pyx_kp_s_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 0, 1, 0},
  {&__pyx_kp_s_72, __pyx_k_72, sizeof(__pyx_k_72), 0, 0, 1, 0},
  {&__pyx_kp_s_73, __pyx_k_73, sizeof(__pyx_k_73), 0, 0, 1, 0},
  {&__pyx_n_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 1},
  {&__pyx_n_s_75, __pyx_k_75, sizeof(__pyx_k_75), 0, 0, 1, 1},
  {&__pyx_n_s_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 0, 1, 1},
  {&__pyx_n_s_77, __pyx_k_77, sizeof(__pyx_k_77), 0, 0, 1, 1},
  {&__pyx_kp_s_78, __pyx_k_78, sizeof(__pyx_k_78), 0, 0, 1, 0},
  {&__pyx_n_s_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 1, 1},
  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
  {&__pyx_n_s_80, __pyx_k_80, sizeof(__pyx_k_80), 0, 0, 1, 1},
  {&__pyx_n_s_81, __pyx_k_81, sizeof(__pyx_k_81), 0, 0, 1, 1},
  {&__pyx_n_s_82, __pyx_k_82, sizeof(__pyx_k_82), 0, 0, 1, 1},
  {&__pyx_n_s_83, __pyx_k_83, sizeof(__pyx_k_83), 0, 0, 1, 1},
  {&__pyx_n_s_84, __pyx_k_84, sizeof(__pyx_k_84), 0, 0, 1, 1},
  {&__pyx_n_s_85, __pyx_k_85, sizeof(__pyx_k_85), 0, 0, 1, 1},
  {&__pyx_kp_s_86, __pyx_k_86, sizeof(__pyx_k_86), 0, 0, 1, 0},
  {&__pyx_kp_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 0},
  {&__pyx_kp_s_88, __pyx_k_88, sizeof(__pyx_k_88), 0, 0, 1, 0},
  {&__pyx_kp_u_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 1, 0, 0},
  {&__pyx_n_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 1},
  {&__pyx_kp_u_90, __pyx_k_90, sizeof(__pyx_k_90), 0, 1, 0, 0},
  {&__pyx_kp_u_91, __pyx_k_91, sizeof(__pyx_k_91), 0, 1, 0, 0},
  {&__pyx_kp_u_92, __pyx_k_92, sizeof(__pyx_k_92), 0, 1, 0, 0},
  {&__pyx_kp_u_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 1, 0, 0},
  {&__pyx_kp_u_94, __pyx_k_94, sizeof(__pyx_k_94), 0, 1, 0, 0},
  {&__pyx_kp_u_95, __pyx_k_95, sizeof(__pyx_k_95), 0, 1, 0, 0},
  {&__pyx_kp_u_96, __pyx_k_96, sizeof(__pyx_k_96), 0, 1, 0, 0},
  {&__pyx_kp_u_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 1, 0, 0},
  {&__pyx_kp_u_98, __pyx_k_98, sizeof(__pyx_k_98), 0, 1, 0, 0},
  {&__pyx_kp_u_99, __pyx_k_99, sizeof(__pyx_k_99), 0, 1, 0, 0},
  {&__pyx_n_s__AttributeError, __pyx_k__AttributeError, sizeof(__pyx_k__AttributeError), 0, 0, 1, 1},
  {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
  {&__pyx_n_s__HashError, __pyx_k__HashError, sizeof(__pyx_k__HashError), 0, 0, 1, 1},
  {&__pyx_n_s__InteractiveTreeDict, __pyx_k__InteractiveTreeDict, sizeof(__pyx_k__InteractiveTreeDict), 0, 0, 1, 1},
  {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
  {&__pyx_n_s__MemoryError, __pyx_k__MemoryError, sizeof(__pyx_k__MemoryError), 0, 0, 1, 1},
  {&__pyx_n_s__NameError, __pyx_k__NameError, sizeof(__pyx_k__NameError), 0, 0, 1, 1},
  {&__pyx_n_s__OverflowError, __pyx_k__OverflowError, sizeof(__pyx_k__OverflowError), 0, 0, 1, 1},
  {&__pyx_n_s__PicklingError, __pyx_k__PicklingError, sizeof(__pyx_k__PicklingError), 0, 0, 1, 1},
  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1},
  {&__pyx_n_s__TreeDict, __pyx_k__TreeDict, sizeof(__pyx_k__TreeDict), 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___TreeDict_unpickler, __pyx_k___TreeDict_unpickler, sizeof(__pyx_k___TreeDict_unpickler), 0, 0, 1, 1},
  {&__pyx_n_s____eq__, __pyx_k____eq__, sizeof(__pyx_k____eq__), 0, 0, 1, 1},
  {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____reduce__, __pyx_k____reduce__, sizeof(__pyx_k____reduce__), 0, 0, 1, 1},
  {&__pyx_n_s____setattr__, __pyx_k____setattr__, sizeof(__pyx_k____setattr__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s___attach, __pyx_k___attach, sizeof(__pyx_k___attach), 0, 0, 1, 1},
  {&__pyx_n_s___attachDanglingSelf, __pyx_k___attachDanglingSelf, sizeof(__pyx_k___attachDanglingSelf), 0, 0, 1, 1},
  {&__pyx_n_s___auth_key, __pyx_k___auth_key, sizeof(__pyx_k___auth_key), 0, 0, 1, 1},
  {&__pyx_n_s___aux_dict, __pyx_k___aux_dict, sizeof(__pyx_k___aux_dict), 0, 0, 1, 1},
  {&__pyx_n_s___branchName, __pyx_k___branchName, sizeof(__pyx_k___branchName), 0, 0, 1, 1},
  {&__pyx_n_s___branchNameOf, __pyx_k___branchNameOf, sizeof(__pyx_k___branchNameOf), 0, 0, 1, 1},
  {&__pyx_n_s___branch_mode, __pyx_k___branch_mode, sizeof(__pyx_k___branch_mode), 0, 0, 1, 1},
  {&__pyx_n_s___branches, __pyx_k___branches, sizeof(__pyx_k___branches), 0, 0, 1, 1},
  {&__pyx_n_s___cached_hash, __pyx_k___cached_hash, sizeof(__pyx_k___cached_hash), 0, 0, 1, 1},
  {&__pyx_n_s___copy, __pyx_k___copy, sizeof(__pyx_k___copy), 0, 0, 1, 1},
  {&__pyx_n_s___copyValue, __pyx_k___copyValue, sizeof(__pyx_k___copyValue), 0, 0, 1, 1},
  {&__pyx_n_s___cur_depth, __pyx_k___cur_depth, sizeof(__pyx_k___cur_depth), 0, 0, 1, 1},
  {&__pyx_n_s___cur_pt, __pyx_k___cur_pt, sizeof(__pyx_k___cur_pt), 0, 0, 1, 1},
  {&__pyx_n_s___currentRetValue, __pyx_k___currentRetValue, sizeof(__pyx_k___currentRetValue), 0, 0, 1, 1},
  {&__pyx_n_s___current_key, __pyx_k___current_key, sizeof(__pyx_k___current_key), 0, 0, 1, 1},
  {&__pyx_n_s___cut, __pyx_k___cut, sizeof(__pyx_k___cut), 0, 0, 1, 1},
  {&__pyx_n_s___decRefToCurTree, __pyx_k___decRefToCurTree, sizeof(__pyx_k___decRefToCurTree), 0, 0, 1, 1},
  {&__pyx_n_s___encode_hash, __pyx_k___encode_hash, sizeof(__pyx_k___encode_hash), 0, 0, 1, 1},
  {&__pyx_n_s___ensureWriteable, __pyx_k___ensureWriteable, sizeof(__pyx_k___ensureWriteable), 0, 0, 1, 1},
  {&__pyx_n_s___exists, __pyx_k___exists, sizeof(__pyx_k___exists), 0, 0, 1, 1},
  {&__pyx_n_s___existsLocal, __pyx_k___existsLocal, sizeof(__pyx_k___existsLocal), 0, 0, 1, 1},
  {&__pyx_n_s___firstMutableType, __pyx_k___firstMutableType, sizeof(__pyx_k___firstMutableType), 0, 0, 1, 1},
  {&__pyx_n_s___first_iter_run_yet, __pyx_k___first_iter_run_yet, sizeof(__pyx_k___first_iter_run_yet), 0, 0, 1, 1},
  {&__pyx_n_s___flags, __pyx_k___flags, sizeof(__pyx_k___flags), 0, 0, 1, 1},
  {&__pyx_n_s___freeze_tree, __pyx_k___freeze_tree, sizeof(__pyx_k___freeze_tree), 0, 0, 1, 1},
  {&__pyx_n_s___fullKey, __pyx_k___fullKey, sizeof(__pyx_k___fullKey), 0, 0, 1, 1},
  {&__pyx_n_s___fullNameOf, __pyx_k___fullNameOf, sizeof(__pyx_k___fullNameOf), 0, 0, 1, 1},
  {&__pyx_n_s___get, __pyx_k___get, sizeof(__pyx_k___get), 0, 0, 1, 1},
  {&__pyx_n_s___getBaseOf, __pyx_k___getBaseOf, sizeof(__pyx_k___getBaseOf), 0, 0, 1, 1},
  {&__pyx_n_s___getBottomNode, __pyx_k___getBottomNode, sizeof(__pyx_k___getBottomNode), 0, 0, 1, 1},
  {&__pyx_n_s___getBranch, __pyx_k___getBranch, sizeof(__pyx_k___getBranch), 0, 0, 1, 1},
  {&__pyx_n_s___getBranchMode, __pyx_k___getBranchMode, sizeof(__pyx_k___getBranchMode), 0, 0, 1, 1},
  {&__pyx_n_s___getIter, __pyx_k___getIter, sizeof(__pyx_k___getIter), 0, 0, 1, 1},
  {&__pyx_n_s___getListFromIter, __pyx_k___getListFromIter, sizeof(__pyx_k___getListFromIter), 0, 0, 1, 1},
  {&__pyx_n_s___getListOfClosest, __pyx_k___getListOfClosest, sizeof(__pyx_k___getListOfClosest), 0, 0, 1, 1},
  {&__pyx_n_s___getLocal, __pyx_k___getLocal, sizeof(__pyx_k___getLocal), 0, 0, 1, 1},
  {&__pyx_n_s___getLocalBranch, __pyx_k___getLocalBranch, sizeof(__pyx_k___getLocalBranch), 0, 0, 1, 1},
  {&__pyx_n_s___getLocalPTNode, __pyx_k___getLocalPTNode, sizeof(__pyx_k___getLocalPTNode), 0, 0, 1, 1},
  {&__pyx_n_s___getNextOrderValue, __pyx_k___getNextOrderValue, sizeof(__pyx_k___getNextOrderValue), 0, 0, 1, 1},
  {&__pyx_n_s___getPTNode, __pyx_k___getPTNode, sizeof(__pyx_k___getPTNode), 0, 0, 1, 1},
  {&__pyx_n_s___getSingleClosest, __pyx_k___getSingleClosest, sizeof(__pyx_k___getSingleClosest), 0, 0, 1, 1},
  {&__pyx_n_s___hit_flag, __pyx_k___hit_flag, sizeof(__pyx_k___hit_flag), 0, 0, 1, 1},
  {&__pyx_n_s___immutableHash, __pyx_k___immutableHash, sizeof(__pyx_k___immutableHash), 0, 0, 1, 1},
  {&__pyx_n_s___inPathToRoot, __pyx_k___inPathToRoot, sizeof(__pyx_k___inPathToRoot), 0, 0, 1, 1},
  {&__pyx_n_s___incRefToCurTree, __pyx_k___incRefToCurTree, sizeof(__pyx_k___incRefToCurTree), 0, 0, 1, 1},
  {&__pyx_n_s___init, __pyx_k___init, sizeof(__pyx_k___init), 0, 0, 1, 1},
  {&__pyx_n_s___isDetachedDangling, __pyx_k___isDetachedDangling, sizeof(__pyx_k___isDetachedDangling), 0, 0, 1, 1},
  {&__pyx_n_s___isEqual, __pyx_k___isEqual, sizeof(__pyx_k___isEqual), 0, 0, 1, 1},
  {&__pyx_n_s___item_hash, __pyx_k___item_hash, sizeof(__pyx_k___item_hash), 0, 0, 1, 1},
  {&__pyx_n_s___item_set_hash, __pyx_k___item_set_hash, sizeof(__pyx_k___item_set_hash), 0, 0, 1, 1},
  {&__pyx_n_s___itertype, __pyx_k___itertype, sizeof(__pyx_k___itertype), 0, 0, 1, 1},
  {&__pyx_n_s___keyDeleted, __pyx_k___keyDeleted, sizeof(__pyx_k___keyDeleted), 0, 0, 1, 1},
  {&__pyx_n_s___keyInserted, __pyx_k___keyInserted, sizeof(__pyx_k___keyInserted), 0, 0, 1, 1},
  {&__pyx_n_s___key_stack, __pyx_k___key_stack, sizeof(__pyx_k___key_stack), 0, 0, 1, 1},
  {&__pyx_n_s___last_key, __pyx_k___last_key, sizeof(__pyx_k___last_key), 0, 0, 1, 1},
  {&__pyx_n_s___last_pn, __pyx_k___last_pn, sizeof(__pyx_k___last_pn), 0, 0, 1, 1},
  {&__pyx_n_s___loadNext, __pyx_k___loadNext, sizeof(__pyx_k___loadNext), 0, 0, 1, 1},
  {&__pyx_n_s___local_size, __pyx_k___local_size, sizeof(__pyx_k___local_size), 0, 0, 1, 1},
  {&__pyx_n_s___n_dangling, __pyx_k___n_dangling, sizeof(__pyx_k___n_dangling), 0, 0, 1, 1},
  {&__pyx_n_s___n_mutable, __pyx_k___n_mutable, sizeof(__pyx_k___n_mutable), 0, 0, 1, 1},
  {&__pyx_n_s___name, __pyx_k___name, sizeof(__pyx_k___name), 0, 0, 1, 1},
  {&__pyx_n_s___newLocalBranch, __pyx_k___newLocalBranch, sizeof(__pyx_k___newLocalBranch), 0, 0, 1, 1},
  {&__pyx_n_s___next, __pyx_k___next, sizeof(__pyx_k___next), 0, 0, 1, 1},
  {&__pyx_n_s___next_return_value, __pyx_k___next_return_value, sizeof(__pyx_k___next_return_value), 0, 0, 1, 1},
  {&__pyx_n_s___order_position, __pyx_k___order_position, sizeof(__pyx_k___order_position), 0, 0, 1, 1},
  {&__pyx_n_s___param_dict, __pyx_k___param_dict, sizeof(__pyx_k___param_dict), 0, 0, 1, 1},
  {&__pyx_n_s___parent, __pyx_k___parent, sizeof(__pyx_k___parent), 0, 0, 1, 1},
  {&__pyx_n_s___pop, __pyx_k___pop, sizeof(__pyx_k___pop), 0, 0, 1, 1},
  {&__pyx_n_s___pos_array, __pyx_k___pos_array, sizeof(__pyx_k___pos_array), 0, 0, 1, 1},
  {&__pyx_n_s___pos_array_size, __pyx_k___pos_array_size, sizeof(__pyx_k___pos_array_size), 0, 0, 1, 1},
  {&__pyx_n_s___prune, __pyx_k___prune, sizeof(__pyx_k___prune), 0, 0, 1, 1},
  {&__pyx_n_s___recursive, __pyx_k___recursive, sizeof(__pyx_k___recursive), 0, 0, 1, 1},
  {&__pyx_n_s___recursiveAttach, __pyx_k___recursiveAttach, sizeof(__pyx_k___recursiveAttach), 0, 0, 1, 1},
  {&__pyx_n_s___recursiveCopy, __pyx_k___recursiveCopy, sizeof(__pyx_k___recursiveCopy), 0, 0, 1, 1},
  {&__pyx_n_s___reportable_hash, __pyx_k___reportable_hash, sizeof(__pyx_k___reportable_hash), 0, 0, 1, 1},
  {&__pyx_n_s___resetParentNode, __pyx_k___resetParentNode, sizeof(__pyx_k___resetParentNode), 0, 0, 1, 1},
  {&__pyx_n_s___reset_branches, __pyx_k___reset_branches, sizeof(__pyx_k___reset_branches), 0, 0, 1, 1},
  {&__pyx_n_s___reworkOrderValues, __pyx_k___reworkOrderValues, sizeof(__pyx_k___reworkOrderValues), 0, 0, 1, 1},
  {&__pyx_n_s___runFullHash, __pyx_k___runFullHash, sizeof(__pyx_k___runFullHash), 0, 0, 1, 1},
  {&__pyx_n_s___runImmutableHash, __pyx_k___runImmutableHash, sizeof(__pyx_k___runImmutableHash), 0, 0, 1, 1},
  {&__pyx_n_s___run__cinit__, __pyx_k___run__cinit__, sizeof(__pyx_k___run__cinit__), 0, 0, 1, 1},
  {&__pyx_n_s___run__init__, __pyx_k___run__init__, sizeof(__pyx_k___run__init__), 0, 0, 1, 1},
  {&__pyx_n_s___self_hash, __pyx_k___self_hash, sizeof(__pyx_k___self_hash), 0, 0, 1, 1},
  {&__pyx_n_s___set, __pyx_k___set, sizeof(__pyx_k___set), 0, 0, 1, 1},
  {&__pyx_n_s___setAll, __pyx_k___setAll, sizeof(__pyx_k___setAll), 0, 0, 1, 1},
  {&__pyx_n_s___setAttrDirect, __pyx_k___setAttrDirect, sizeof(__pyx_k___setAttrDirect), 0, 0, 1, 1},
  {&__pyx_n_s___setCurrentKey, __pyx_k___setCurrentKey, sizeof(__pyx_k___setCurrentKey), 0, 0, 1, 1},
  {&__pyx_n_s___setDangling, __pyx_k___setDangling, sizeof(__pyx_k___setDangling), 0, 0, 1, 1},
  {&__pyx_n_s___setFrozen, __pyx_k___setFrozen, sizeof(__pyx_k___setFrozen), 0, 0, 1, 1},
  {&__pyx_n_s___setLocal, __pyx_k___setLocal, sizeof(__pyx_k___setLocal), 0, 0, 1, 1},
  {&__pyx_n_s___setLocalBranch, __pyx_k___setLocalBranch, sizeof(__pyx_k___setLocalBranch), 0, 0, 1, 1},
  {&__pyx_n_s___setRegistered, __pyx_k___setRegistered, sizeof(__pyx_k___setRegistered), 0, 0, 1, 1},
  {&__pyx_n_s___setRegisteredFlag, __pyx_k___setRegisteredFlag, sizeof(__pyx_k___setRegisteredFlag), 0, 0, 1, 1},
  {&__pyx_n_s___set_it, __pyx_k___set_it, sizeof(__pyx_k___set_it), 0, 0, 1, 1},
  {&__pyx_n_s___shortKeyName, __pyx_k___shortKeyName, sizeof(__pyx_k___shortKeyName), 0, 0, 1, 1},
  {&__pyx_n_s___size, __pyx_k___size, sizeof(__pyx_k___size), 0, 0, 1, 1},
  {&__pyx_n_s___stop_on_next, __pyx_k___stop_on_next, sizeof(__pyx_k___stop_on_next), 0, 0, 1, 1},
  {&__pyx_n_s___t, __pyx_k___t, sizeof(__pyx_k___t), 0, 0, 1, 1},
  {&__pyx_n_s___update, __pyx_k___update, sizeof(__pyx_k___update), 0, 0, 1, 1},
  {&__pyx_n_s___v, __pyx_k___v, sizeof(__pyx_k___v), 0, 0, 1, 1},
  {&__pyx_n_s__add_name, __pyx_k__add_name, sizeof(__pyx_k__add_name), 0, 0, 1, 1},
  {&__pyx_n_s__add_path, __pyx_k__add_path, sizeof(__pyx_k__add_path), 0, 0, 1, 1},
  {&__pyx_n_s__add_tree_name, __pyx_k__add_tree_name, sizeof(__pyx_k__add_tree_name), 0, 0, 1, 1},
  {&__pyx_n_s__all, __pyx_k__all, sizeof(__pyx_k__all), 0, 0, 1, 1},
  {&__pyx_n_s__attach, __pyx_k__attach, sizeof(__pyx_k__attach), 0, 0, 1, 1},
  {&__pyx_n_s__aux_dict, __pyx_k__aux_dict, sizeof(__pyx_k__aux_dict), 0, 0, 1, 1},
  {&__pyx_n_s__b64encode, __pyx_k__b64encode, sizeof(__pyx_k__b64encode), 0, 0, 1, 1},
  {&__pyx_n_s__base64, __pyx_k__base64, sizeof(__pyx_k__base64), 0, 0, 1, 1},
  {&__pyx_n_s__branch, __pyx_k__branch, sizeof(__pyx_k__branch), 0, 0, 1, 1},
  {&__pyx_n_s__branchName, __pyx_k__branchName, sizeof(__pyx_k__branchName), 0, 0, 1, 1},
  {&__pyx_n_s__branch_mode, __pyx_k__branch_mode, sizeof(__pyx_k__branch_mode), 0, 0, 1, 1},
  {&__pyx_n_s__branches, __pyx_k__branches, sizeof(__pyx_k__branches), 0, 0, 1, 1},
  {&__pyx_n_s__cPickle, __pyx_k__cPickle, sizeof(__pyx_k__cPickle), 0, 0, 1, 1},
  {&__pyx_n_s__checkset, __pyx_k__checkset, sizeof(__pyx_k__checkset), 0, 0, 1, 1},
  {&__pyx_n_s__clear, __pyx_k__clear, sizeof(__pyx_k__clear), 0, 0, 1, 1},
  {&__pyx_n_s__compile, __pyx_k__compile, sizeof(__pyx_k__compile), 0, 0, 1, 1},
  {&__pyx_n_s__copied_node, __pyx_k__copied_node, sizeof(__pyx_k__copied_node), 0, 0, 1, 1},
  {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1},
  {&__pyx_n_s__copy_module, __pyx_k__copy_module, sizeof(__pyx_k__copy_module), 0, 0, 1, 1},
  {&__pyx_n_s__currentKey, __pyx_k__currentKey, sizeof(__pyx_k__currentKey), 0, 0, 1, 1},
  {&__pyx_n_s__currentPTreeNode, __pyx_k__currentPTreeNode, sizeof(__pyx_k__currentPTreeNode), 0, 0, 1, 1},
  {&__pyx_n_s__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1},
  {&__pyx_n_s__deep, __pyx_k__deep, sizeof(__pyx_k__deep), 0, 0, 1, 1},
  {&__pyx_n_s__deepcopy, __pyx_k__deepcopy, sizeof(__pyx_k__deepcopy), 0, 0, 1, 1},
  {&__pyx_n_s__default_value, __pyx_k__default_value, sizeof(__pyx_k__default_value), 0, 0, 1, 1},
  {&__pyx_n_s__digest, __pyx_k__digest, sizeof(__pyx_k__digest), 0, 0, 1, 1},
  {&__pyx_n_s__dumps, __pyx_k__dumps, sizeof(__pyx_k__dumps), 0, 0, 1, 1},
  {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1},
  {&__pyx_n_s__eval, __pyx_k__eval, sizeof(__pyx_k__eval), 0, 0, 1, 1},
  {&__pyx_n_s__exists, __pyx_k__exists, sizeof(__pyx_k__exists), 0, 0, 1, 1},
  {&__pyx_n_s__extra_variables, __pyx_k__extra_variables, sizeof(__pyx_k__extra_variables), 0, 0, 1, 1},
  {&__pyx_n_s__find, __pyx_k__find, sizeof(__pyx_k__find), 0, 0, 1, 1},
  {&__pyx_n_s__freeze, __pyx_k__freeze, sizeof(__pyx_k__freeze), 0, 0, 1, 1},
  {&__pyx_n_s__fromdict, __pyx_k__fromdict, sizeof(__pyx_k__fromdict), 0, 0, 1, 1},
  {&__pyx_n_s__fromkeys, __pyx_k__fromkeys, sizeof(__pyx_k__fromkeys), 0, 0, 1, 1},
  {&__pyx_n_s__fullHash, __pyx_k__fullHash, sizeof(__pyx_k__fullHash), 0, 0, 1, 1},
  {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1},
  {&__pyx_n_s__getClosestKey, __pyx_k__getClosestKey, sizeof(__pyx_k__getClosestKey), 0, 0, 1, 1},
  {&__pyx_n_s__getTree, __pyx_k__getTree, sizeof(__pyx_k__getTree), 0, 0, 1, 1},
  {&__pyx_n_s__getattr, __pyx_k__getattr, sizeof(__pyx_k__getattr), 0, 0, 1, 1},
  {&__pyx_n_s__goDownStack, __pyx_k__goDownStack, sizeof(__pyx_k__goDownStack), 0, 0, 1, 1},
  {&__pyx_n_s__goUpStack, __pyx_k__goUpStack, sizeof(__pyx_k__goUpStack), 0, 0, 1, 1},
  {&__pyx_n_s__hasBeenCopied, __pyx_k__hasBeenCopied, sizeof(__pyx_k__hasBeenCopied), 0, 0, 1, 1},
  {&__pyx_n_s__has_key, __pyx_k__has_key, sizeof(__pyx_k__has_key), 0, 0, 1, 1},
  {&__pyx_n_s__hash, __pyx_k__hash, sizeof(__pyx_k__hash), 0, 0, 1, 1},
  {&__pyx_n_s__hashlib, __pyx_k__hashlib, sizeof(__pyx_k__hashlib), 0, 0, 1, 1},
  {&__pyx_n_s__heappop, __pyx_k__heappop, sizeof(__pyx_k__heappop), 0, 0, 1, 1},
  {&__pyx_n_s__heappush, __pyx_k__heappush, sizeof(__pyx_k__heappush), 0, 0, 1, 1},
  {&__pyx_n_s__heapq, __pyx_k__heapq, sizeof(__pyx_k__heapq), 0, 0, 1, 1},
  {&__pyx_n_s__heapreplace, __pyx_k__heapreplace, sizeof(__pyx_k__heapreplace), 0, 0, 1, 1},
  {&__pyx_n_s__hexdigest, __pyx_k__hexdigest, sizeof(__pyx_k__hexdigest), 0, 0, 1, 1},
  {&__pyx_n_s__inspect, __pyx_k__inspect, sizeof(__pyx_k__inspect), 0, 0, 1, 1},
  {&__pyx_n_s__interactiveTree, __pyx_k__interactiveTree, sizeof(__pyx_k__interactiveTree), 0, 0, 1, 1},
  {&__pyx_n_s__ipt1, __pyx_k__ipt1, sizeof(__pyx_k__ipt1), 0, 0, 1, 1},
  {&__pyx_n_s__ipt2, __pyx_k__ipt2, sizeof(__pyx_k__ipt2), 0, 0, 1, 1},
  {&__pyx_n_s__isBranch, __pyx_k__isBranch, sizeof(__pyx_k__isBranch), 0, 0, 1, 1},
  {&__pyx_n_s__isCopyReferenced, __pyx_k__isCopyReferenced, sizeof(__pyx_k__isCopyReferenced), 0, 0, 1, 1},
  {&__pyx_n_s__isDangling, __pyx_k__isDangling, sizeof(__pyx_k__isDangling), 0, 0, 1, 1},
  {&__pyx_n_s__isDanglingBranch, __pyx_k__isDanglingBranch, sizeof(__pyx_k__isDanglingBranch), 0, 0, 1, 1},
  {&__pyx_n_s__isDanglingTree, __pyx_k__isDanglingTree, sizeof(__pyx_k__isDanglingTree), 0, 0, 1, 1},
  {&__pyx_n_s__isEmpty, __pyx_k__isEmpty, sizeof(__pyx_k__isEmpty), 0, 0, 1, 1},
  {&__pyx_n_s__isEqual, __pyx_k__isEqual, sizeof(__pyx_k__isEqual), 0, 0, 1, 1},
  {&__pyx_n_s__isFrozen, __pyx_k__isFrozen, sizeof(__pyx_k__isFrozen), 0, 0, 1, 1},
  {&__pyx_n_s__isImmutable, __pyx_k__isImmutable, sizeof(__pyx_k__isImmutable), 0, 0, 1, 1},
  {&__pyx_n_s__isIterReferenced, __pyx_k__isIterReferenced, sizeof(__pyx_k__isIterReferenced), 0, 0, 1, 1},
  {&__pyx_n_s__isMutable, __pyx_k__isMutable, sizeof(__pyx_k__isMutable), 0, 0, 1, 1},
  {&__pyx_n_s__isNonBranchTree, __pyx_k__isNonBranchTree, sizeof(__pyx_k__isNonBranchTree), 0, 0, 1, 1},
  {&__pyx_n_s__isRegistered, __pyx_k__isRegistered, sizeof(__pyx_k__isRegistered), 0, 0, 1, 1},
  {&__pyx_n_s__isRoot, __pyx_k__isRoot, sizeof(__pyx_k__isRoot), 0, 0, 1, 1},
  {&__pyx_n_s__isTree, __pyx_k__isTree, sizeof(__pyx_k__isTree), 0, 0, 1, 1},
  {&__pyx_n_s__items, __pyx_k__items, sizeof(__pyx_k__items), 0, 0, 1, 1},
  {&__pyx_n_s__iteratorDecRef, __pyx_k__iteratorDecRef, sizeof(__pyx_k__iteratorDecRef), 0, 0, 1, 1},
  {&__pyx_n_s__iteratorIncRef, __pyx_k__iteratorIncRef, sizeof(__pyx_k__iteratorIncRef), 0, 0, 1, 1},
  {&__pyx_n_s__iterbranches, __pyx_k__iterbranches, sizeof(__pyx_k__iterbranches), 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__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
  {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1},
  {&__pyx_n_s__key_iterable, __pyx_k__key_iterable, sizeof(__pyx_k__key_iterable), 0, 0, 1, 1},
  {&__pyx_n_s__keys, __pyx_k__keys, sizeof(__pyx_k__keys), 0, 0, 1, 1},
  {&__pyx_n_s__lower, __pyx_k__lower, sizeof(__pyx_k__lower), 0, 0, 1, 1},
  {&__pyx_n_s__m, __pyx_k__m, sizeof(__pyx_k__m), 0, 0, 1, 1},
  {&__pyx_n_s__makeBranch, __pyx_k__makeBranch, sizeof(__pyx_k__makeBranch), 0, 0, 1, 1},
  {&__pyx_n_s__makeReport, __pyx_k__makeReport, sizeof(__pyx_k__makeReport), 0, 0, 1, 1},
  {&__pyx_n_s__match, __pyx_k__match, sizeof(__pyx_k__match), 0, 0, 1, 1},
  {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1},
  {&__pyx_n_s__md5, __pyx_k__md5, sizeof(__pyx_k__md5), 0, 0, 1, 1},
  {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1},
  {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
  {&__pyx_n_s__nodeInSameTree, __pyx_k__nodeInSameTree, sizeof(__pyx_k__nodeInSameTree), 0, 0, 1, 1},
  {&__pyx_n_s__none, __pyx_k__none, sizeof(__pyx_k__none), 0, 0, 1, 1},
  {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1},
  {&__pyx_n_s__only, __pyx_k__only, sizeof(__pyx_k__only), 0, 0, 1, 1},
  {&__pyx_n_s__only_new, __pyx_k__only_new, sizeof(__pyx_k__only_new), 0, 0, 1, 1},
  {&__pyx_n_s__orderPosition, __pyx_k__orderPosition, sizeof(__pyx_k__orderPosition), 0, 0, 1, 1},
  {&__pyx_n_s__order_pos, __pyx_k__order_pos, sizeof(__pyx_k__order_pos), 0, 0, 1, 1},
  {&__pyx_n_s__overwrite, __pyx_k__overwrite, sizeof(__pyx_k__overwrite), 0, 0, 1, 1},
  {&__pyx_n_s__param_dict, __pyx_k__param_dict, sizeof(__pyx_k__param_dict), 0, 0, 1, 1},
  {&__pyx_n_s__parentNode, __pyx_k__parentNode, sizeof(__pyx_k__parentNode), 0, 0, 1, 1},
  {&__pyx_n_s__pop, __pyx_k__pop, sizeof(__pyx_k__pop), 0, 0, 1, 1},
  {&__pyx_n_s__popitem, __pyx_k__popitem, sizeof(__pyx_k__popitem), 0, 0, 1, 1},
  {&__pyx_n_s__protect_structure, __pyx_k__protect_structure, sizeof(__pyx_k__protect_structure), 0, 0, 1, 1},
  {&__pyx_n_s__protocol, __pyx_k__protocol, sizeof(__pyx_k__protocol), 0, 0, 1, 1},
  {&__pyx_n_s__prune_empty, __pyx_k__prune_empty, sizeof(__pyx_k__prune_empty), 0, 0, 1, 1},
  {&__pyx_n_s__ptree, __pyx_k__ptree, sizeof(__pyx_k__ptree), 0, 0, 1, 1},
  {&__pyx_n_s__quiet, __pyx_k__quiet, sizeof(__pyx_k__quiet), 0, 0, 1, 1},
  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  {&__pyx_n_s__re, __pyx_k__re, sizeof(__pyx_k__re), 0, 0, 1, 1},
  {&__pyx_n_s__recursive, __pyx_k__recursive, sizeof(__pyx_k__recursive), 0, 0, 1, 1},
  {&__pyx_n_s__ref, __pyx_k__ref, sizeof(__pyx_k__ref), 0, 0, 1, 1},
  {&__pyx_n_s__replace, __pyx_k__replace, sizeof(__pyx_k__replace), 0, 0, 1, 1},
  {&__pyx_n_s__reversed, __pyx_k__reversed, sizeof(__pyx_k__reversed), 0, 0, 1, 1},
  {&__pyx_n_s__rfind, __pyx_k__rfind, sizeof(__pyx_k__rfind), 0, 0, 1, 1},
  {&__pyx_n_s__root, __pyx_k__root, sizeof(__pyx_k__root), 0, 0, 1, 1},
  {&__pyx_n_s__rootNode, __pyx_k__rootNode, sizeof(__pyx_k__rootNode), 0, 0, 1, 1},
  {&__pyx_n_s__runFullHash, __pyx_k__runFullHash, sizeof(__pyx_k__runFullHash), 0, 0, 1, 1},
  {&__pyx_n_s__runImmutableHash, __pyx_k__runImmutableHash, sizeof(__pyx_k__runImmutableHash), 0, 0, 1, 1},
  {&__pyx_n_s__s1, __pyx_k__s1, sizeof(__pyx_k__s1), 0, 0, 1, 1},
  {&__pyx_n_s__s2, __pyx_k__s2, sizeof(__pyx_k__s2), 0, 0, 1, 1},
  {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
  {&__pyx_n_s__set, __pyx_k__set, sizeof(__pyx_k__set), 0, 0, 1, 1},
  {&__pyx_n_s__setFromString, __pyx_k__setFromString, sizeof(__pyx_k__setFromString), 0, 0, 1, 1},
  {&__pyx_n_s__setOrderPostion, __pyx_k__setOrderPostion, sizeof(__pyx_k__setOrderPostion), 0, 0, 1, 1},
  {&__pyx_n_s__setdefault, __pyx_k__setdefault, sizeof(__pyx_k__setdefault), 0, 0, 1, 1},
  {&__pyx_n_s__silent, __pyx_k__silent, sizeof(__pyx_k__silent), 0, 0, 1, 1},
  {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
  {&__pyx_n_s__sorted, __pyx_k__sorted, sizeof(__pyx_k__sorted), 0, 0, 1, 1},
  {&__pyx_n_s__source, __pyx_k__source, sizeof(__pyx_k__source), 0, 0, 1, 1},
  {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1},
  {&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1},
  {&__pyx_n_s__t, __pyx_k__t, sizeof(__pyx_k__t), 0, 0, 1, 1},
  {&__pyx_n_s__tree, __pyx_k__tree, sizeof(__pyx_k__tree), 0, 0, 1, 1},
  {&__pyx_n_s__treeDict, __pyx_k__treeDict, sizeof(__pyx_k__treeDict), 0, 0, 1, 1},
  {&__pyx_n_s__treeExists, __pyx_k__treeExists, sizeof(__pyx_k__treeExists), 0, 0, 1, 1},
  {&__pyx_n_s__treeName, __pyx_k__treeName, sizeof(__pyx_k__treeName), 0, 0, 1, 1},
  {&__pyx_n_s__tree_name, __pyx_k__tree_name, sizeof(__pyx_k__tree_name), 0, 0, 1, 1},
  {&__pyx_n_s__tree_or_key, __pyx_k__tree_or_key, sizeof(__pyx_k__tree_or_key), 0, 0, 1, 1},
  {&__pyx_n_s__type, __pyx_k__type, sizeof(__pyx_k__type), 0, 0, 1, 1},
  {&__pyx_n_s__update, __pyx_k__update, sizeof(__pyx_k__update), 0, 0, 1, 1},
  {&__pyx_n_s__v, __pyx_k__v, sizeof(__pyx_k__v), 0, 0, 1, 1},
  {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1},
  {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1},
  {&__pyx_n_s__warn, __pyx_k__warn, sizeof(__pyx_k__warn), 0, 0, 1, 1},
  {&__pyx_n_s__warnings, __pyx_k__warnings, sizeof(__pyx_k__warnings), 0, 0, 1, 1},
  {&__pyx_n_s__weakref, __pyx_k__weakref, sizeof(__pyx_k__weakref), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_NameError = __Pyx_GetName(__pyx_b, __pyx_n_s__NameError); if (!__pyx_builtin_NameError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_sorted = __Pyx_GetName(__pyx_b, __pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_getattr = __Pyx_GetName(__pyx_b, __pyx_n_s__getattr); if (!__pyx_builtin_getattr) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_eval = __Pyx_GetName(__pyx_b, __pyx_n_s__eval); if (!__pyx_builtin_eval) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_OverflowError = __Pyx_GetName(__pyx_b, __pyx_n_s__OverflowError); if (!__pyx_builtin_OverflowError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_max = __Pyx_GetName(__pyx_b, __pyx_n_s__max); if (!__pyx_builtin_max) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_reversed = __Pyx_GetName(__pyx_b, __pyx_n_s__reversed); if (!__pyx_builtin_reversed) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitGlobals(void) {
  #if PY_VERSION_HEX < 0x02040000
  if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  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;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC inittreedict(void); /*proto*/
PyMODINIT_FUNC inittreedict(void)
#else
PyMODINIT_FUNC PyInit_treedict(void); /*proto*/
PyMODINIT_FUNC PyInit_treedict(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  #if CYTHON_REFNANNY
  void* __pyx_refnanny = NULL;
  __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");
  }
  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_treedict(void)", __LINE__, __FILE__);
  #endif
  __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_binding_PyCFunctionType_USED
  if (__pyx_binding_PyCFunctionType_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(__Pyx_NAMESTR("treedict"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_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 (__pyx_module_is_main_treedict__treedict) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  __pyx_v_8treedict_8treedict_md5 = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_dumps = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_PicklingError = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_copy_f = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_deepcopy_f = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_b64encode = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_heappop = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_heappush = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_heapreplace = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_strfind = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_strrfind = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_strlower = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_strsplit = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_new_weakref = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_s_IterReferenceCount = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_s_registration_tree_name = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_s_registration_branch_name = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_s_dangling_node_dependents = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_s_cached_hash = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_s_auth_key = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_s_hit_flag = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_s_immutable_items_hash = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_s_protect_structure = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_s_copied_node = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_s_copy_referencing_keys = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict_s_dangling_reference_queue = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict__string_name_validator = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict__string_name_validator_match = Py_None; Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict__tree_lookup_dict = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict__fast_type_determination = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict__branch_mode_lookup = ((PyObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_8treedict_8treedict__branch_mode_error_msg = Py_None; Py_INCREF(Py_None);
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_8treedict_8treedict_TreeDict = &__pyx_vtable_8treedict_8treedict_TreeDict;
  __pyx_vtable_8treedict_8treedict_TreeDict._run__cinit__ = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__run__cinit__;
  __pyx_vtable_8treedict_8treedict_TreeDict._run__init__ = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__run__init__;
  __pyx_vtable_8treedict_8treedict_TreeDict._setRegistered = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__setRegistered;
  __pyx_vtable_8treedict_8treedict_TreeDict._setAll = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, PyObject *, __pyx_t_8treedict_8treedict_flagtype))__pyx_f_8treedict_8treedict_8TreeDict__setAll;
  __pyx_vtable_8treedict_8treedict_TreeDict._set = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, PyObject *, __pyx_t_8treedict_8treedict_flagtype))__pyx_f_8treedict_8treedict_8TreeDict__set;
  __pyx_vtable_8treedict_8treedict_TreeDict._ensureWriteable = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__ensureWriteable;
  __pyx_vtable_8treedict_8treedict_TreeDict._setLocal = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, PyObject *, __pyx_t_8treedict_8treedict_flagtype))__pyx_f_8treedict_8treedict_8TreeDict__setLocal;
  __pyx_vtable_8treedict_8treedict_TreeDict._checkNodeAvailability = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__checkNodeAvailability;
  __pyx_vtable_8treedict_8treedict_TreeDict._getNextOrderValue = (size_t (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__getNextOrderValue;
  __pyx_vtable_8treedict_8treedict_TreeDict._reworkOrderValues = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__reworkOrderValues;
  __pyx_vtable_8treedict_8treedict_TreeDict.freeze = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_freeze *__pyx_optional_args))__pyx_f_8treedict_8treedict_8TreeDict_freeze;
  __pyx_vtable_8treedict_8treedict_TreeDict._freeze_tree = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__freeze_tree;
  __pyx_vtable_8treedict_8treedict_TreeDict._cut = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__cut;
  __pyx_vtable_8treedict_8treedict_TreeDict._raiseAttributeError = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__raiseAttributeError;
  __pyx_vtable_8treedict_8treedict_TreeDict._raiseErrorAtFirstNonDanglingBranch = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int))__pyx_f_8treedict_8treedict_8TreeDict__raiseErrorAtFirstNonDanglingBranch;
  __pyx_vtable_8treedict_8treedict_TreeDict._pop = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int, int))__pyx_f_8treedict_8treedict_8TreeDict__pop;
  __pyx_vtable_8treedict_8treedict_TreeDict._prune = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int))__pyx_f_8treedict_8treedict_8TreeDict__prune;
  __pyx_vtable_8treedict_8treedict_TreeDict._attach = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, struct __pyx_obj_8treedict_8treedict_TreeDict *, __pyx_t_8treedict_8treedict_flagtype))__pyx_f_8treedict_8treedict_8TreeDict__attach;
  __pyx_vtable_8treedict_8treedict_TreeDict._recursiveAttach = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, __pyx_t_8treedict_8treedict_flagtype))__pyx_f_8treedict_8treedict_8TreeDict__recursiveAttach;
  __pyx_vtable_8treedict_8treedict_TreeDict._inPathToRoot = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__inPathToRoot;
  __pyx_vtable_8treedict_8treedict_TreeDict._resetParentNode = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__resetParentNode;
  __pyx_vtable_8treedict_8treedict_TreeDict._shortKeyName = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__shortKeyName;
  __pyx_vtable_8treedict_8treedict_TreeDict.isFrozen = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict_isFrozen;
  __pyx_vtable_8treedict_8treedict_TreeDict._setFrozen = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int))__pyx_f_8treedict_8treedict_8TreeDict__setFrozen;
  __pyx_vtable_8treedict_8treedict_TreeDict.isDangling = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict_isDangling;
  __pyx_vtable_8treedict_8treedict_TreeDict._setDangling = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int))__pyx_f_8treedict_8treedict_8TreeDict__setDangling;
  __pyx_vtable_8treedict_8treedict_TreeDict._isDetachedDangling = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict__isDetachedDangling;
  __pyx_vtable_8treedict_8treedict_TreeDict._setDetachedDangling = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int))__pyx_f_8treedict_8treedict_8TreeDict__setDetachedDangling;
  __pyx_vtable_8treedict_8treedict_TreeDict.isRegistered = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict_isRegistered;
  __pyx_vtable_8treedict_8treedict_TreeDict._setRegisteredFlag = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int))__pyx_f_8treedict_8treedict_8TreeDict__setRegisteredFlag;
  __pyx_vtable_8treedict_8treedict_TreeDict.hasBeenCopied = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict_hasBeenCopied;
  __pyx_vtable_8treedict_8treedict_TreeDict._setHasBeenCopiedFlag = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int))__pyx_f_8treedict_8treedict_8TreeDict__setHasBeenCopiedFlag;
  __pyx_vtable_8treedict_8treedict_TreeDict.isCopyReferenced = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict_isCopyReferenced;
  __pyx_vtable_8treedict_8treedict_TreeDict._setCopyReferencedFlag = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int))__pyx_f_8treedict_8treedict_8TreeDict__setCopyReferencedFlag;
  __pyx_vtable_8treedict_8treedict_TreeDict.isIterReferenced = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict_isIterReferenced;
  __pyx_vtable_8treedict_8treedict_TreeDict.iteratorIncRef = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict_iteratorIncRef;
  __pyx_vtable_8treedict_8treedict_TreeDict.iteratorDecRef = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict_iteratorDecRef;
  __pyx_vtable_8treedict_8treedict_TreeDict.parentNode = (struct __pyx_obj_8treedict_8treedict_TreeDict *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict_parentNode;
  __pyx_vtable_8treedict_8treedict_TreeDict.rootNode = (struct __pyx_obj_8treedict_8treedict_TreeDict *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict_rootNode;
  __pyx_vtable_8treedict_8treedict_TreeDict.isRoot = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict_isRoot;
  __pyx_vtable_8treedict_8treedict_TreeDict.isEmpty = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict_isEmpty;
  __pyx_vtable_8treedict_8treedict_TreeDict.nodeInSameTree = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict_nodeInSameTree;
  __pyx_vtable_8treedict_8treedict_TreeDict.interactiveTree = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict_interactiveTree;
  __pyx_vtable_8treedict_8treedict_TreeDict._fullNameOf = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict__fullNameOf;
  __pyx_vtable_8treedict_8treedict_TreeDict._branchNameOf = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict__branchNameOf;
  __pyx_vtable_8treedict_8treedict_TreeDict.treeName = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict_treeName;
  __pyx_vtable_8treedict_8treedict_TreeDict.branchName = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_branchName *__pyx_optional_args))__pyx_f_8treedict_8treedict_8TreeDict_branchName;
  __pyx_vtable_8treedict_8treedict_TreeDict._branchName = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int, int))__pyx_f_8treedict_8treedict_8TreeDict__branchName;
  __pyx_vtable_8treedict_8treedict_TreeDict._getSettingOrderPosition = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict__getSettingOrderPosition;
  __pyx_vtable_8treedict_8treedict_TreeDict.get = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_get *__pyx_optional_args))__pyx_f_8treedict_8treedict_8TreeDict_get;
  __pyx_vtable_8treedict_8treedict_TreeDict.exists = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict_exists;
  __pyx_vtable_8treedict_8treedict_TreeDict._getPTNode = (struct __pyx_obj_8treedict_8treedict__PTreeNode *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__getPTNode;
  __pyx_vtable_8treedict_8treedict_TreeDict._getLocalPTNode = (struct __pyx_obj_8treedict_8treedict__PTreeNode *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__getLocalPTNode;
  __pyx_vtable_8treedict_8treedict_TreeDict._get = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int))__pyx_f_8treedict_8treedict_8TreeDict__get;
  __pyx_vtable_8treedict_8treedict_TreeDict._getLocal = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int))__pyx_f_8treedict_8treedict_8TreeDict__getLocal;
  __pyx_vtable_8treedict_8treedict_TreeDict._exists = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int))__pyx_f_8treedict_8treedict_8TreeDict__exists;
  __pyx_vtable_8treedict_8treedict_TreeDict._existsLocal = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, int))__pyx_f_8treedict_8treedict_8TreeDict__existsLocal;
  __pyx_vtable_8treedict_8treedict_TreeDict._getLocalBranch = (struct __pyx_obj_8treedict_8treedict_TreeDict *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, __pyx_t_8treedict_8treedict_flagtype))__pyx_f_8treedict_8treedict_8TreeDict__getLocalBranch;
  __pyx_vtable_8treedict_8treedict_TreeDict._getBranch = (struct __pyx_obj_8treedict_8treedict_TreeDict *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, __pyx_t_8treedict_8treedict_flagtype))__pyx_f_8treedict_8treedict_8TreeDict__getBranch;
  __pyx_vtable_8treedict_8treedict_TreeDict._getBaseOf = (struct __pyx_obj_8treedict_8treedict_TreeDict *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, __pyx_t_8treedict_8treedict_flagtype))__pyx_f_8treedict_8treedict_8TreeDict__getBaseOf;
  __pyx_vtable_8treedict_8treedict_TreeDict._getBottomNode = (struct __pyx_obj_8treedict_8treedict_TreeDict *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__getBottomNode;
  __pyx_vtable_8treedict_8treedict_TreeDict._newLocalBranch = (struct __pyx_obj_8treedict_8treedict_TreeDict *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, __pyx_t_8treedict_8treedict_flagtype))__pyx_f_8treedict_8treedict_8TreeDict__newLocalBranch;
  __pyx_vtable_8treedict_8treedict_TreeDict._setLocalBranch = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDict *, __pyx_t_8treedict_8treedict_flagtype))__pyx_f_8treedict_8treedict_8TreeDict__setLocalBranch;
  __pyx_vtable_8treedict_8treedict_TreeDict._attachDanglingSelf = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__attachDanglingSelf;
  __pyx_vtable_8treedict_8treedict_TreeDict._isEqual = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__isEqual;
  __pyx_vtable_8treedict_8treedict_TreeDict._firstMutableType = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__firstMutableType;
  __pyx_vtable_8treedict_8treedict_TreeDict.isMutable = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict_isMutable;
  __pyx_vtable_8treedict_8treedict_TreeDict.hash = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_hash *__pyx_optional_args))__pyx_f_8treedict_8treedict_8TreeDict_hash;
  __pyx_vtable_8treedict_8treedict_TreeDict._reportable_hash = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__reportable_hash;
  __pyx_vtable_8treedict_8treedict_TreeDict._encode_hash = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__encode_hash;
  __pyx_vtable_8treedict_8treedict_TreeDict._item_set_hash = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__item_set_hash;
  __pyx_vtable_8treedict_8treedict_TreeDict._item_hash = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__item_hash;
  __pyx_vtable_8treedict_8treedict_TreeDict._self_hash = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__self_hash;
  __pyx_vtable_8treedict_8treedict_TreeDict._self_immutable_hash = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__self_immutable_hash;
  __pyx_vtable_8treedict_8treedict_TreeDict._runFullHash = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__runFullHash;
  __pyx_vtable_8treedict_8treedict_TreeDict._runImmutableHash = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__runImmutableHash;
  __pyx_vtable_8treedict_8treedict_TreeDict._getImmutableItemsHash = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__getImmutableItemsHash;
  __pyx_vtable_8treedict_8treedict_TreeDict._update_hash_with_key = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__update_hash_with_key;
  __pyx_vtable_8treedict_8treedict_TreeDict._update_hash_with_context = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_8TreeDict__update_hash_with_context;
  __pyx_vtable_8treedict_8treedict_TreeDict._keyDeleted = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_8TreeDict__keyDeleted;
  __pyx_vtable_8treedict_8treedict_TreeDict._keyInserted = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_8TreeDict__keyInserted;
  __pyx_vtable_8treedict_8treedict_TreeDict._resetImmutableHashes = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__resetImmutableHashes;
  __pyx_vtable_8treedict_8treedict_TreeDict._update = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDict *, __pyx_t_8treedict_8treedict_flagtype))__pyx_f_8treedict_8treedict_8TreeDict__update;
  __pyx_vtable_8treedict_8treedict_TreeDict._copy = (struct __pyx_obj_8treedict_8treedict_TreeDict *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int, int))__pyx_f_8treedict_8treedict_8TreeDict__copy;
  __pyx_vtable_8treedict_8treedict_TreeDict._clearHasBeenCopiedFlags = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__clearHasBeenCopiedFlags;
  __pyx_vtable_8treedict_8treedict_TreeDict._recursiveCopy = (struct __pyx_obj_8treedict_8treedict_TreeDict *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int))__pyx_f_8treedict_8treedict_8TreeDict__recursiveCopy;
  __pyx_vtable_8treedict_8treedict_TreeDict._copyValue = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, struct __pyx_obj_8treedict_8treedict__PTreeNode *, int))__pyx_f_8treedict_8treedict_8TreeDict__copyValue;
  __pyx_vtable_8treedict_8treedict_TreeDict._reset_branches = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_8TreeDict__reset_branches;
  __pyx_vtable_8treedict_8treedict_TreeDict._local_size = (size_t (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int))__pyx_f_8treedict_8treedict_8TreeDict__local_size;
  __pyx_vtable_8treedict_8treedict_TreeDict._size = (size_t (*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int, int))__pyx_f_8treedict_8treedict_8TreeDict__size;
  __pyx_vtable_8treedict_8treedict_TreeDict._getBranchMode = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *))__pyx_f_8treedict_8treedict_8TreeDict__getBranchMode;
  __pyx_vtable_8treedict_8treedict_TreeDict._getIter = (struct __pyx_obj_8treedict_8treedict_TreeDictIterator *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int, int, int))__pyx_f_8treedict_8treedict_8TreeDict__getIter;
  __pyx_vtable_8treedict_8treedict_TreeDict.iteritems = (struct __pyx_obj_8treedict_8treedict_TreeDictIterator *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_iteritems *__pyx_optional_args))__pyx_f_8treedict_8treedict_8TreeDict_iteritems;
  __pyx_vtable_8treedict_8treedict_TreeDict.itervalues = (struct __pyx_obj_8treedict_8treedict_TreeDictIterator *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_itervalues *__pyx_optional_args))__pyx_f_8treedict_8treedict_8TreeDict_itervalues;
  __pyx_vtable_8treedict_8treedict_TreeDict.iterkeys = (struct __pyx_obj_8treedict_8treedict_TreeDictIterator *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch, struct __pyx_opt_args_8treedict_8treedict_8TreeDict_iterkeys *__pyx_optional_args))__pyx_f_8treedict_8treedict_8TreeDict_iterkeys;
  __pyx_vtable_8treedict_8treedict_TreeDict.iterbranches = (struct __pyx_obj_8treedict_8treedict_TreeDictIterator *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, int __pyx_skip_dispatch))__pyx_f_8treedict_8treedict_8TreeDict_iterbranches;
  __pyx_vtable_8treedict_8treedict_TreeDict._getListFromIter = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, struct __pyx_obj_8treedict_8treedict_TreeDictIterator *))__pyx_f_8treedict_8treedict_8TreeDict__getListFromIter;
  __pyx_vtable_8treedict_8treedict_TreeDict._getListOfClosest = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, size_t, struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, struct __pyx_t_8treedict_10membuffers_size_t_v *))__pyx_f_8treedict_8treedict_8TreeDict__getListOfClosest;
  __pyx_vtable_8treedict_8treedict_TreeDict._getSingleClosest = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, struct __pyx_t_8treedict_10membuffers_size_t_v *))__pyx_f_8treedict_8treedict_8TreeDict__getSingleClosest;
  if (PyType_Ready(&__pyx_type_8treedict_8treedict_TreeDict) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_8treedict_8treedict_TreeDict.tp_dict, __pyx_vtabptr_8treedict_8treedict_TreeDict) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "TreeDict", (PyObject *)&__pyx_type_8treedict_8treedict_TreeDict) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_type_8treedict_8treedict_TreeDict.tp_weaklistoffset == 0) __pyx_type_8treedict_8treedict_TreeDict.tp_weaklistoffset = offsetof(struct __pyx_obj_8treedict_8treedict_TreeDict, __weakref__);
  __pyx_ptype_8treedict_8treedict_TreeDict = &__pyx_type_8treedict_8treedict_TreeDict;
  __pyx_vtabptr_8treedict_8treedict_TreeDictIterator = &__pyx_vtable_8treedict_8treedict_TreeDictIterator;
  __pyx_vtable_8treedict_8treedict_TreeDictIterator._init = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, struct __pyx_obj_8treedict_8treedict_TreeDict *, int, int, int))__pyx_f_8treedict_8treedict_16TreeDictIterator__init;
  __pyx_vtable_8treedict_8treedict_TreeDictIterator._ensurePosArraySized = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, size_t))__pyx_f_8treedict_8treedict_16TreeDictIterator__ensurePosArraySized;
  __pyx_vtable_8treedict_8treedict_TreeDictIterator._next = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *))__pyx_f_8treedict_8treedict_16TreeDictIterator__next;
  __pyx_vtable_8treedict_8treedict_TreeDictIterator._loadNext = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *))__pyx_f_8treedict_8treedict_16TreeDictIterator__loadNext;
  __pyx_vtable_8treedict_8treedict_TreeDictIterator.goUpStack = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, PyObject *, struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_16TreeDictIterator_goUpStack;
  __pyx_vtable_8treedict_8treedict_TreeDictIterator.goDownStack = (int (*)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *))__pyx_f_8treedict_8treedict_16TreeDictIterator_goDownStack;
  __pyx_vtable_8treedict_8treedict_TreeDictIterator.currentKey = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *))__pyx_f_8treedict_8treedict_16TreeDictIterator_currentKey;
  __pyx_vtable_8treedict_8treedict_TreeDictIterator._setCurrentKey = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *))__pyx_f_8treedict_8treedict_16TreeDictIterator__setCurrentKey;
  __pyx_vtable_8treedict_8treedict_TreeDictIterator._decRefToCurTree = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, size_t))__pyx_f_8treedict_8treedict_16TreeDictIterator__decRefToCurTree;
  __pyx_vtable_8treedict_8treedict_TreeDictIterator._incRefToCurTree = (void (*)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, size_t))__pyx_f_8treedict_8treedict_16TreeDictIterator__incRefToCurTree;
  __pyx_vtable_8treedict_8treedict_TreeDictIterator.currentPTreeNode = (struct __pyx_obj_8treedict_8treedict__PTreeNode *(*)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *))__pyx_f_8treedict_8treedict_16TreeDictIterator_currentPTreeNode;
  __pyx_vtable_8treedict_8treedict_TreeDictIterator._currentRetValue = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *))__pyx_f_8treedict_8treedict_16TreeDictIterator__currentRetValue;
  __pyx_vtable_8treedict_8treedict_TreeDictIterator._fullKey = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict_TreeDictIterator *, PyObject *))__pyx_f_8treedict_8treedict_16TreeDictIterator__fullKey;
  if (PyType_Ready(&__pyx_type_8treedict_8treedict_TreeDictIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_8treedict_8treedict_TreeDictIterator.tp_dict, __pyx_vtabptr_8treedict_8treedict_TreeDictIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "TreeDictIterator", (PyObject *)&__pyx_type_8treedict_8treedict_TreeDictIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8treedict_8treedict_TreeDictIterator = &__pyx_type_8treedict_8treedict_TreeDictIterator;
  __pyx_vtabptr_8treedict_8treedict__PTreeNode = &__pyx_vtable_8treedict_8treedict__PTreeNode;
  __pyx_vtable_8treedict_8treedict__PTreeNode._set_it = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *, struct __pyx_obj_8treedict_8treedict_TreeDict *, PyObject *, PyObject *, size_t))__pyx_f_8treedict_8treedict_10_PTreeNode__set_it;
  __pyx_vtable_8treedict_8treedict__PTreeNode.value = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_10_PTreeNode_value;
  __pyx_vtable_8treedict_8treedict__PTreeNode.orderPosition = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_10_PTreeNode_orderPosition;
  __pyx_vtable_8treedict_8treedict__PTreeNode.setOrderPostion = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *, size_t))__pyx_f_8treedict_8treedict_10_PTreeNode_setOrderPostion;
  __pyx_vtable_8treedict_8treedict__PTreeNode.type = (int (*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_10_PTreeNode_type;
  __pyx_vtable_8treedict_8treedict__PTreeNode.isMutable = (int (*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_10_PTreeNode_isMutable;
  __pyx_vtable_8treedict_8treedict__PTreeNode.isImmutable = (int (*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_10_PTreeNode_isImmutable;
  __pyx_vtable_8treedict_8treedict__PTreeNode.isBranch = (int (*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_10_PTreeNode_isBranch;
  __pyx_vtable_8treedict_8treedict__PTreeNode.isNonBranchTree = (int (*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_10_PTreeNode_isNonBranchTree;
  __pyx_vtable_8treedict_8treedict__PTreeNode.isDanglingBranch = (int (*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_10_PTreeNode_isDanglingBranch;
  __pyx_vtable_8treedict_8treedict__PTreeNode.isTree = (int (*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_10_PTreeNode_isTree;
  __pyx_vtable_8treedict_8treedict__PTreeNode.isDanglingTree = (int (*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_10_PTreeNode_isDanglingTree;
  __pyx_vtable_8treedict_8treedict__PTreeNode.tree = (struct __pyx_obj_8treedict_8treedict_TreeDict *(*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_10_PTreeNode_tree;
  __pyx_vtable_8treedict_8treedict__PTreeNode.isChildOf = (int (*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *, struct __pyx_obj_8treedict_8treedict_TreeDict *))__pyx_f_8treedict_8treedict_10_PTreeNode_isChildOf;
  __pyx_vtable_8treedict_8treedict__PTreeNode.fullHash = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_10_PTreeNode_fullHash;
  __pyx_vtable_8treedict_8treedict__PTreeNode.runFullHash = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *, PyObject *))__pyx_f_8treedict_8treedict_10_PTreeNode_runFullHash;
  __pyx_vtable_8treedict_8treedict__PTreeNode.runImmutableHash = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *, PyObject *))__pyx_f_8treedict_8treedict_10_PTreeNode_runImmutableHash;
  __pyx_vtable_8treedict_8treedict__PTreeNode._immutableHash = (PyObject *(*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_10_PTreeNode__immutableHash;
  __pyx_vtable_8treedict_8treedict__PTreeNode.isEqual = (int (*)(struct __pyx_obj_8treedict_8treedict__PTreeNode *, struct __pyx_obj_8treedict_8treedict__PTreeNode *))__pyx_f_8treedict_8treedict_10_PTreeNode_isEqual;
  if (PyType_Ready(&__pyx_type_8treedict_8treedict__PTreeNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_8treedict_8treedict__PTreeNode.tp_dict, __pyx_vtabptr_8treedict_8treedict__PTreeNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_PTreeNode", (PyObject *)&__pyx_type_8treedict_8treedict__PTreeNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8treedict_8treedict__PTreeNode = &__pyx_type_8treedict_8treedict__PTreeNode;
  if (PyType_Ready(&__pyx_type_8treedict_8treedict__NoDefault) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "_NoDefault", (PyObject *)&__pyx_type_8treedict_8treedict__NoDefault) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8treedict_8treedict__NoDefault = &__pyx_type_8treedict_8treedict__NoDefault;
  /*--- Type import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":32
 * 
 * # python imports.
 * import copy as copy_module             # <<<<<<<<<<<<<<
 * import cPickle
 * import hashlib
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__copy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__copy_module, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":33
 * # python imports.
 * import copy as copy_module
 * import cPickle             # <<<<<<<<<<<<<<
 * import hashlib
 * import warnings
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__cPickle), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__cPickle, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":34
 * import copy as copy_module
 * import cPickle
 * import hashlib             # <<<<<<<<<<<<<<
 * import warnings
 * import re
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__hashlib), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__hashlib, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":35
 * import cPickle
 * import hashlib
 * import warnings             # <<<<<<<<<<<<<<
 * import re
 * import inspect
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__warnings, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":36
 * import hashlib
 * import warnings
 * import re             # <<<<<<<<<<<<<<
 * import inspect
 * import base64
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__re), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__re, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":37
 * import warnings
 * import re
 * import inspect             # <<<<<<<<<<<<<<
 * import base64
 * import heapq
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__inspect), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__inspect, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":38
 * import re
 * import inspect
 * import base64             # <<<<<<<<<<<<<<
 * import heapq
 * import weakref
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__base64), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__base64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":39
 * import inspect
 * import base64
 * import heapq             # <<<<<<<<<<<<<<
 * import weakref
 * 
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__heapq), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__heapq, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":40
 * import base64
 * import heapq
 * import weakref             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__weakref), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__weakref, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":50
 * # Early bindings to avoid unneeded lookups in the c code
 * 
 * cdef object md5 = hashlib.md5             # <<<<<<<<<<<<<<
 * cdef object dumps = cPickle.dumps
 * cdef object PicklingError = cPickle.PicklingError
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__hashlib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__md5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict_md5);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict_md5);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_v_8treedict_8treedict_md5 = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":51
 * 
 * cdef object md5 = hashlib.md5
 * cdef object dumps = cPickle.dumps             # <<<<<<<<<<<<<<
 * cdef object PicklingError = cPickle.PicklingError
 * cdef object copy_f = copy_module.copy
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__cPickle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dumps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict_dumps);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict_dumps);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_v_8treedict_8treedict_dumps = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":52
 * cdef object md5 = hashlib.md5
 * cdef object dumps = cPickle.dumps
 * cdef object PicklingError = cPickle.PicklingError             # <<<<<<<<<<<<<<
 * cdef object copy_f = copy_module.copy
 * cdef object deepcopy_f = copy_module.deepcopy
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__cPickle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__PicklingError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict_PicklingError);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict_PicklingError);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_v_8treedict_8treedict_PicklingError = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":53
 * cdef object dumps = cPickle.dumps
 * cdef object PicklingError = cPickle.PicklingError
 * cdef object copy_f = copy_module.copy             # <<<<<<<<<<<<<<
 * cdef object deepcopy_f = copy_module.deepcopy
 * cdef object b64encode = base64.b64encode
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy_module); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict_copy_f);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict_copy_f);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_v_8treedict_8treedict_copy_f = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":54
 * cdef object PicklingError = cPickle.PicklingError
 * cdef object copy_f = copy_module.copy
 * cdef object deepcopy_f = copy_module.deepcopy             # <<<<<<<<<<<<<<
 * cdef object b64encode = base64.b64encode
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy_module); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict_deepcopy_f);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict_deepcopy_f);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_v_8treedict_8treedict_deepcopy_f = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":55
 * cdef object copy_f = copy_module.copy
 * cdef object deepcopy_f = copy_module.deepcopy
 * cdef object b64encode = base64.b64encode             # <<<<<<<<<<<<<<
 * 
 * cdef object heappop     = heapq.heappop
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__base64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__b64encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict_b64encode);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict_b64encode);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_v_8treedict_8treedict_b64encode = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":57
 * cdef object b64encode = base64.b64encode
 * 
 * cdef object heappop     = heapq.heappop             # <<<<<<<<<<<<<<
 * cdef object heappush    = heapq.heappush
 * cdef object heapreplace = heapq.heapreplace
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__heapq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__heappop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict_heappop);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict_heappop);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_v_8treedict_8treedict_heappop = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":58
 * 
 * cdef object heappop     = heapq.heappop
 * cdef object heappush    = heapq.heappush             # <<<<<<<<<<<<<<
 * cdef object heapreplace = heapq.heapreplace
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__heapq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__heappush); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict_heappush);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict_heappush);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_v_8treedict_8treedict_heappush = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":59
 * cdef object heappop     = heapq.heappop
 * cdef object heappush    = heapq.heappush
 * cdef object heapreplace = heapq.heapreplace             # <<<<<<<<<<<<<<
 * 
 * cdef object strfind     = str.find
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__heapq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__heapreplace); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict_heapreplace);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict_heapreplace);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_v_8treedict_8treedict_heapreplace = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":61
 * cdef object heapreplace = heapq.heapreplace
 * 
 * cdef object strfind     = str.find             # <<<<<<<<<<<<<<
 * cdef object strrfind    = str.rfind
 * cdef object strlower    = str.lower
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)&PyString_Type)), __pyx_n_s__find); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict_strfind);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict_strfind);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_v_8treedict_8treedict_strfind = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":62
 * 
 * cdef object strfind     = str.find
 * cdef object strrfind    = str.rfind             # <<<<<<<<<<<<<<
 * cdef object strlower    = str.lower
 * cdef object strsplit    = str.split
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)&PyString_Type)), __pyx_n_s__rfind); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict_strrfind);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict_strrfind);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_v_8treedict_8treedict_strrfind = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":63
 * cdef object strfind     = str.find
 * cdef object strrfind    = str.rfind
 * cdef object strlower    = str.lower             # <<<<<<<<<<<<<<
 * cdef object strsplit    = str.split
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)&PyString_Type)), __pyx_n_s__lower); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict_strlower);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict_strlower);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_v_8treedict_8treedict_strlower = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":64
 * cdef object strrfind    = str.rfind
 * cdef object strlower    = str.lower
 * cdef object strsplit    = str.split             # <<<<<<<<<<<<<<
 * 
 * cdef object new_weakref = weakref.ref
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)&PyString_Type)), __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict_strsplit);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict_strsplit);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_v_8treedict_8treedict_strsplit = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":66
 * cdef object strsplit    = str.split
 * 
 * cdef object new_weakref = weakref.ref             # <<<<<<<<<<<<<<
 * 
 * cdef class TreeDict(object)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__weakref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict_new_weakref);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict_new_weakref);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_v_8treedict_8treedict_new_weakref = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":92
 * # Commonly used dictionary keys, instantiated once here for speed
 * 
 * cdef str s_IterReferenceCount = "IteratorReferenceCount"             # <<<<<<<<<<<<<<
 * cdef str s_registration_tree_name = "_registration_tree_name"
 * cdef str s_registration_branch_name = "_registration_branch_name"
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s_79));
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict_s_IterReferenceCount));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict_s_IterReferenceCount));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_79));
  __pyx_v_8treedict_8treedict_s_IterReferenceCount = __pyx_n_s_79;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":93
 * 
 * cdef str s_IterReferenceCount = "IteratorReferenceCount"
 * cdef str s_registration_tree_name = "_registration_tree_name"             # <<<<<<<<<<<<<<
 * cdef str s_registration_branch_name = "_registration_branch_name"
 * cdef str s_dangling_node_dependents = "_dangling_node_dependents"
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s_80));
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict_s_registration_tree_name));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict_s_registration_tree_name));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_80));
  __pyx_v_8treedict_8treedict_s_registration_tree_name = __pyx_n_s_80;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":94
 * cdef str s_IterReferenceCount = "IteratorReferenceCount"
 * cdef str s_registration_tree_name = "_registration_tree_name"
 * cdef str s_registration_branch_name = "_registration_branch_name"             # <<<<<<<<<<<<<<
 * cdef str s_dangling_node_dependents = "_dangling_node_dependents"
 * cdef str s_cached_hash = "_cached_hash"
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s_81));
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict_s_registration_branch_name));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict_s_registration_branch_name));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_81));
  __pyx_v_8treedict_8treedict_s_registration_branch_name = __pyx_n_s_81;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":95
 * cdef str s_registration_tree_name = "_registration_tree_name"
 * cdef str s_registration_branch_name = "_registration_branch_name"
 * cdef str s_dangling_node_dependents = "_dangling_node_dependents"             # <<<<<<<<<<<<<<
 * cdef str s_cached_hash = "_cached_hash"
 * cdef str s_auth_key = "_auth_key"
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s_82));
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict_s_dangling_node_dependents));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict_s_dangling_node_dependents));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_82));
  __pyx_v_8treedict_8treedict_s_dangling_node_dependents = __pyx_n_s_82;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":96
 * cdef str s_registration_branch_name = "_registration_branch_name"
 * cdef str s_dangling_node_dependents = "_dangling_node_dependents"
 * cdef str s_cached_hash = "_cached_hash"             # <<<<<<<<<<<<<<
 * cdef str s_auth_key = "_auth_key"
 * cdef str s_hit_flag = "_hit_flag"
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s___cached_hash));
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict_s_cached_hash));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict_s_cached_hash));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___cached_hash));
  __pyx_v_8treedict_8treedict_s_cached_hash = __pyx_n_s___cached_hash;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":97
 * cdef str s_dangling_node_dependents = "_dangling_node_dependents"
 * cdef str s_cached_hash = "_cached_hash"
 * cdef str s_auth_key = "_auth_key"             # <<<<<<<<<<<<<<
 * cdef str s_hit_flag = "_hit_flag"
 * cdef str s_immutable_items_hash = "_immutable_items_hash"
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s___auth_key));
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict_s_auth_key));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict_s_auth_key));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___auth_key));
  __pyx_v_8treedict_8treedict_s_auth_key = __pyx_n_s___auth_key;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":98
 * cdef str s_cached_hash = "_cached_hash"
 * cdef str s_auth_key = "_auth_key"
 * cdef str s_hit_flag = "_hit_flag"             # <<<<<<<<<<<<<<
 * cdef str s_immutable_items_hash = "_immutable_items_hash"
 * cdef str s_protect_structure = "protect_structure"
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s___hit_flag));
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict_s_hit_flag));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict_s_hit_flag));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___hit_flag));
  __pyx_v_8treedict_8treedict_s_hit_flag = __pyx_n_s___hit_flag;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":99
 * cdef str s_auth_key = "_auth_key"
 * cdef str s_hit_flag = "_hit_flag"
 * cdef str s_immutable_items_hash = "_immutable_items_hash"             # <<<<<<<<<<<<<<
 * cdef str s_protect_structure = "protect_structure"
 * cdef str s_copied_node = "copied_node"
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s_83));
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict_s_immutable_items_hash));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict_s_immutable_items_hash));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_83));
  __pyx_v_8treedict_8treedict_s_immutable_items_hash = __pyx_n_s_83;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":100
 * cdef str s_hit_flag = "_hit_flag"
 * cdef str s_immutable_items_hash = "_immutable_items_hash"
 * cdef str s_protect_structure = "protect_structure"             # <<<<<<<<<<<<<<
 * cdef str s_copied_node = "copied_node"
 * cdef str s_copy_referencing_keys = "copy_referencing_keys"
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s__protect_structure));
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict_s_protect_structure));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict_s_protect_structure));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__protect_structure));
  __pyx_v_8treedict_8treedict_s_protect_structure = __pyx_n_s__protect_structure;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":101
 * cdef str s_immutable_items_hash = "_immutable_items_hash"
 * cdef str s_protect_structure = "protect_structure"
 * cdef str s_copied_node = "copied_node"             # <<<<<<<<<<<<<<
 * cdef str s_copy_referencing_keys = "copy_referencing_keys"
 * cdef str s_dangling_reference_queue = "dangling_reference_queue"
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s__copied_node));
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict_s_copied_node));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict_s_copied_node));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__copied_node));
  __pyx_v_8treedict_8treedict_s_copied_node = __pyx_n_s__copied_node;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":102
 * cdef str s_protect_structure = "protect_structure"
 * cdef str s_copied_node = "copied_node"
 * cdef str s_copy_referencing_keys = "copy_referencing_keys"             # <<<<<<<<<<<<<<
 * cdef str s_dangling_reference_queue = "dangling_reference_queue"
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s_84));
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict_s_copy_referencing_keys));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict_s_copy_referencing_keys));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_84));
  __pyx_v_8treedict_8treedict_s_copy_referencing_keys = __pyx_n_s_84;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":103
 * cdef str s_copied_node = "copied_node"
 * cdef str s_copy_referencing_keys = "copy_referencing_keys"
 * cdef str s_dangling_reference_queue = "dangling_reference_queue"             # <<<<<<<<<<<<<<
 * 
 * ################################################################################
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s_85));
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict_s_dangling_reference_queue));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict_s_dangling_reference_queue));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_85));
  __pyx_v_8treedict_8treedict_s_dangling_reference_queue = __pyx_n_s_85;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":135
 * # A few global helper functions dealing with name checking
 * 
 * cdef object _string_name_validator = re.compile(r'\A[a-zA-Z_]\w*\Z')             # <<<<<<<<<<<<<<
 * cdef object _string_name_validator_match = _string_name_validator.match
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__re); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_86));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_86));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_86));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict__string_name_validator);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict__string_name_validator);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_8treedict_8treedict__string_name_validator = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":136
 * 
 * cdef object _string_name_validator = re.compile(r'\A[a-zA-Z_]\w*\Z')
 * cdef object _string_name_validator_match = _string_name_validator.match             # <<<<<<<<<<<<<<
 * 
 * cdef inline checkKeyNotNone(str n):
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_8treedict_8treedict__string_name_validator, __pyx_n_s__match); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict__string_name_validator_match);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict__string_name_validator_match);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_8treedict_8treedict__string_name_validator_match = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":173
 * # request them by name using getTree()
 * 
 * cdef dict _tree_lookup_dict = {}             # <<<<<<<<<<<<<<
 * 
 * cdef inline registerTree(TreeDict tree):
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict__tree_lookup_dict));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict__tree_lookup_dict));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_v_8treedict_8treedict__tree_lookup_dict = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":225
 * # functionality happens here.
 * 
 * class HashError(ValueError): pass             # <<<<<<<<<<<<<<
 * 
 * ########################################
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_ValueError);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_ValueError);
  __Pyx_GIVEREF(__pyx_builtin_ValueError);
  __pyx_t_2 = __Pyx_CreateClass(__pyx_t_1, ((PyObject *)__pyx_t_3), __pyx_n_s__HashError, "treedict.treedict"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HashError, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":326
 * DEF t_Unknown           = -1
 * 
 * cdef dict _fast_type_determination = {             # <<<<<<<<<<<<<<
 * 
 *     # Immutable Types
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":329
 * 
 *     # Immutable Types
 *     int     : t_Immutable_Simple,             # <<<<<<<<<<<<<<
 *     long    : t_Immutable_Simple,
 *     str     : t_Immutable_Simple,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)((PyObject*)&PyInt_Type)), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":330
 *     # Immutable Types
 *     int     : t_Immutable_Simple,
 *     long    : t_Immutable_Simple,             # <<<<<<<<<<<<<<
 *     str     : t_Immutable_Simple,
 *     bool    : t_Immutable_Simple,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)((PyObject*)&PyLong_Type)), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":331
 *     int     : t_Immutable_Simple,
 *     long    : t_Immutable_Simple,
 *     str     : t_Immutable_Simple,             # <<<<<<<<<<<<<<
 *     bool    : t_Immutable_Simple,
 *     unicode : t_Immutable_Simple,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)((PyObject*)&PyString_Type)), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":332
 *     long    : t_Immutable_Simple,
 *     str     : t_Immutable_Simple,
 *     bool    : t_Immutable_Simple,             # <<<<<<<<<<<<<<
 *     unicode : t_Immutable_Simple,
 *     complex : t_Immutable_Simple,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject*)&PyBool_Type), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":333
 *     str     : t_Immutable_Simple,
 *     bool    : t_Immutable_Simple,
 *     unicode : t_Immutable_Simple,             # <<<<<<<<<<<<<<
 *     complex : t_Immutable_Simple,
 *     float   : t_Immutable_Simple,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)((PyObject*)&PyUnicode_Type)), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":334
 *     bool    : t_Immutable_Simple,
 *     unicode : t_Immutable_Simple,
 *     complex : t_Immutable_Simple,             # <<<<<<<<<<<<<<
 *     float   : t_Immutable_Simple,
 *     str     : t_Immutable_Simple,
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject*)&PyComplex_Type), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":335
 *     unicode : t_Immutable_Simple,
 *     complex : t_Immutable_Simple,
 *     float   : t_Immutable_Simple,             # <<<<<<<<<<<<<<
 *     str     : t_Immutable_Simple,
 * 
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)((PyObject*)&PyFloat_Type)), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":336
 *     complex : t_Immutable_Simple,
 *     float   : t_Immutable_Simple,
 *     str     : t_Immutable_Simple,             # <<<<<<<<<<<<<<
 * 
 *     # Mutable Types
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)((PyObject*)&PyString_Type)), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":339
 * 
 *     # Mutable Types
 *     list      : t_Mutable_Complex,             # <<<<<<<<<<<<<<
 *     dict      : t_Mutable_Complex,
 *     set       : t_Mutable_Complex
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)((PyObject*)&PyList_Type)), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":340
 *     # Mutable Types
 *     list      : t_Mutable_Complex,
 *     dict      : t_Mutable_Complex,             # <<<<<<<<<<<<<<
 *     set       : t_Mutable_Complex
 *     }
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)((PyObject*)&PyDict_Type)), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":341
 *     list      : t_Mutable_Complex,
 *     dict      : t_Mutable_Complex,
 *     set       : t_Mutable_Complex             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)((PyObject*)&PySet_Type)), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict__fast_type_determination));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict__fast_type_determination));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_v_8treedict_8treedict__fast_type_determination = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":366
 * DEF _orderNodeNotKnown      = 0
 * DEF _orderNodeStartingValue = 0
 * cdef size_t _orderNodeMaxNum = <size_t>( (<double>2)**(8*sizeof(size_t) - 1)) - 2             # <<<<<<<<<<<<<<
 * 
 * cdef class _PTreeNode(object):
 */
  __pyx_v_8treedict_8treedict__orderNodeMaxNum = (((size_t)pow(((double)2), ((double)((8 * (sizeof(size_t))) - 1)))) - 2);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":526
 * DEF i_BranchMode_Only = 3
 * 
 * cdef dict _branch_mode_lookup = {             # <<<<<<<<<<<<<<
 *     'all'    : i_BranchMode_All,
 *     'only'   : i_BranchMode_Only,
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__all), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__only), __pyx_int_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__none), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_v_8treedict_8treedict__branch_mode_lookup));
  __Pyx_DECREF(((PyObject *)__pyx_v_8treedict_8treedict__branch_mode_lookup));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_v_8treedict_8treedict__branch_mode_lookup = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":531
 *     'none'   : i_BranchMode_None}
 * 
 * cdef object _branch_mode_error_msg = "branch_mode must be one of 'all', 'only' or 'none'"             # <<<<<<<<<<<<<<
 * 
 * cdef class TreeDictIterator(object):
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_87));
  __Pyx_GOTREF(__pyx_v_8treedict_8treedict__branch_mode_error_msg);
  __Pyx_DECREF(__pyx_v_8treedict_8treedict__branch_mode_error_msg);
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_87));
  __pyx_v_8treedict_8treedict__branch_mode_error_msg = ((PyObject *)__pyx_kp_s_87);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":831
 *             raise e
 * 
 *     def setFromString(self, str key, str value, dict extra_variables = {}):             # <<<<<<<<<<<<<<
 *         """
 *         A convenience function for setting arguments from sources in
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_k_13 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":884
 * 
 *     @classmethod
 *     def fromkeys(cls, key_iterable, value = None):             # <<<<<<<<<<<<<<
 *         """
 *         Creates a new TreeDict instance populated by setting the keys
 */
  __pyx_t_3 = __Pyx_GetName((PyObject *)__pyx_ptype_8treedict_8treedict_TreeDict, __pyx_n_s__fromkeys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8treedict_8treedict_TreeDict->tp_dict, __pyx_n_s__fromkeys, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_8treedict_8treedict_TreeDict);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":917
 * 
 *     @classmethod
 *     def fromdict(cls, d):             # <<<<<<<<<<<<<<
 *         """
 *         A convenience method that creates a new TreeDict instance from
 */
  __pyx_t_2 = __Pyx_GetName((PyObject *)__pyx_ptype_8treedict_8treedict_TreeDict, __pyx_n_s__fromdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_8treedict_8treedict_TreeDict->tp_dict, __pyx_n_s__fromdict, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_8treedict_8treedict_TreeDict);

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":2276
 *             raise e
 * 
 *     cpdef get(self, str key, default_value = _NoDefault):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the value/branch associated with the key `key`.  If
 */
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict__NoDefault)));
  __pyx_k_49 = ((PyObject *)((PyObject*)__pyx_ptype_8treedict_8treedict__NoDefault));
  __Pyx_GIVEREF(((PyObject*)__pyx_ptype_8treedict_8treedict__NoDefault));

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3053
 *             raise e
 * 
 *     def __deepcopy__(self, m={}):             # <<<<<<<<<<<<<<
 *         try:
 *             return self._copy(True, False)
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_k_70 = ((PyObject *)__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3882
 * # Now an interactive version that works well with ipython.
 * 
 * class InteractiveTreeDict(object):             # <<<<<<<<<<<<<<
 *     """
 *     An interactive version of the TreeDict for use in an interpreted
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_88)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_CreateClass(__pyx_t_2, ((PyObject *)__pyx_t_3), __pyx_n_s__InteractiveTreeDict, "treedict.treedict"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3948
 *     """
 * 
 *     def __init__(self, TreeDict ptree):             # <<<<<<<<<<<<<<
 * 
 *         # May be overridden
 */
  __pyx_t_2 = PyCFunction_New(&__pyx_mdef_8treedict_8treedict_19InteractiveTreeDict___init__, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyMethod_New(__pyx_t_2, 0, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_t_1, __pyx_n_s____init__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3964
 *                 self._setAttrDirect(k, pn.value())
 * 
 *     def __eq__(ipt1, ipt2):             # <<<<<<<<<<<<<<
 * 
 *         if not (isinstance(ipt1, InteractiveTreeDict) and isinstance(ipt2, InteractiveTreeDict)):
 */
  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_8treedict_8treedict_19InteractiveTreeDict___eq__, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyMethod_New(__pyx_t_4, 0, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_t_1, __pyx_n_s____eq__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3973
 *             return (<TreeDict>ipt1._original_param_tree)._isEqual(<TreeDict>ipt2._original_param_tree)
 * 
 *     def treeDict(self):             # <<<<<<<<<<<<<<
 *         return self._original_param_tree
 * 
 */
  __pyx_t_2 = PyCFunction_New(&__pyx_mdef_8treedict_8treedict_19InteractiveTreeDict_treeDict, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyMethod_New(__pyx_t_2, 0, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_t_1, __pyx_n_s__treeDict, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3976
 *         return self._original_param_tree
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (InteractiveTreeDict, (self._original_param_tree,))
 * 
 */
  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_8treedict_8treedict_19InteractiveTreeDict___reduce__, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyMethod_New(__pyx_t_4, 0, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_t_1, __pyx_n_s____reduce__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3979
 *         return (InteractiveTreeDict, (self._original_param_tree,))
 * 
 *     def __setattr__(self, str key, v):             # <<<<<<<<<<<<<<
 *         (<TreeDict> self._original_param_tree)._setLocal(key, v, 0)
 *         self._setAttrDirect(key, v)
 */
  __pyx_t_2 = PyCFunction_New(&__pyx_mdef_8treedict_8treedict_19InteractiveTreeDict___setattr__, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyMethod_New(__pyx_t_2, 0, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_t_1, __pyx_n_s____setattr__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":3983
 *         self._setAttrDirect(key, v)
 * 
 *     def _setAttrDirect(self, str key, v):             # <<<<<<<<<<<<<<
 *         object.__setattr__(self, key, v)
 * 
 */
  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_8treedict_8treedict_19InteractiveTreeDict__setAttrDirect, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyMethod_New(__pyx_t_4, 0, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_t_1, __pyx_n_s___setAttrDirect, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__InteractiveTreeDict, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/treedict.pyx":1
 * # Copyright (c) 2009, Hoyt Koepke (hoytak@gmail.com)             # <<<<<<<<<<<<<<
 * # All rights reserved.
 * #
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__getTree); 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);
  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_1, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_89), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__treeExists); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_90), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__setFromString); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_91), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fromkeys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_92), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fromdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_93), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__setdefault); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_94), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__set); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_95), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__checkset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_96), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__freeze); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_97), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__clear); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_98), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__pop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_99), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__popitem); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_100), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__attach); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_101), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__isFrozen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_102), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__isDangling); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_103), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__isRegistered); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_104), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__parentNode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_105), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__rootNode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_106), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__isRoot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_107), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__isEmpty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_108), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__nodeInSameTree); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_109), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__interactiveTree); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_110), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s___fullNameOf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_111), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s___branchNameOf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_112), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__treeName); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_113), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__branchName); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_114), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__makeReport); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_115), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_116), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__has_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_117), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__makeBranch); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_118), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__isMutable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_119), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__hash); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_120), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_121), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__update); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_122), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_123), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_124), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__itervalues); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_125), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__iterkeys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_126), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__iterbranches); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_127), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_128), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_129), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_130), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__branches); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_131), __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;
  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TreeDict); 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);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__getClosestKey); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); 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);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_132), __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;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "/homes/hoytak/workspace/treedict/treedict/minsmaxes.pxd":23
 *     return a if a < b else b
 * 
 * cdef inline long max2_long(long a, long b):             # <<<<<<<<<<<<<<
 *     return b if a < b else a
 */
  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);
  if (__pyx_m) {
    __Pyx_AddTraceback("init treedict.treedict");
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init treedict.treedict");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
    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;
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
    if (unlikely(tstate->curexc_type))
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
        goto bad;
    #endif
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
    Py_INCREF(local_type);
    Py_INCREF(local_value);
    Py_INCREF(local_tb);
    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;
    /* Make sure tstate is in a consistent state when we XDECREF
       these objects (XDECREF may run arbitrary code). */
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}


static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
        #if PY_VERSION_HEX < 0x02050000
                 "need more than %d value%s to unpack", (int)index,
        #else
                 "need more than %zd value%s to unpack", index,
        #endif
                 (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
        #if PY_VERSION_HEX < 0x02050000
            "too many values to unpack (expected %d)", (int)expected);
        #else
            "too many values to unpack (expected %zd)", expected);
        #endif
}

static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
    PyObject *item;
    if (!(item = PyIter_Next(iter))) {
        if (!PyErr_Occurred()) {
            __Pyx_RaiseNeedMoreValuesError(index);
        }
    }
    return item;
}

static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) {
    PyObject *item;
    if ((item = PyIter_Next(iter))) {
        Py_DECREF(item);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    else if (!PyErr_Occurred())
        return 0;
    else
        return -1;
}

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_AS_STRING(kw_name));
        #endif
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *number, *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";
    }
    number = (num_expected == 1) ? "" : "s";
    PyErr_Format(PyExc_TypeError,
        #if PY_VERSION_HEX < 0x02050000
            "%s() takes %s %d positional argument%s (%d given)",
        #else
            "%s() takes %s %zd positional argument%s (%zd given)",
        #endif
        func_name, more_or_less, num_expected, number, num_found);
}

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;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #else
        if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key)))
        #endif
            goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    return 0;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}


static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
    long r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}


static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    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);
}

static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    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;
}



static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
    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);
}

static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
    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);
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
    PyObject *py_import = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!py_import)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_CreateClass(
    PyObject *bases, PyObject *dict, PyObject *name, const char *modname)
{
    PyObject *py_modname;
    PyObject *result = 0;

    #if PY_MAJOR_VERSION < 3
    py_modname = PyString_FromString(modname);
    #else
    py_modname = PyUnicode_FromString(modname);
    #endif
    if (!py_modname)
        goto bad;
    if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
        goto bad;
    #if PY_MAJOR_VERSION < 3
    result = PyClass_New(bases, dict, name);
    #else
    result = PyObject_CallFunctionObjArgs((PyObject *)&PyType_Type, name, bases, dict, NULL);
    #endif
bad:
    Py_XDECREF(py_modname);
    return result;
}

static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
    /* It appears that PyMethodDescr_Type is not anywhere exposed in the Python/C API */
    static PyTypeObject *methoddescr_type = NULL;
    if (methoddescr_type == NULL) {
       PyObject *meth = __Pyx_GetAttrString((PyObject*)&PyList_Type, "append");
       if (!meth) return NULL;
       methoddescr_type = Py_TYPE(meth);
       Py_DECREF(meth);
    }
    if (PyObject_TypeCheck(method, methoddescr_type)) { /* cdef classes */
        PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
        #if PY_VERSION_HEX < 0x03020000
        PyTypeObject *d_type = descr->d_type;
        #else
        PyTypeObject *d_type = descr->d_common.d_type;
        #endif
        return PyDescr_NewClassMethod(d_type, descr->d_method);
    }
    else if (PyMethod_Check(method)) { /* python classes */
        return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
    }
    else if (PyCFunction_Check(method)) {
        return PyClassMethod_New(method);
    }
    PyErr_Format(PyExc_TypeError,
                 "Class-level classmethod() can only be called on"
                 "a method_descriptor or instance method.");
    return NULL;
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            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;
            }
        #endif
    }

    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

#else /* Python 3+ */

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    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)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }

    PyErr_SetObject(type, value);

    if (tb) {
        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);
        }
    }

bad:
    return;
}
#endif

static CYTHON_INLINE size_t __Pyx_pow_size_t(size_t b, size_t e) {
    size_t t = b;
    switch (e) {
        case 3:
            t *= b;
        case 2:
            t *= b;
        case 1:
            return t;
        case 0:
            return 1;
    }
    if (unlikely(e<0)) return 0;
    t = 1;
    while (likely(e)) {
        t *= (b * (e&1)) | ((~e)&1);    /* 1 or b */
        b *= b;
        e >>= 1;
    }
    return t;
}

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static void __Pyx_WriteUnraisable(const char *name) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #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_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __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,*/
        __pyx_lineno,   /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

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  /* Python 3+ has unicode identifiers */
        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;
}

/* Type Conversion Functions */

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_VERSION_HEX < 0x03000000
  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_VERSION_HEX < 0x03000000
  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_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (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 = 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) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
